fix(language-service): infer `any` `ngForOf` of type `any`

Fixes: #17611
This commit is contained in:
Chuck Jazdzewski 2017-06-19 10:07:54 -07:00 committed by Hans
parent 4e6be15069
commit f194f18dbd
3 changed files with 7 additions and 2 deletions

View File

@ -154,8 +154,8 @@ function refinedVariableType(
} }
} }
// We can't do better, just return the original type. // We can't do better, return any
return type; return info.query.getBuiltinType(BuiltinType.Any);
} }
function getEventDeclaration(info: DiagnosticTemplateInfo, includeEvent?: boolean) { function getEventDeclaration(info: DiagnosticTemplateInfo, includeEvent?: boolean) {

View File

@ -59,6 +59,10 @@ describe('diagnostics', () => {
(ngHost as any)._reflector = null; (ngHost as any)._reflector = null;
ngService.getDiagnostics(fileName); ngService.getDiagnostics(fileName);
}); });
// #17611
it('should not report diagnostic on iteration of any',
() => { accept('<div *ngFor="let value of anyValue">{{value.someField}}</div>'); });
}); });
describe('with $event', () => { describe('with $event', () => {

View File

@ -148,6 +148,7 @@ export class TemplateReference {
id: 1, id: 1,
name: 'Windstorm' name: 'Windstorm'
}; };
anyValue: any;
myClick(event: any) { myClick(event: any) {
} }