Skip to content

Conversation

@kirjs
Copy link
Contributor

@kirjs kirjs commented Nov 3, 2025

In this PR we're using the same types for both compat and regular forms

@ngbot ngbot bot added this to the Backlog milestone Nov 3, 2025
@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Nov 3, 2025
@kirjs kirjs force-pushed the forms-compat-2 branch 3 times, most recently from dea1fcb to 4f1c571 Compare November 3, 2025 16:05
@kirjs kirjs force-pushed the forms-compat-2 branch 7 times, most recently from 648aed0 to d543664 Compare November 3, 2025 19:48
@kirjs kirjs requested review from leonsenft and mmalerba and removed request for crisbeto and thePunderWoman November 3, 2025 19:50
@pullapprove pullapprove bot requested a review from thePunderWoman November 3, 2025 22:42
export type Subfields<TValue> = {
readonly [K in keyof TValue as TValue[K] extends Function ? never : K]: MaybeFieldTree<
TValue[K],
export type Subfields<TModel> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Remind me what was the distinction between TModel and TValue?

I thought TModel was to be used when the value might be either the field value or a AbstractControl? In this case, shouldn't this be TValue?

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you changed TValue to TModel elsewhere for consistency which seems right, but unless my mental model is incorrect, this should actually be TValue here because if we're dealing with subfields, we know it's not a compat field, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, looks like it becomes TValue here for a second, good catch

* An error used for compat errors.
*/
export class CompatValidationError<T = unknown> implements ValidationError {
readonly kind: string = 'reactive';
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense for the kind of error here to be reactive instead of compat? Since we use the term compat everywhere instead of reactive it might be more clear.

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved but unchanged. Do you disagree?

Copy link
Contributor

Choose a reason for hiding this comment

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

I vote for consistently using the term "compat". I don't like "reactive" because signals are reactive, and in the context of signal forms, that's the first thing I think of, not reactive forms. but whichever term we choose, we should be consistent about it

@kirjs kirjs force-pushed the forms-compat-2 branch 3 times, most recently from e6c2183 to 7686936 Compare November 4, 2025 22:34
@angular-robot angular-robot bot added the area: docs Related to the documentation label Nov 4, 2025
This allows using reactive form controls in signal forms
export type Subfields<TValue> = {
readonly [K in keyof TValue as TValue[K] extends Function ? never : K]: MaybeFieldTree<
TValue[K],
export type Subfields<TModel> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you changed TValue to TModel elsewhere for consistency which seems right, but unless my mental model is incorrect, this should actually be TValue here because if we're dealing with subfields, we know it's not a compat field, right?

* An error used for compat errors.
*/
export class CompatValidationError<T = unknown> implements ValidationError {
readonly kind: string = 'reactive';
Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved but unchanged. Do you disagree?

@kirjs kirjs requested a review from leonsenft November 4, 2025 23:57
@kirjs kirjs force-pushed the forms-compat-2 branch 2 times, most recently from 0538a83 to a8a42a7 Compare November 5, 2025 15:30
kirjs added 2 commits November 5, 2025 11:14
Now if a field contains form control, it'll unwrap its type correctly
This is more aligned with the way signal forms work, and spares user from having to deal with partial types.
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Deployed adev-preview for 73cf1c9 to: https://ng-dev-previews-fw--pr-angular-angular-64861-adev-prev-diq1qj7n.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adev: preview area: docs Related to the documentation area: forms detected: feature PR contains a feature commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants