Files
angular/packages/compiler
Matthieu Riegler 91b8391b3d fix(compiler-cli): validate unknown element tags even when matched by attribute directives
Previously, the template type checker assumed that if any directive
matched an element node, the element itself did not need DOM schema
validation because it was assumed to be either a component or a custom
element tag like <router-outlet>.

However, if an unknown custom element tag (such as <tn-uploader>) is
only matched by attribute directives (e.g. [formControl]), the tag name
remains unclaimed and is missing its corresponding component import.
In this case, the compiler failed to emit a SCHEMA_INVALID_ELEMENT
diagnostic.

This commit updates the element validation condition in the type checker
to verify the element tag name against the DOM schema unless the element
matches an Angular component or a directive whose selector explicitly
matches the tag name.

By default this check will be disabled to prevent a breaking change in v22.3.
You can enable it with `strictUnknownElementWithDirectives: true`.

In v23 `strictUnknownElementWithDirectives` will be enabled by default.

Related to #46351
2026-09-29 12:31:31 -07:00
..
2025-12-16 14:44:19 -08:00