From a9820c31256f942e5468b66bc2b3527e6e73484c Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Mon, 13 Apr 2026 12:03:27 +0000 Subject: [PATCH] refactor(@schematics/angular): remove explicit strict true in tsconfig template for TS6 compatibility TypeScript 6 enables strict mode by default. This change updates the workspace schematic's `tsconfig.json` template to omit `"strict": true` when strict mode is desired (relying on the default), and explicitly sets `"strict": false` when it is disabled. --- .../schematics/angular/workspace/files/tsconfig.json.template | 4 ++-- packages/schematics/angular/workspace/index_spec.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/schematics/angular/workspace/files/tsconfig.json.template b/packages/schematics/angular/workspace/files/tsconfig.json.template index 799cff73365a..1554144c16ea 100644 --- a/packages/schematics/angular/workspace/files/tsconfig.json.template +++ b/packages/schematics/angular/workspace/files/tsconfig.json.template @@ -3,11 +3,11 @@ { "compileOnSave": false, "compilerOptions": {<% if (strict) { %> - "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true,<% } %> + "noFallthroughCasesInSwitch": true,<% } else { %> + "strict": false,<% } %> "skipLibCheck": true, "isolatedModules": true, "experimentalDecorators": true, diff --git a/packages/schematics/angular/workspace/index_spec.ts b/packages/schematics/angular/workspace/index_spec.ts index 7941fbac96cc..7f726fde8f1f 100644 --- a/packages/schematics/angular/workspace/index_spec.ts +++ b/packages/schematics/angular/workspace/index_spec.ts @@ -98,7 +98,7 @@ describe('Workspace Schematic', () => { const { compilerOptions, angularCompilerOptions } = parseJson( tree.readContent('tsconfig.json').toString(), ); - expect(compilerOptions.strict).toBeUndefined(); + expect(compilerOptions.strict).toBeFalse(); expect(angularCompilerOptions.strictTemplates).toBeFalse(); expect(angularCompilerOptions.strictInputAccessModifiers).toBeUndefined(); expect(angularCompilerOptions.strictInjectionParameters).toBeUndefined(); @@ -112,7 +112,7 @@ describe('Workspace Schematic', () => { const { compilerOptions, angularCompilerOptions } = parseJson( tree.readContent('tsconfig.json').toString(), ); - expect(compilerOptions.strict).toBeTrue(); + expect(compilerOptions.strict).toBeUndefined(); expect(angularCompilerOptions.strictTemplates).toBeUndefined(); expect(angularCompilerOptions.strictInputAccessModifiers).toBeTrue(); expect(angularCompilerOptions.strictInjectionParameters).toBeTrue();