response-promise.ts
This file
Path
test-d/response-promise.ts
9 lines · 357 bytes · TypeScript
Last changed by
Fix bytes shortcut return type for Blob and Response compatibilitySindre Sorhusbefore adoption481f6f7
History of this fileTake it
12345678910import {expectTypeOf} from 'expect-type';import type {ResponsePromise} from 'ky';
declare const response: ResponsePromise;const bytes = await response.bytes();
expectTypeOf(bytes).toEqualTypeOf<Awaited<ReturnType<Response['bytes']>>>();expectTypeOf(new Blob([bytes])).toEqualTypeOf<Blob>();expectTypeOf(new Response(bytes)).toEqualTypeOf<Response>();