headers.ts
This file
Path
test-d/headers.ts
7 lines · 264 bytes · TypeScript
Last changed by
Support readonly inputs and explicit undefined in TypeScript optionsSindre Sorhusbefore adoption51b3177
History of this fileTake it
Support readonly inputs and explicit undefined in TypeScript optionsSindre Sorhusbefore adoption51b3177
lines 1–7why, one step back1import {expectTypeOf} from 'expect-type';2import type {Options} from 'ky';34const headers = [['Accept', 'application/json'], ['X-Request-ID', '123']] as const;5const options: Options = {headers};67expectTypeOf(options.headers).toMatchTypeOf<Options['headers']>();