fetch-mock: method option is optional

Actually, it should be never but to keep compatibility,
we decided to make this method option optional

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29264#discussion_r221364845
This commit is contained in:
Fumiaki MATSUSHIMA
2018-09-29 13:16:54 +09:00
parent 44ea6863ba
commit a9adebaed4
2 changed files with 7 additions and 5 deletions

View File

@@ -62,6 +62,7 @@ fetchMock.patchOnce("http://test.com", 200);
fetchMock.get("http://test.com", 200, {method: "GET"});
fetchMock.get("http://test.com", 200, {method: "GET", overwriteRoutes: true});
fetchMock.get("http://test.com", 200, {overwriteRoutes: true});
fetchMock.post("http://test.com", 200, {method: "POST"});
fetchMock.put("http://test.com", 200, {method: "PUT"});
fetchMock.delete("http://test.com", 200, {method: "DELETE"});

View File

@@ -6,6 +6,7 @@
// Chris Sinclair <https://github.com/chrissinclair>
// Matt Tennison <https://github.com/matttennison>
// Quentin Bouygues <https://github.com/quentinbouygues>
// Fumiaki Matsushima <https://github.com/mtsmfm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -165,23 +166,23 @@ declare namespace fetchMock {
}
interface MockOptionsMethodGet extends MockOptions {
method: 'GET';
method?: 'GET';
}
interface MockOptionsMethodPost extends MockOptions {
method: 'POST';
method?: 'POST';
}
interface MockOptionsMethodPut extends MockOptions {
method: 'PUT';
method?: 'PUT';
}
interface MockOptionsMethodDelete extends MockOptions {
method: 'DELETE';
method?: 'DELETE';
}
interface MockOptionsMethodHead extends MockOptions {
method: 'HEAD';
method?: 'HEAD';
}
interface FetchMockStatic {