type-fest/test-d/pascal-cased-properties.ts
2022-08-29 15:23:09 +07:00

23 lines
631 B
TypeScript

import {expectType} from 'tsd';
import type {PascalCasedProperties} from '../index';
declare const foo: PascalCasedProperties<{helloWorld: {fooBar: string}}>;
expectType<{HelloWorld: {fooBar: string}}>(foo);
declare const bar: PascalCasedProperties<Array<{helloWorld: string}>>;
expectType<Array<{helloWorld: string}>>(bar);
declare const fooBar: PascalCasedProperties<() => {a: string}>;
expectType<() => {a: string}>(fooBar);
// Verify example
type User = {
userId: number;
userName: string;
};
const result: PascalCasedProperties<User> = {
UserId: 1,
UserName: 'Tom',
};
expectType<PascalCasedProperties<User>>(result);