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 only hit that problem once in 43 klocs, and the fix was really easy. I just removed the === true part from the test. Testing booleans with x === true is a bad habit anyway.
I like the optimistic approach descrbed in #9998. I see it as a tacit encouragement to reduce side-effects in code. When this kind of problem happens (when type inference is misled), it is probably a good idea to review the code and eliminate the nasty side-effects. If the TS compiler missed the mutation, it's likely that a developper will also miss it when reading the code.
TypeScript Version: 2.0.3
Code
Expected behavior:
Code should compile without errors.
Actual behavior:
compiler infers that
arg.val
is alwaysfalse
in theif
test. This is wrong becausefoo(x, arg)
modifiesarg.val
.The text was updated successfully, but these errors were encountered: