Skip to content

Commit 143e651

Browse files
committed
fix(@angular/build): support TypeScript isolatedDeclarations option
This change allows the use of TypeScript's isolatedDeclarations compiler option by conditionally preserving the declaration and composite options when isolatedDeclarations is enabled. Previously, the Angular CLI forcefully set both declaration and composite to false, which prevented the use of isolatedDeclarations as TypeScript requires at least one of these options to be true when isolatedDeclarations is set (TS5069 error): ``` ✘ [ERROR] TS5069: Option 'isolatedDeclarations' cannot be specified without specifying option 'declaration' or option 'composite'. [plugin angular-compiler] ```
1 parent f712361 commit 143e651

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export abstract class AngularCompilation {
5252
suppressOutputPathCheck: true,
5353
outDir: undefined,
5454
sourceMap: false,
55-
declaration: false,
5655
declarationMap: false,
5756
allowEmptyCodegenFiles: false,
5857
annotationsAs: 'decorators',

packages/angular/build/src/tools/esbuild/angular/compiler-plugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,10 @@ function createCompilerOptionsTransformer(
733733
return {
734734
...compilerOptions,
735735
noEmitOnError: false,
736-
composite: false,
736+
// Allow declaration and composite when isolatedDeclarations is enabled
737+
// TypeScript requires either declaration or composite to be true when isolatedDeclarations is set
738+
declaration: compilerOptions.isolatedDeclarations ? compilerOptions.declaration : false,
739+
composite: compilerOptions.isolatedDeclarations ? compilerOptions.composite : false,
737740
inlineSources: !!pluginOptions.sourcemap,
738741
inlineSourceMap: !!pluginOptions.sourcemap,
739742
sourceMap: undefined,

0 commit comments

Comments
 (0)