mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Fix 47746 - Missing properties quickfix does not handle generic parameters (#47790)
* Added test * Added extra test case
This commit is contained in:
16
tests/cases/fourslash/codeFixAddMissingProperties17.ts
Normal file
16
tests/cases/fourslash/codeFixAddMissingProperties17.ts
Normal 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.");
|
||||
}
|
||||
};`,
|
||||
});
|
||||
20
tests/cases/fourslash/codeFixAddMissingProperties18.ts
Normal file
20
tests/cases/fourslash/codeFixAddMissingProperties18.ts
Normal 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.");
|
||||
}
|
||||
};`,
|
||||
});
|
||||
Reference in New Issue
Block a user