From 8de304c15a0878881ee1bb89f290ebdabb97a855 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Thu, 26 Jul 2018 13:32:23 -0700 Subject: [PATCH] fix(ivy): wait for preanalyze promises in loadNgStructureAsync() (#25080) loadNgStructureAsync() for ngtsc has a bug where it returns a Promise instead of awaiting the entire array of Promises. This commit uses Promise.all() to await the whole set. PR Close #25080 --- packages/compiler-cli/src/ngtsc/program.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/compiler-cli/src/ngtsc/program.ts b/packages/compiler-cli/src/ngtsc/program.ts index 54ca39ea67..6d4544f8af 100644 --- a/packages/compiler-cli/src/ngtsc/program.ts +++ b/packages/compiler-cli/src/ngtsc/program.ts @@ -75,12 +75,11 @@ export class NgtscProgram implements api.Program { async loadNgStructureAsync(): Promise { 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 => 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 => result !== undefined)); } listLazyRoutes(entryRoute?: string|undefined): api.LazyRoute[] {