fix(language-service): infer `any` `ngForOf` of type `any`
Fixes: #17611
This commit is contained in:
parent
4e6be15069
commit
f194f18dbd
|
@ -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) {
|
||||||
|
|
|
@ -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', () => {
|
||||||
|
|
|
@ -148,6 +148,7 @@ export class TemplateReference {
|
||||||
id: 1,
|
id: 1,
|
||||||
name: 'Windstorm'
|
name: 'Windstorm'
|
||||||
};
|
};
|
||||||
|
anyValue: any;
|
||||||
myClick(event: any) {
|
myClick(event: any) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue