Skip to content

feat(compiler-cli): enable type checking of host bindings by default#63654

Closed
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:enable-host-bindings-typecheck
Closed

feat(compiler-cli): enable type checking of host bindings by default#63654
crisbeto wants to merge 1 commit into
angular:mainfrom
crisbeto:enable-host-bindings-typecheck

Conversation

@crisbeto

@crisbeto crisbeto commented Sep 9, 2025

Copy link
Copy Markdown
Member

Type checking of host bindings was added in v20. We're now confident enough in it to enable it by default.

BREAKING CHANGE:

  • Previously hidden type issues in host bindings may show up in your builds. Either resolve the type issues or set "typeCheckHostBindings": false in the angularCompilerOptions section of your tsconfig.

@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release labels Sep 9, 2025
@angular-robot angular-robot Bot added detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit area: compiler Issues related to `ngc`, Angular's template compiler labels Sep 9, 2025
@ngbot ngbot Bot added this to the Backlog milestone Sep 9, 2025
@crisbeto crisbeto force-pushed the enable-host-bindings-typecheck branch from 9ff2889 to bedfa77 Compare September 9, 2025 07:28
Type checking of host bindings was added in v20. We're now confident enough in it to enable it by default.

BREAKING CHANGE:
* Previously hidden type issues in host bindings may show up in your builds. Either resolve the type issues or set `"typeCheckHostBindings": false` in the `angularCompilerOptions` section of your tsconfig.
@crisbeto crisbeto force-pushed the enable-host-bindings-typecheck branch from bedfa77 to 1538467 Compare September 9, 2025 07:37
@crisbeto

crisbeto commented Sep 9, 2025

Copy link
Copy Markdown
Member Author

Passing TGP

hostVars: 5,
hostBindings: function FooCmp_HostBindings(rf, ctx) {
if (rf & 2) {
i0.ɵɵdomProperty("src", ctx.srcProp)("href", ctx.hrefProp)("title", ctx.titleProp);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this may indicate a pre-existing bug. Note how it didn't have a sanitizer before, but after the change it does. Will investigate it further in a follow-up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I revisited this and I think there's no bug after all. We decide whether to generate the sanitizer based on the tag name in the component's selector.

@crisbeto crisbeto requested a review from atscott September 9, 2025 13:56
@crisbeto crisbeto marked this pull request as ready for review September 9, 2025 13:56
@pullapprove pullapprove Bot requested a review from josephperrott September 9, 2025 13:56

@josephperrott josephperrott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto removed the request for review from atscott September 9, 2025 16:17
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 9, 2025
@atscott

atscott commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@atscott atscott closed this in 0571b33 Sep 9, 2025
crisbeto added a commit to crisbeto/angular-cli that referenced this pull request Sep 10, 2025
As of angular/angular#63654 type checking of host bindings is enabled by default so we don't need the explicit flag anymore.
alan-agius4 pushed a commit to angular/angular-cli that referenced this pull request Sep 10, 2025
As of angular/angular#63654 type checking of host bindings is enabled by default so we don't need the explicit flag anymore.
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Oct 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler detected: breaking change PR contains a commit with a breaking change detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants