Skip to content

Instantly share code, notes, and snippets.

@tsujp
Created February 20, 2020 11:00
Show Gist options
  • Save tsujp/50e1ed586f69ad2ec40e75086f0762f8 to your computer and use it in GitHub Desktop.
Save tsujp/50e1ed586f69ad2ec40e75086f0762f8 to your computer and use it in GitHub Desktop.
interface TypedResponse<T = any> extends Response {
/**
* this will override `json` method from `Body` that is extended by `Response`
* interface Body {
* json(): Promise<any>;
* }
*/
json<P = T>(): Promise<P>
}
declare function fetch<T>(...args: any): Promise<TypedResponse<T>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment