Fix 47746 - Missing properties quickfix does not handle generic parameters (#47790)

* Added test

* Added extra test case
This commit is contained in:
Felipe Armoni
2022-02-15 21:09:01 +00:00
committed by GitHub
parent 44e827bcc9
commit d13af64bde
2 changed files with 36 additions and 0 deletions

View File

@@ -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.");
}
};`,
});

View File

@@ -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.");
}
};`,
});