fix: deprecate URL as the first arg of fetch (#14113)

This commit is contained in:
Yoshiya Hinosawa 2022-03-25 20:23:55 +09:00 committed by GitHub
parent bb3387de17
commit 3462d87503
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -435,6 +435,16 @@ declare class Response implements Body {
* ```
*/
declare function fetch(
input: Request | URL | string,
input: Request | string,
init?: RequestInit,
): Promise<Response>;
// TODO(kt3k): Remove the following overloaded declaration for 2.0.
/** @deprecated URL is deprecated as the first argument. Use string or Request object instead.
*
* Fetch a resource from the network. It returns a `Promise` that resolves to the
* `Response` to that `Request`, whether it is successful or not.
*/
declare function fetch(
input: URL,
init?: RequestInit,
): Promise<Response>;