π Search Terms
never, intersection, contradiction
π Version & Regression Information
β― Playground Link
Workbench Repro
π» Code
type IsNumber<T> = T extends number ? true : false
type Conflicted = {x:true} & {x:false} // never
// ^?
type Ex1 = IsNumber<Conflicted> // true. Should be never
// ^?
type Ex2 = IsNumber<never>
// ^?
// Conflicted starts behaving like `never` again when distributivity is forced by putting it in a union
type Ex3 = IsNumber<"OEEE" | Conflicted> // false (boolean in TypeScript 4.6.4)
// ^?
type Ex4 = IsNumber<1 | Conflicted> // true
// ^?
π Actual behavior
Ex1 is true.
π Expected behavior
IsNumber<Conflicted> should be never. This is a distributive conditional.
Additional information about the issue
This also manifests as ReturnType<T> being unknown when T is a conflicted intersection.
Originally submitted in #57210 which was overly broad.
π Search Terms
never, intersection, contradiction
π Version & Regression Information
β― Playground Link
Workbench Repro
π» Code
π Actual behavior
Ex1istrue.π Expected behavior
IsNumber<Conflicted>should benever. This is a distributive conditional.Additional information about the issue
This also manifests as
ReturnType<T>beingunknownwhenTis a conflicted intersection.Originally submitted in #57210 which was overly broad.