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
VS Code should show an error, tsc should refuse to compile it. Hovering this in VS Code should show MyClass, not any.
Actual behavior:
TypeScript 2.1.4 compiles this without complaining. VS Code doesn't show an error. It infers correctly that getData() should return a string, but it thinks this is any.
The text was updated successfully, but these errors were encountered:
Well, I guess this is a bit more verbose but it would work as a workaround for now. However, it looks ugly and seems totally unneccessary. MyClass.prototype.xxxx already implies that this is MyClass, doesn't it? So why can't or shouldn't TypeScript infer this correctly?
TypeScript Version: 2.1.4
Code
Consider this:
Expected behavior:
VS Code should show an error, tsc should refuse to compile it. Hovering
this
in VS Code should showMyClass
, notany
.Actual behavior:
TypeScript 2.1.4 compiles this without complaining. VS Code doesn't show an error. It infers correctly that getData() should return a string, but it thinks
this
isany
.The text was updated successfully, but these errors were encountered: