mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-10 21:07:52 -05:00
spelling:getPropertiesOfType instead of objectType
This provides suggestions for more types based on their apparent type: unions, type parameters with constraints, primitives.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user