2022-10-28 00:04:27 +00:00

21 lines
593 B
TypeScript

import type { ExpectExtends, ExpectFalse, ExpectTrue } 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']>>,
]