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; |       continue; | ||||||
|     } |     } | ||||||
|     for (const variable of current.variables) { |     for (const variable of current.variables) { | ||||||
|       let symbol = info.members.get(variable.value); |       let symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current); | ||||||
|       if (!symbol) { | 
 | ||||||
|         symbol = getVariableTypeFromDirectiveContext(variable.value, info.query, current); |  | ||||||
|       } |  | ||||||
|       const kind = info.query.getTypeKind(symbol); |       const kind = info.query.getTypeKind(symbol); | ||||||
|       if (kind === BuiltinType.Any || kind === BuiltinType.Unbound) { |       if (kind === BuiltinType.Any || kind === BuiltinType.Unbound) { | ||||||
|         // For special cases such as ngFor and ngIf, the any type is not very useful.
 |         // 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} = {}; |   primitiveIndexType: {[name: string]: string} = {}; | ||||||
|   anyValue: any; |   anyValue: any; | ||||||
|   optional?: string; |   optional?: string; | ||||||
|  |   // Use to test the `index` variable conflict between the `ngFor` and component context.
 | ||||||
|  |   index = null; | ||||||
|   myClick(event: any) {} |   myClick(event: any) {} | ||||||
|   birthday = new Date(); |   birthday = new Date(); | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user