Skip to content

Missing properties quickfix does not handle generic parameters #47746

Closed
@hpx7

Description

@hpx7

Bug Report

🔎 Search Terms

quickfix missing properties generic parameter

🕗 Version & Regression Information

The quickfix was added in #44576 (cc @a-tarasyuk) but it doesn't appear to handle generic parameters.

💻 Code

interface Foo<T> {
  foo(): T;
}
const x: Foo<string> = {};

🙁 Actual behavior

The following is generated by the quickfix:

interface Foo<T> {
  foo(): T;
}
const x: Foo<string> = {
  foo: function (): T { // <-- this is wrong
    throw new Error("Function not implemented.");
  }
};

🙂 Expected behavior

I would expect to see string instead of T:

interface Foo<T> {
  foo(): T;
}
const x: Foo<string> = {
  foo: function (): string {
    throw new Error("Function not implemented.");
  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: Refactoringse.g. extract to constant or function, rename symbolHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions