Angular strict template "error TS" type-check failure in CI
With strictTemplates enabled in angularCompilerOptions, the compiler type-checks template expressions like TypeScript code. A type mismatch in a binding produces an "error TS..." referencing the .html file, failing the CI build.
What this error means
ng build fails with "error TS2322: Type 'string' is not assignable to type 'number'" pointing at a template file and a property binding.
src/app/cart/cart.component.html:3:22 - error TS2322:
Type 'string' is not assignable to type 'number'.
3 <app-qty [count]="'5'"></app-qty>Common causes
A binding type does not match the input type
strictTemplates checks that the bound expression matches the @Input type; passing a string to a number input is an error.
Possibly null/undefined values in strict null templates
With strict null checks, a binding that may be null/undefined against a non-nullable input fails type checking in the template.
How to fix it
Fix the binding to match the declared type
- Read the TS code and the template location.
- Correct the bound expression type (bind a number, guard a nullable, or fix the @Input type).
- Rebuild to confirm the template type-checks.
<!-- pass a number, not a string -->
<app-qty [count]="5"></app-qty>Keep strict templates on and align types
Rather than disabling strictTemplates, fix inputs and bindings so types agree; strict templates catch real bugs before runtime.
"angularCompilerOptions": {
"strictTemplates": true
}How to prevent it
- Enable strictTemplates locally so template type errors surface before CI.
- Type @Input properties precisely and bind matching expressions.
- Guard nullable values in templates under strict null checks.