🔎 Search Terms
generic, conditional, premature / eager / defer, inline,
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about generic conditional types
⏯ Playground Link
Playground link
💻 Code
typeIsNumber<T>=[T]extends[number] ? true : falsetypeIsFalse<Textendsboolean>=false[]extendsT[] ? true : falsetypeDirect=IsFalse<IsNumber<string>>extendstrue ? 0 : 1;// ^? type Direct = 0typeShortcut<T>=IsFalse<IsNumber<T>>extendstrue ? 0 : 1;typeIndirect=Shortcut<string>;// ^? type Indirect = 1
🙁 Actual behavior
Direct and Indirect are different.
🙂 Expected behavior
Direct and Indirect should be the same because Direct is just an inlined version of Shortcut<string>.
Additional information about the issue
This feels like a similar issue to #39364, #30708, #30020 and maybe some others, but many of those have been resolved already and yet this one remains. Came from this Stack Overflow question.
🔎 Search Terms
generic, conditional, premature / eager / defer, inline,
🕗 Version & Regression Information
⏯ Playground Link
Playground link
💻 Code
🙁 Actual behavior
DirectandIndirectare different.🙂 Expected behavior
DirectandIndirectshould be the same becauseDirectis just an inlined version ofShortcut<string>.Additional information about the issue
This feels like a similar issue to #39364, #30708, #30020 and maybe some others, but many of those have been resolved already and yet this one remains. Came from this Stack Overflow question.