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
If we write test(obj.expl) we get compilation error.
In this code this inside impl() function infer to Test type
but if we write test(obj.impl) we don't get compilation error and get runtime error.
Checklist
My suggestion meets these guidelines:
This wouldn't be a breaking change in existing TypeScript/JavaScript code
This wouldn't change the runtime behavior of existing JavaScript code
This could be implemented without emitting different JS based on the types of the expressions
This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
Search Terms
implicit this method signature
Suggestion
Include implicit this in method signature when this used in method body and we can infer this type.
Use Cases
This help us find cases when we pass method of object as callback without using bind.
Examles
Let we have current class, function and class instance:
If we write
test(obj.expl)
we get compilation error.In this code this inside impl() function infer to Test type
but if we write
test(obj.impl)
we don't get compilation error and get runtime error.Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: