diff --git a/tests/cases/fourslash/codeFixAddMissingProperties17.ts b/tests/cases/fourslash/codeFixAddMissingProperties17.ts new file mode 100644 index 0000000000000..3f1cb6ade3af7 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingProperties17.ts @@ -0,0 +1,16 @@ +/// + +////interface Foo { +//// foo(): T; +////} +////[|const x: Foo = {};|] + +verify.codeFix({ + index: 0, + description: ts.Diagnostics.Add_missing_properties.message, + newRangeContent: `const x: Foo = { + foo: function(): string { + throw new Error("Function not implemented."); + } +};`, +}); diff --git a/tests/cases/fourslash/codeFixAddMissingProperties18.ts b/tests/cases/fourslash/codeFixAddMissingProperties18.ts new file mode 100644 index 0000000000000..53629b59c7b79 --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingProperties18.ts @@ -0,0 +1,20 @@ +/// + +////interface Bar { +//// a: number; +////} +//// +////interface Foo { +//// foo(a: T): U; +////} +////[|const x: Foo = {};|] + +verify.codeFix({ + index: 0, + description: ts.Diagnostics.Add_missing_properties.message, + newRangeContent: `const x: Foo = { + foo: function(a: string): Bar { + throw new Error("Function not implemented."); + } +};`, +});