Skip to content

Commit

Permalink
Fix 47746 - Missing properties quickfix does not handle generic param…
Browse files Browse the repository at this point in the history
…eters (#47790)

* Added test

* Added extra test case
  • Loading branch information
komyg committed Feb 15, 2022
1 parent 44e827b commit d13af64
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/cases/fourslash/codeFixAddMissingProperties17.ts
@@ -0,0 +1,16 @@
/// <reference path='fourslash.ts' />

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

verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent: `const x: Foo<string> = {
foo: function(): string {
throw new Error("Function not implemented.");
}
};`,
});
20 changes: 20 additions & 0 deletions tests/cases/fourslash/codeFixAddMissingProperties18.ts
@@ -0,0 +1,20 @@
/// <reference path='fourslash.ts' />

////interface Bar {
//// a: number;
////}
////
////interface Foo<T, U> {
//// foo(a: T): U;
////}
////[|const x: Foo<string, Bar> = {};|]

verify.codeFix({
index: 0,
description: ts.Diagnostics.Add_missing_properties.message,
newRangeContent: `const x: Foo<string, Bar> = {
foo: function(a: string): Bar {
throw new Error("Function not implemented.");
}
};`,
});

0 comments on commit d13af64

Please sign in to comment.