type T = '1' | '2'
type U = '1'
type N1 = T extends U ? never : T
type N2 = Exclude<T, U>
const n10: N1 = '1'
const n11: N1 = '2'
const n2: N2 = '2'
如上,对于 N1的类型是按着文档实现的,可与 Exclude 为什么表现不一致?
type T = '1' | '2'
type U = '1'
type N1 = T extends U ? never : T
type N2 = Exclude<T, U>
const n10: N1 = '1'
const n11: N1 = '2'
const n2: N2 = '2'
如上,对于 N1的类型是按着文档实现的,可与 Exclude 为什么表现不一致?
N1要是泛型,同时在使用N1的时候确定具体类型