mirror of
https://github.com/type-challenges/type-challenges.git
synced 2025-12-08 19:06:13 +00:00
21 lines
631 B
TypeScript
21 lines
631 B
TypeScript
import type { ExpectTrue,ExpectFalse,ExpectExtends } from '@type-challenges/utils'
|
|
|
|
declare const example: {
|
|
foo: {
|
|
bar: {
|
|
a: string;
|
|
};
|
|
baz: {
|
|
b: number
|
|
c: number
|
|
}
|
|
};
|
|
}
|
|
|
|
type cases = [
|
|
ExpectTrue<ExpectExtends<Path<typeof example['foo']['bar']>, ['a']>>,
|
|
ExpectTrue<ExpectExtends<Path<typeof example['foo']['baz']>,['b'] | ['c'] >>,
|
|
ExpectTrue<ExpectExtends<Path<typeof example['foo']>, ['bar'] | ['baz'] | ['bar', 'a'] | ['baz', 'b'] | ['baz', 'c']>>,
|
|
ExpectFalse<ExpectExtends<Path<typeof example['foo']['bar']>, ['z']>>,
|
|
]
|