Skip to content

fix(compiler-cli): do not type check native controls with ControlValueAccessor#65469

Merged
kirjs merged 2 commits intoangular:mainfrom
crisbeto:signal-forms-type-checking-cva
Nov 24, 2025
Merged

fix(compiler-cli): do not type check native controls with ControlValueAccessor#65469
kirjs merged 2 commits intoangular:mainfrom
crisbeto:signal-forms-type-checking-cva

Conversation

@crisbeto
Copy link
Copy Markdown
Member

Currently when we detect a field binding on a native element, we treat it as a built-in native control. This might not be the case if it's a pre-existing ControlValueAccessor relying on the CVA interop.

These changes try to detect any CVA-like directive on the element and disable the additional type checking if there are any.

Fixes #65468.

Updates the directive analysis to track the public methods of the class.
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Nov 21, 2025
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Nov 21, 2025
@ngbot ngbot bot added this to the Backlog milestone Nov 21, 2025
node instanceof TmplAstElement &&
(node.name === 'input' || node.name === 'select' || node.name === 'textarea') &&
!allDirectiveMatches.some(getCustomFieldDirectiveType)
allDirectiveMatches.every((meta) => {
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 was debating between this and disabling the native control type checking if there are any directives (aside from Field) on the same element. I went with this approach, because the alternative seemed a bit aggressive.

@crisbeto crisbeto marked this pull request as ready for review November 21, 2025 10:08
…eAccessor

Currently when we detect a `field` binding on a native element, we treat it as a built-in native control. This might not be the case if it's a pre-existing `ControlValueAccessor` relying on the CVA interop.

These changes try to detect any CVA-like directive on the element and disable the additional type checking if there are any.

Fixes angular#65468.
@crisbeto crisbeto force-pushed the signal-forms-type-checking-cva branch from c6fa096 to b76d324 Compare November 21, 2025 17:49
Copy link
Copy Markdown
Contributor

@leonsenft leonsenft left a comment

Choose a reason for hiding this comment

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

Are CVAs always directives? I know they're generally provided via the NG_VALUE_ACCESSOR token, so is there an edge case where the provided accessor isn't actually a directive, and could we catch that in type checking or no?

@crisbeto
Copy link
Copy Markdown
Member Author

They're generally always directives so this should cover it. There are cases where it's provided by assigning to NgControl.valueAccessor instead of providing the CVA token, but that shouldn't be an issue here.

@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 Nov 21, 2025
@kirjs kirjs merged commit 6b8720d into angular:main Nov 24, 2025
20 checks passed
@kirjs
Copy link
Copy Markdown
Contributor

kirjs commented Nov 24, 2025

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

@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 Dec 25, 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 target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs-bug(datepicker): Usage with signal forms

4 participants