Enable Angular strictTemplates across the four core-web apps
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 970
- Forks
- 486
- Avg merge
- 3d 33m
- Merged PRs (30d)
- 170
Description
Task
Re-enable Angular's strictTemplates across the four apps in core-web. It is false in all of them behind a TODO that points at an already-closed issue.
// apps/dotcms-ui/tsconfig.app.json — and the same block in the other three
"angularCompilerOptions": {
// TODO(#35930): re-enable strictTemplates once Angular 22 template errors are fixed per app
"strictTemplates": false
}
#35930 (Angular 21 → 22 migration) is CLOSED, so the condition that gated this flag has been met and the flag stayed off. Affected apps:
apps/dotcms-uiapps/dotcdnapps/dotcms-block-editorapps/dotcms-binary-field-builder
Why this is its own issue and not part of the strict-mode rollout
The strict-mode epic (#35932) is complete: all 44 projects it tracks carry the six flags, and dotcms-ui — the last one — landed in #36957. strictTemplates is a different gate and was deliberately left out of that scope.
Two facts make it a separate project:
1. strictTemplates: true is already set in 27 libraries and is inert in every one of them. A library with no build target never has its templates compiled, so the flag does nothing there. The only place it takes effect is an app — and in all four apps it is false. So the workspace currently looks like it has strict templates in 27 places and actually has them in zero.
2. Most of the work is not in the app. Measured on this branch by flipping the flag in apps/dotcms-ui/tsconfig.app.json and running nx run dotcms-ui:build:production:
| Count | |
|---|---|
| Errors | 430 |
| Distinct files | 373 |
…in apps/ |
142 |
…in libs/ |
231 |
By diagnostic code:
| Code | Count | What it is |
|---|---|---|
NG8107 |
231 | Object is possibly undefined in a template |
TS2322 |
141 | Not assignable |
TS2345 |
77 | Argument not assignable |
TS2531 |
74 | Object is possibly null |
TS2339 |
56 | Property does not exist |
TS2532 |
18 | Object is possibly undefined |
TS2722 |
17 | Cannot invoke possibly-undefined |
NG8102/NG8112/TS4111 |
15/6/6 |
Turning the flag on in dotcms-ui is therefore mostly work in ~27 libraries whose templates have never been type-checked, which is why it needs its own bottom-up rollout rather than a line in the dotcms-ui PR.
Proposed approach
Same shape as #35932, and for the same reason — keep each PR reviewable:
- Go bottom-up through the dependency graph. A library's template errors only surface when an app compiles them, so fix the leaves first.
- Per library, verify with a consuming app's build, not
tsc -p.tsc -pdoes not check templates at all — this is the trap that CLAUDE.md documents, and it is what let these 430 accumulate. - Flip the app flags last, one app per PR.
- Remove the four stale
TODO(#35930)comments as each app lands.
Acceptance Criteria
-
strictTemplates: truein all four apps'tsconfig.app.json -
nx run-many -t buildgreen, including:build:productionfor each app - The four
TODO(#35930)comments removed - No new
@ts-expect-error/$any()escapes introduced in templates without a linked issue -
nx run-many -t test lintno worse than the pre-change baseline
Notes
- Measurement was taken on branch
35932-enable-strict-modeat72f10fe5acand reverted; that branch does not contain the flag change. - Related: #35932 (strict mode rollout, complete), #35930 (Angular 22 migration, closed), #36957 (the PR that finished #35932).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the four apps/*/tsconfig.app.json files named in the issue and measure failures with an app production build, beginning with nx run dotcms-ui:build:production. Work bottom-up through the dependency graph, verifying library fixes through a consuming app rather than tsc -p. Done means all four flags are true, stale TODOs are removed, and the specified build, test, and lint commands meet the baseline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- build-system, frontend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100