You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Conditional type unexpectedly non-distributive with neverΒ #57343
typeIsNumber<T>=Textendsnumber ? true : falsetypeConflicted={x:true}&{x:false}// never// ^?typeEx1=IsNumber<Conflicted>// true. Should be never // ^?typeEx2=IsNumber<never>// ^?// Conflicted starts behaving like `never` again when distributivity is forced by putting it in a uniontypeEx3=IsNumber<"OEEE"|Conflicted>// false (boolean in TypeScript 4.6.4)// ^?typeEx4=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.
Activity
[-]Conditional with nover [/-][+]Conditional type unexpectedly non-distributive with `never`[/+]fatcerberus commentedon Feb 8, 2024
Possibly related to/same root cause as #57210?
edit: oh, you already said it was a do-over of 57210 in the OP, nevermind