Skip to content

Commit afdbf00

Browse files
Add check to ensure that property access suggestions are only performed on the accessed property.
1 parent 4315c2a commit afdbf00

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/services/codefixes/fixSpelling.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ namespace ts.codefix {
1515
const node = getTokenAtPosition(sourceFile, context.span.start, /*includeJsDocComment*/ false); // TODO: GH#15852
1616
const checker = context.program.getTypeChecker();
1717
let suggestion: string;
18-
if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) {
18+
if (isPropertyAccessExpression(node.parent) && node.parent.name === node) {
19+
Debug.assert(node.kind === SyntaxKind.Identifier);
1920
const containingType = checker.getTypeAtLocation(node.parent.expression);
2021
suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType);
2122
}

0 commit comments

Comments
 (0)