type-fest/test-d/stringified.ts
Kai Niedziela b9a23df0aa
Add Stringified type (#95)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
2020-04-05 22:26:19 +08:00

13 lines
359 B
TypeScript

import {expectType, expectError} from 'tsd';
import {Stringified} from '..';
declare const stringified: Stringified<{a: number; b: string}>;
expectType<{a: string; b: string}>(stringified);
type Car = {
model: string;
speed: number;
};
expectError<Stringified<Car>>({model: 'Foo', speed: 101});
expectType<Stringified<Car>>({model: 'Foo', speed: '101'});