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
When in a generic function a conditional type cannot be resolved and is remained as is, nothing can be assigned to it (apparently).
🔎 Search Terms
conditional type assignment
🕗 Version & Regression Information
I tested this on version 4.1.2 and nightly. Playground's toolbar was not functioning, so I couldn't check other versions.
⏯ Playground Link
Playground's toolbar was not functioning, so I couldn't check other versions. I reloaded the page a few times and waited for some time, and used different browsers, but it didn't work.
💻 Code
functionf<T>(){consta: T=null!;constb: Textendsstring ? T : T=a;}
🙁 Actual behavior
Gives this error: Type 'T' is not assignable to type 'T extends string ? T : T'. (2322)
🙂 Expected behavior
It should check the type of a against the two conditional cases and type-check successfully.
The text was updated successfully, but these errors were encountered:
Bug Report
When in a generic function a conditional type cannot be resolved and is remained as is, nothing can be assigned to it (apparently).
🔎 Search Terms
conditional type assignment
🕗 Version & Regression Information
⏯ Playground Link
Playground's toolbar was not functioning, so I couldn't check other versions. I reloaded the page a few times and waited for some time, and used different browsers, but it didn't work.
💻 Code
🙁 Actual behavior
Gives this error:
Type 'T' is not assignable to type 'T extends string ? T : T'. (2322)
🙂 Expected behavior
It should check the type of
a
against the two conditional cases and type-check successfully.The text was updated successfully, but these errors were encountered: