From afdbf00d53a112566625555de0621962c38113be Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 27 Jul 2017 18:12:20 -0700 Subject: [PATCH] Add check to ensure that property access suggestions are only performed on the accessed property. --- src/services/codefixes/fixSpelling.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index c8f539e8d34..ff3bd455291 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -15,7 +15,8 @@ namespace ts.codefix { const node = getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false); // TODO: GH#15852 const checker = context.program.getTypeChecker(); let suggestion: string; - if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) { + if (isPropertyAccessExpression(node.parent) && node.parent.name === node) { + Debug.assert(node.kind === SyntaxKind.Identifier); const containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType); }