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
Following the control flow id1 does not seem to be assigned any value other than true. the function expression is not considered part of the flow, since it is not guaranteed to execute. the result is at the conditionid1 has the type true and the check is considered invalid.
A workaround would be to either cast to boolean as var id1 = true as boolean which widens the type of the variable form just true to true | false. or change the check to be for truthiness if (id1 && id2).
Okay, the fact that the function expression is not guaranteed to run and the result would be "true == false" makes sense to me. I will use the cast to boolean as a resolution.
After updating to TypeScript 2.1, I am receiving an error when compiling a project that compiled under TS 2.0.
Below is the snippet of code that produces the error.
Expected behavior: That this snippet will compile without errors.
Actual behavior: I receive the following error message:
error TS2365: Build:Operator '==' cannot be applied to types 'true' and 'false'.
due to this condition evaluation:
if (id1 == false && id2 == false) {
The text was updated successfully, but these errors were encountered: