fix(ivy): wait for preanalyze promises in loadNgStructureAsync() (#25080)

loadNgStructureAsync() for ngtsc has a bug where it returns a
Promise<Promise[]> instead of awaiting the entire array of Promises.

This commit uses Promise.all() to await the whole set.

PR Close #25080
This commit is contained in:
Alex Rickabaugh 2018-07-26 13:32:23 -07:00 committed by Igor Minar
parent 0d1d5898e3
commit 8de304c15a
1 changed files with 4 additions and 5 deletions

View File

@ -75,12 +75,11 @@ export class NgtscProgram implements api.Program {
async loadNgStructureAsync(): Promise<void> {
if (this.compilation === undefined) {
this.compilation = this.makeCompilation();
await this.tsProgram.getSourceFiles()
.filter(file => !file.fileName.endsWith('.d.ts'))
.map(file => this.compilation !.analyzeAsync(file))
.filter((result): result is Promise<void> => result !== undefined);
}
await Promise.all(this.tsProgram.getSourceFiles()
.filter(file => !file.fileName.endsWith('.d.ts'))
.map(file => this.compilation !.analyzeAsync(file))
.filter((result): result is Promise<void> => result !== undefined));
}
listLazyRoutes(entryRoute?: string|undefined): api.LazyRoute[] {