Closed
Description
Bug Report
🔎 Search Terms
Generic types, distributive unions, extends, naked type parameter
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about distributivity with naked type parameters.
⏯ Playground Link
Playground link with relevant code
💻 Code
type A<T> = T;
type B<T> = A<T> extends true ? "X" : "Y";
type C = B<true | false>; // "X" | "Y" (??)
🙁 Actual behavior
A<T>
in B
distributes types and returns the union of the results.
🙂 Expected behavior
Since T
is not naked in A<T>
, I was expecting distributivity to go away, like in :
type A<T> = T extends infer U ? U : never;
type B<T> = A<T> extends true ? "X" : "Y";
type C = B<true | false>; // "Y"