fetch-request.ts
This file
Path
test-d/fetch-request.ts
13 lines · 402 bytes · TypeScript
Last changed by
Type custom fetch callbacks with Request inputsSindre Sorhusbefore adoptione58817d
History of this fileTake it
Type custom fetch callbacks with Request inputsSindre Sorhusbefore adoptione58817d
lines 1–13why, one step back1import {expectTypeOf} from 'expect-type';2import ky from 'ky';34void ky('https://example.com', {5 async fetch(request, options) {6 expectTypeOf(request).toEqualTypeOf<Request>();7 expectTypeOf(request.method).toEqualTypeOf<string>();8 expectTypeOf(request.url).toEqualTypeOf<string>();9 return globalThis.fetch(request, options);10 },11});1213void ky('https://example.com', {fetch: globalThis.fetch});