fix(language-service): be resilient to invalidate ordering (#15470)
Fixes #15466
This commit is contained in:
parent
d05aa70c6b
commit
a5c972aa8b
|
@ -492,7 +492,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
|||
const type = this.checker.getTypeAtLocation(target);
|
||||
if (type) {
|
||||
const staticSymbol =
|
||||
this._reflector.getStaticSymbol(sourceFile.fileName, classDeclaration.name.text);
|
||||
this.reflector.getStaticSymbol(sourceFile.fileName, classDeclaration.name.text);
|
||||
try {
|
||||
if (this.resolver.isDirective(staticSymbol as any)) {
|
||||
const {metadata} =
|
||||
|
|
|
@ -52,6 +52,15 @@ describe('diagnostics', () => {
|
|||
includeDiagnostic(diagnostics(template), message, at, len);
|
||||
}
|
||||
|
||||
describe('regression', () => {
|
||||
it('should be able to return diagnostics if reflector gets invalidated', () => {
|
||||
const fileName = '/app/main.ts';
|
||||
ngService.getDiagnostics(fileName);
|
||||
(ngHost as any)._reflector = null;
|
||||
ngService.getDiagnostics(fileName);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with $event', () => {
|
||||
it('should accept an event',
|
||||
() => { accept('<div (click)="myClick($event)">Click me!</div>'); });
|
||||
|
|
Loading…
Reference in New Issue