mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Spelling code fix:suggestions from apparent type
The code fix for spelling correction needs to provide suggestions based on the apparent type since sometimes the type at a location will be a type parameter. One such example is `this`. Fixes #16744
This commit is contained in:
@@ -16,7 +16,7 @@ namespace ts.codefix {
|
||||
const checker = context.program.getTypeChecker();
|
||||
let suggestion: string;
|
||||
if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) {
|
||||
const containingType = checker.getTypeAtLocation(node.parent.expression);
|
||||
const containingType = checker.getApparentType(checker.getTypeAtLocation(node.parent.expression));
|
||||
suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user