fix(language-service): resolve the variable from the template context first (#35982)
PR Close #35982
This commit is contained in:
		
							parent
							
								
									406419bc0f
								
							
						
					
					
						commit
						3d46a45fa8
					
				| @ -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.
 | ||||
|  | ||||
| @ -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(); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user