fix(language-service): resolve the variable from the template context first (#35982)

PR Close #35982
This commit is contained in:
ivanwonder 2020-03-10 12:22:46 +08:00 committed by Matias Niemelä
parent 406419bc0f
commit 3d46a45fa8
2 changed files with 4 additions and 4 deletions

View File

@ -91,10 +91,8 @@ function getVarDeclarations(
continue;
}
for (const variable of current.variables) {
let symbol = info.members.get(variable.value);
if (!symbol) {
symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current);
}
let symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current);
const kind = info.query.getTypeKind(symbol);
if (kind === BuiltinType.Any || kind === BuiltinType.Unbound) {
// For special cases such as ngFor and ngIf, the any type is not very useful.

View File

@ -170,6 +170,8 @@ export class TemplateReference {
primitiveIndexType: {[name: string]: string} = {};
anyValue: any;
optional?: string;
// Use to test the `index` variable conflict between the `ngFor` and component context.
index = null;
myClick(event: any) {}
birthday = new Date();
}