Skip to content

Commit 1d95ebf

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 1d95ebf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,9 @@ function createCompilerOptionsTransformer(
733733
return {
734734
...compilerOptions,
735735
noEmitOnError: false,
736-
composite: false,
736+
// TypeScript requires either declaration or composite to be true when isolatedDeclarations is set
737+
declaration: compilerOptions.isolatedDeclarations ? compilerOptions.declaration : false,
738+
composite: compilerOptions.isolatedDeclarations ? compilerOptions.composite : false,
737739
inlineSources: !!pluginOptions.sourcemap,
738740
inlineSourceMap: !!pluginOptions.sourcemap,
739741
sourceMap: undefined,

0 commit comments

Comments
 (0)