-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types: Make initial argument to
fetch
required, per specification.
The first argument to the `fetch` method from the Fetch API is not meant to be optional, per the specification (linked in the references below). I'm also unaware of any implementation where all parameters are optional, so even if there is a case where it could be something different than what was specified here, we should probably change the type to be something more concrete since passing _no_ options at all seems undesirable. While I'm not certain why it was optionalized in the original types, changing it to be required will hopefully be unobtrusive because of the aforementioned reasons. Moreso, since these are typing changes only, releasing this change will not cause runtime surprises, but rather type errors at compilation type. Please open an issue if you discover an incompatibility in a project that cannot be easily resolved! Ref: https://fetch.spec.whatwg.org/#fetch-method Ref: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API Fixes: #4741
- Loading branch information
Showing
4 changed files
with
4 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
declare function fetch( | ||
input?: RequestInfo, | ||
input: RequestInfo, | ||
init?: RequestInit, | ||
): Promise<Response>; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters