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
declareconstmaybe: true|null;leti=0;// This worksconsta=maybe??true;// This worksconstb=(i++,maybe);constc=b??true;// This failsconstd=(i++,maybe)??true;
π Actual behavior
A build error occurs:
Right operand of ?? is unreachable because the left operand is never nullish. ts(2869)
π Expected behavior
The code should compile without error; The left side of the ?? can still be nullish in the const d case.
The const b / const c case is functionally identical and is recognized to be valid
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
comma operator nullish coalescing never
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.6.3#code/FAEwpgxgNghgTmABBA9gOwM4BdEFsYCeARmAFyJZwCuSAPomlVFANzDBRg4CWiAvIgAMbYAG9giScnTZEMfnkIlEAfhUVqYNoglTUmHEQUAKbgGozAGkXEwASm16ZOCAqNqNNEVOkHEIE3MrGxI7VXVKL2AAX3ZgIA
π» Code
π Actual behavior
A build error occurs:
π Expected behavior
The code should compile without error; The left side of the
??
can still be nullish in theconst d
case.The
const b
/const c
case is functionally identical and is recognized to be validAdditional information about the issue
No response
The text was updated successfully, but these errors were encountered: