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
Actual behavior:
Error, string | number is not assignable to number.
Also:
declarefunctionisBig(x: any): x is typeofx&{big: true};functionbigger(this: object){if(isBig(this)){this.big;// Expect property to exist}}
The type guard does nothing, but it should narrow and make the big member available within the true branch of the if statement.
We do some CFA on this when it is a this type from a class declaration and we want to check for definite assignment, but we're conspicuously lacking any calls to getFlowTypeOfReference in any other code paths in checkThisExpression. I'm pretty sure isMatchingReference already should handle this, too, since it needed to in order to handle narrowing this.foo correctly.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.7.0-dev.201xxxxx
Code
Expected behavior:
Assignment succeeds.
Actual behavior:
Error,
string | number
is not assignable tonumber
.Also:
The type guard does nothing, but it should narrow and make the
big
member available within the true branch of the if statement.We do some CFA on
this
when it is athis
type from a class declaration and we want to check for definite assignment, but we're conspicuously lacking any calls togetFlowTypeOfReference
in any other code paths incheckThisExpression
. I'm pretty sureisMatchingReference
already should handle this, too, since it needed to in order to handle narrowingthis.foo
correctly.The text was updated successfully, but these errors were encountered: