Skip to content

feat(compiler-cli): enable dom binding type checking by default#54098

Closed
devversion wants to merge 9 commits intoangular:mainfrom
devversion:enable-dom-type-checking
Closed

feat(compiler-cli): enable dom binding type checking by default#54098
devversion wants to merge 9 commits intoangular:mainfrom
devversion:enable-dom-type-checking

Conversation

@devversion
Copy link
Member

@devversion devversion commented Jan 26, 2024

Currently Angular only validates that elements are existing as per our runtime DOM schema.
Additionally, we validate that non-directive input bindings are valid according to the schema.

We never validate whether the value of the expression is compatible with the targeted
DOM property. This commit ensures this is happening by default with strictTemplates enabled.

The reason why this came up more prominently at this point:

  • Users will adopt signal inputs and might forget invoking the signal, while Angular will never complain that e.g. [id]="bla" should actually be [id]="bla()" due to unsatisfied type assignability.

There is old context on why we did not enable this by default in the past: #32171.
It's worth seeing if that is still the case, or at least working towards flipping this default.

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Jan 26, 2024
@devversion devversion force-pushed the enable-dom-type-checking branch from ea9eb29 to 4e7b40e Compare January 26, 2024 16:08
Currently Angular only validates that elements are existing as per our
runtime DOM schema. Additionally, we validate that non-directive input
bindings are valid according to the schema.

We **never** validate whether the value of the expression is compatible
with the targeted DOM property. This commit ensures this is happening
by default with `strictTemplates` enabled.

The reason why this came up more prominently at this point:

- Users will adopt signal inputs and might forget invoking the signal,
  while Angular will never complain that e.g. `[id]="bla"` should
  actually be `[id]="bla()"` due to unsatisfied type assignability.

There is old context on why we did not enable this by default in the
past: angular#32171. It's worth seeing
if that is still the case, or at least working towards flipping this
default.
@devversion devversion force-pushed the enable-dom-type-checking branch from 4e7b40e to 71e6939 Compare January 29, 2024 15:35
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strictly-typed option value for typed select, radio and checkbox inputs

1 participant