Skip to content

Object method snippet completions incorrectly add this parameters  #49426

Closed
@mjbvz

Description

@mjbvz

Bug Report

🔎 Search Terms

  • suggest / suggestions
  • completions
  • IntelliSense

🕗 Version & Regression Information

4.8.0-dev.20220606, not a regression

💻 Code

Try using a method snippet that uses a this parameter

interface IFoo {
    bar(this: IFoo): void; 
}

const foo: IFoo = {
    // Trigger completions here    
};

foo.bar();

🙁 Actual behavior

The this parameter is also inserted:

interface IFoo {
    bar(this: IFoo): void;
}

const foo: IFoo = {
    bar(this) {

    },
};

foo.bar();

🙂 Expected behavior

The this parameter should likely be omitted in this case

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions