mirror of
https://github.com/sindresorhus/type-fest.git
synced 2025-12-08 19:25:05 +00:00
16 lines
448 B
TypeScript
16 lines
448 B
TypeScript
import {expectType} from 'tsd';
|
|
import type {ConditionalKeys} from '../index';
|
|
|
|
type Example = {
|
|
a: string;
|
|
b?: string | number;
|
|
c?: string;
|
|
d: Record<string, unknown>;
|
|
};
|
|
|
|
declare const exampleConditionalKeys: ConditionalKeys<Example, string>;
|
|
expectType<'a'>(exampleConditionalKeys);
|
|
|
|
declare const exampleConditionalKeysWithUndefined: ConditionalKeys<Example, string | undefined>;
|
|
expectType<'a' | 'c'>(exampleConditionalKeysWithUndefined);
|