Skip to content

Commit f98cc82

Browse files
authored
feat(@schematics/angular): rely on strict template default in generated workspaces
Since strict templates are now the default in the Angular compiler, this change removes the explicit "strictTemplates": true setting when creating a new strict workspace. We now only explicitly set "strictTemplates": false when the workspace is created with --strict=false to maintain consistent behavior for non-strict setups.
1 parent ca6f08c commit f98cc82

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/schematics/angular/workspace/files/tsconfig.json.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"angularCompilerOptions": {
1919
"enableI18nLegacyMessageIdFormat": false<% if (strict) { %>,
2020
"strictInjectionParameters": true,
21-
"strictInputAccessModifiers": true,
22-
"strictTemplates": true<% } %>
21+
"strictInputAccessModifiers": true<% } else { %>,
22+
"strictTemplates": false<% } %>
2323
},
2424
"files": []
2525
}

packages/schematics/angular/workspace/index_spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ describe('Workspace Schematic', () => {
9999
tree.readContent('tsconfig.json').toString(),
100100
);
101101
expect(compilerOptions.strict).toBeUndefined();
102-
expect(
103-
Object.keys(angularCompilerOptions).filter((option) => option.startsWith('strict')),
104-
).toEqual([]);
102+
expect(angularCompilerOptions.strictTemplates).toBeFalse();
103+
expect(angularCompilerOptions.strictInputAccessModifiers).toBeUndefined();
104+
expect(angularCompilerOptions.strictInjectionParameters).toBeUndefined();
105105
});
106106

107107
it('should add strict compiler options when true', async () => {
@@ -112,8 +112,10 @@ describe('Workspace Schematic', () => {
112112
const { compilerOptions, angularCompilerOptions } = parseJson(
113113
tree.readContent('tsconfig.json').toString(),
114114
);
115-
expect(compilerOptions.strict).toBe(true);
116-
expect(angularCompilerOptions.strictTemplates).toBe(true);
115+
expect(compilerOptions.strict).toBeTrue();
116+
expect(angularCompilerOptions.strictTemplates).toBeUndefined();
117+
expect(angularCompilerOptions.strictInputAccessModifiers).toBeTrue();
118+
expect(angularCompilerOptions.strictInjectionParameters).toBeTrue();
117119
});
118120

119121
it('should add vscode testing configuration', async () => {

0 commit comments

Comments
 (0)