Skip to content

Commit 2be4035

Browse files
committed
fix(@angular/build): skip semantic diagnostics for declaration files
Declaration files don't produce semantic or template diagnostics, so calling getSemanticDiagnostics() on them was just wasted work. Move the isDeclarationFile guard to before that call so .d.ts files are skipped entirely.
1 parent b44828c commit 2be4035

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/angular/build/src/tools/angular/compilation/aot-compilation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,17 +265,17 @@ export class AotCompilation extends AngularCompilation {
265265
continue;
266266
}
267267

268+
// Declaration files have no semantic or template diagnostics.
269+
if (sourceFile.isDeclarationFile) {
270+
continue;
271+
}
272+
268273
yield* profileSync(
269274
'NG_DIAGNOSTICS_SEMANTIC',
270275
() => typeScriptProgram.getSemanticDiagnostics(sourceFile),
271276
true,
272277
);
273278

274-
// Declaration files cannot have template diagnostics
275-
if (sourceFile.isDeclarationFile) {
276-
continue;
277-
}
278-
279279
// Only request Angular template diagnostics for affected files to avoid
280280
// overhead of template diagnostics for unchanged files.
281281
if (affectedFiles.has(sourceFile)) {

0 commit comments

Comments
 (0)