type TestAny = any extends 'a' ? 1 : 2 // => 1 | 2 why??? how to understand?
type TestUnknown = unknown extends 'a' ? 1 : 2 // => 2
type TestStringA = 'a' extends 'a' ? 1 : 2 // => 1
type SomeUnion = 'a' | 'b'
type UnionDistribute<T> = T extends 'a' ? 1 : 2
type t0 = UnionDistribute<SomeUnion> // => 1 | 2 // any work like an union
Run Code Online (Sandbox Code Playgroud)
为什么any extends 'a' …
typescript ×1