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
1234567891011121314import {expectTypeOf} from 'expect-type';import ky from 'ky';
void ky('https://example.com', { async fetch(request, options) { expectTypeOf(request).toEqualTypeOf<Request>(); expectTypeOf(request.method).toEqualTypeOf<string>(); expectTypeOf(request.url).toEqualTypeOf<string>(); return globalThis.fetch(request, options); },});
void ky('https://example.com', {fetch: globalThis.fetch});