From 4309c0e7f8124a61937a170a0e702b96a2cbcac3 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 29 Mar 2018 14:55:22 -0700 Subject: [PATCH] Fix bug: ClassDeclaration not guaranteed to be first declaration of a class (#22983) * Fix bug: ClassDeclaration not guaranteed to be first declaration of a class * fix test --- ...dMissingMember_classIsNotFirstDeclaration.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts diff --git a/tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts b/tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts new file mode 100644 index 00000000000..2142c2e955c --- /dev/null +++ b/tests/cases/fourslash/codeFixAddMissingMember_classIsNotFirstDeclaration.ts @@ -0,0 +1,17 @@ +/// + +////interface C {} +////class C { +////} +////new C().x = 0; + +verify.codeFix({ + description: "Declare property 'x'", + index: 0, + newFileContent: +`interface C {} +class C { + x: number; +} +new C().x = 0;`, +});