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
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.
The text was updated successfully, but these errors were encountered:
rotu
changed the title
Conditional with nover
Conditional type unexpectedly non-distributive with neverFeb 8, 2024
Uh oh!
There was an error while loading. Please reload this page.
π Search Terms
never, intersection, contradiction
π Version & Regression Information
β― Playground Link
Workbench Repro
π» Code
π Actual behavior
Ex1
istrue
.π Expected behavior
IsNumber<Conflicted>
should benever
. This is a distributive conditional.Additional information about the issue
This also manifests as
ReturnType<T>
beingunknown
whenT
is a conflicted intersection.Originally submitted in #57210 which was overly broad.
The text was updated successfully, but these errors were encountered: