Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Angular checks template expressions and bindings during compilation, using TypeScript’s type checker in the AOT template-checking phase. To catch more than basic expression mistakes—including input type mismatches, nullable values, and event types—enable strictTemplates in the application’s angularCompilerOptions, then fix diagnostics against the types and Angular version your project actually uses.
What Angular template type checking does
Template type checking validates expressions and bindings at compile time. Angular reports template type errors during compilation, much like TypeScript reports errors in a .ts file. This catches incompatible values before they become runtime problems, but the amount of checking depends on the project’s template-checking mode and options.
As an Amazon Associate I earn from qualifying purchases.
Angular’s AOT compiler uses TypeScript to validate template bindings. The AOT compilation guide describes how template constructs can narrow types, while the template type checking guide explains the available modes and strictness controls.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
How to enable strict template checking
-
Open the TypeScript configuration used by the Angular application. Check the app-specific configuration and any configuration it extends; a value in a root file may be overridden in a more specific file.
#1 Best Overall
-
Under
angularCompilerOptions, setstrictTemplatestotrue:{ "angularCompilerOptions": { "strictTemplates": true } } -
Run the project’s normal Angular build or compilation command and address the reported template diagnostics. For editor feedback while you work, use the Angular Language Service.
The current Angular compiler-options reference lists strictTemplates as defaulting to true. Do not infer the effective setting from that default alone: older Angular versions, inherited configuration, and explicit overrides can change what your project checks.
Rank #2
What strictTemplates checks that basic mode does not
Angular calls the mode with strictTemplates: false basic mode. It checks top-level expression properties, but leaves important parts of the template less constrained. Strict mode improves type information and coverage across embedded views and bindings.
| Area | Basic mode | Strict mode |
|---|---|---|
| Embedded views, such as those created by structural directives | Not checked | Checked |
| Component or directive input assignability | Does not verify that the final expression can be assigned to the input | Verifies input assignability |
| Nullability on inputs | Does not provide strict null checking for input bindings | Follows TypeScript’s strictNullChecks through strictNullInputTypes |
| Pipes and local references | Does not infer several pipe-result and local-reference types | Infers pipe and local-reference types |
| Events and generic types | Does not infer several event types or component and directive generics | Infers event types, generics, and template contexts |
Because strict mode preserves more type information, it can reveal problems that basic mode did not report. That does not automatically mean the diagnostic is a false alarm: check the expression, the receiving input’s declared type, and the data supplied to the component.
How to diagnose a template type error
Read the expression and expected type together
For an input error, compare the value in the parent template with the input type declared by the child component or directive. A nullable value, for example, cannot safely be passed to an input that accepts only a non-null value unless the template or component design guarantees that value is present.
Rank #3
Make nullability explicit where the value is used
If a value is available only under a condition, express that condition in the template so Angular can narrow the type in the relevant view. Angular documents this behavior for NgIf. For newer built-in control flow, use syntax supported by the project’s Angular version and confirm that the condition establishes the needed type narrowing.
For example, a nullable user can be guarded before its properties are accessed:
<div *ngIf="user">
{{ user.name }}
</div>
Check library declarations and event assumptions
A diagnostic can expose a mismatch in a library declaration as well as in application code. Angular notes that incomplete typings, or declarations that are not strict about nullability, can cause false positives. DOM event types also deserve care: $event.target may be broad because an event can bubble from a descendant, so it may not have the specific element type your code assumes.
Rank #4
Use an escape hatch only for a real invariant
Prefer correcting the type or making the relevant condition visible to the template checker. If the value is known to be present for a reason the type system cannot express, use a narrow workaround and make sure it reflects reality at runtime.
$any(expression)casts one expression toany, removing type checking for that expression.strictNullInputTypes: falserelaxes null checks for input bindings across the application.strictTemplates: falseturns off strict template checking broadly and loses the additional coverage described above.- A non-null assertion suppresses a nullability incompatibility. Use it only when the value is genuinely guaranteed to be present.
Angular also documents focused flags for input types, attribute types, safe-navigation types, DOM local-reference types, output and DOM event types, context generics, and literal types. For example, strictInputTypes controls input type checking, while strictDomEventTypes controls checking of DOM event types. Change only the option corresponding to the specific limitation rather than disabling strict checking as a first response.
What NG8107 means
Extended diagnostics are emitted when strictTemplates is enabled. NG8107: Optional chain not nullable warns when optional chaining is used on a receiver whose type excludes both null and undefined. In that case, the chain has no effect and may signal that the declared type does not match how the template treats the value. Check whether the type should allow null or whether the optional chain is unnecessary.
Angular safe-navigation behavior depends on version
Confirm your Angular version before drawing conclusions from a template expression that uses optional chaining. The current expression syntax guide says that, since Angular 22, template optional chaining returns undefined when its left side is null or undefined, matching standard JavaScript semantics. During migration, Angular added $safeNavigationMigration to existing expressions to preserve legacy behavior that returned null. Angular describes that migration aid as temporary and recommends avoiding reliance on the distinction between null and undefined.
Get template diagnostics in the editor
The Angular Language Service provides template completions, diagnostics, quick info, and navigation for inline and external templates. Angular recommends using it with strict template checking for earlier feedback as you edit. See the Angular Language Service guide for its capabilities and setup information.
If a diagnostic remains after checking the types, version, and documented options, Angular notes that the template checker itself may have a bug. In that case, report the issue with a small reproducible example rather than making basic mode the default workaround.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




