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
Null Coalescing operator:
I found this issue which is very similar, but I don't think it's the same. I mean it seems to me that if the compiler can correctly narrow the type with the ternary it should do the same for the null coalescing
🕗 Version & Regression Information
I have determined that in v4.2.3 all 3 examples from my code fail, and that in v4.3.5 only the last fails. I think none of them should fail, but I'm not positive on that, only positive that they all should behave the same
Typescript happily understands the first 2 attempts at removing null from the possible types (object destructuring defaults and the ternary operator) but complains when the null coalescing operator is used.
🙂 Expected behavior
The null coalescing operator should behave exactly the same as the equivalent ternary or object destructuring expression
The text was updated successfully, but these errors were encountered:
Bug Report
🔎 Search Terms
Null Coalescing operator:
I found this issue which is very similar, but I don't think it's the same. I mean it seems to me that if the compiler can correctly narrow the type with the ternary it should do the same for the null coalescing
🕗 Version & Regression Information
⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
Typescript happily understands the first 2 attempts at removing null from the possible types (object destructuring defaults and the ternary operator) but complains when the null coalescing operator is used.
🙂 Expected behavior
The null coalescing operator should behave exactly the same as the equivalent ternary or object destructuring expression
The text was updated successfully, but these errors were encountered: