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
I'd expect that the language service powering the IDE would be able to determine that the variable namely date is actually a union type of string | Date.
Actual behavior:
The IDE claims that date variable is actually a type of Date, ignoring the possibility that the left operand of the logical AND might evaluate as false. In the above snippet the type of date is actually a string as the short-circuit occurs, returning the value of the left operand (according to the
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: 2.2.2.0
Code
I recreated this issue in the playground too.
Expected behavior:
I'd expect that the language service powering the IDE would be able to determine that the variable namely
date
is actually a union type ofstring | Date
.Actual behavior:
The IDE claims that
date
variable is actually a type ofDate
, ignoring the possibility that the left operand of the logical AND might evaluate asfalse
. In the above snippet the type ofdate
is actually astring
as the short-circuit occurs, returning the value of the left operand (according to theI'm using version 2.2.2.0, but the playground exhibits this same behavior (although, I'm not certain what version it uses).
The text was updated successfully, but these errors were encountered: