Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I havesearched for related issues and found none that match my proposal.
- I have searched thecurrent rule list and found no rules that match my proposal.
- I haveread the FAQ and my problem is not listed.
Relevant Package
scope-manager
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
While working on#1991, we discovered that there's no way currently to detect if a method signature usesthis
. The reason is that this:
interfaceX{foo(): this;}
Is not transformable to this:
interfaceX{foo:()=> this;}
While I don't exactly understand the assignability differences and whatthis
means in each case, my understanding is we want to look for method signatures that referencethis
, butthis
has to refer to the type bound by the method, so we still keep the autofix for:
interfaceX{foo():(this:Y)=> this;}
Therefore, the best way is to track this in the scope manager, similar to how we automatically injectarguments
forFunctionScope
. In fact, for the code above, we already trackthis
as a normal variable.
Additional Info
No response