Skip to content

Commit e0bf267

Browse files
committed
spelling:getPropertiesOfType instead of objectType
This provides suggestions for more types based on their apparent type: unions, type parameters with constraints, primitives.
1 parent f45df8f commit e0bf267

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14504,7 +14504,7 @@ namespace ts {
1450414504
}
1450514505

1450614506
function getSuggestionForNonexistentProperty(node: Identifier, containingType: Type): string | undefined {
14507-
const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfObjectType(containingType), SymbolFlags.Value);
14507+
const suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfType(containingType), SymbolFlags.Value);
1450814508
return suggestion && suggestion.name;
1450914509
}
1451014510

src/services/codefixes/fixSpelling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace ts.codefix {
1616
const checker = context.program.getTypeChecker();
1717
let suggestion: string;
1818
if (node.kind === SyntaxKind.Identifier && isPropertyAccessExpression(node.parent)) {
19-
const containingType = checker.getApparentType(checker.getTypeAtLocation(node.parent.expression));
19+
const containingType = checker.getTypeAtLocation(node.parent.expression);
2020
suggestion = checker.getSuggestionForNonexistentProperty(node as Identifier, containingType);
2121
}
2222
else {

0 commit comments

Comments
 (0)