Skip to content

Commit 74e4903

Browse files
Merge pull request #17474 from Microsoft/quickFixLeftOfPropertyAccess
Enable spelling quick fixes for left side of property access
2 parents 06cfe51 + afdbf00 commit 74e4903

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-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
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
//// export declare const despite: { the: any };
4+
////
5+
//// [|dispite.the|]
6+
7+
verify.rangeAfterCodeFix(`despite.the`);

0 commit comments

Comments
 (0)