diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 64e61e15dfd..aebdad4822f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14504,7 +14504,7 @@ namespace ts { } function getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined { - const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfObjectType(containingType), SymbolFlags.Value); + const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfType(containingType), SymbolFlags.Value); return suggestion && suggestion.name; } diff --git a/src/services/codefixes/fixSpelling.ts b/src/services/codefixes/fixSpelling.ts index d632671f6ee..c8f539e8d34 100644 --- a/src/services/codefixes/fixSpelling.ts +++ b/src/services/codefixes/fixSpelling.ts @@ -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.getApparentType(checker.getTypeAtLocation(node.parent.expression)); + const containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType); } else { diff --git a/tests/cases/fourslash/codeFixCorrectSpelling.ts b/tests/cases/fourslash/codeFixCorrectSpelling1.ts similarity index 100% rename from tests/cases/fourslash/codeFixCorrectSpelling.ts rename to tests/cases/fourslash/codeFixCorrectSpelling1.ts