mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-01-13 17:03:00 +08:00
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:
@@ -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"});
|
||||
|
||||
11
types/fetch-mock/index.d.ts
vendored
11
types/fetch-mock/index.d.ts
vendored
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user