Merge pull request #17474 from Microsoft/quickFixLeftOfPropertyAccess
Enable spelling quick fixes for left side of property access
This commit is contained in:
commit
74e4903753
2 changed files with 9 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
7
tests/cases/fourslash/codeFixCorrectSpelling4.ts
Normal file
7
tests/cases/fourslash/codeFixCorrectSpelling4.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
/// <reference path='fourslash.ts' />
|
||||
|
||||
//// export declare const despite: { the: any };
|
||||
////
|
||||
//// [|dispite.the|]
|
||||
|
||||
verify.rangeAfterCodeFix(`despite.the`);
|
Loading…
Reference in a new issue