ngneat / reactive-forms

(Angular Reactive) Forms with Benefits 😉
https://www.netbasal.com
611 stars 56 forks source link

fix(typings): correctly unpack values of nested form group arrays #180

Closed ntziolis closed 1 year ago

ntziolis commented 1 year ago

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

Minor fix for existing tying of ValuesOf for nested FormArray<FormGroup>.

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Assuming the following FormType:

export interface FormType {
  items: {
    tags: FormControl<string[]>
  }[]
}

When using ValuesOf<ControlsOf<FormType>> the tags has the type FormControl<string[]> instead of string[].

Issue Number: N/A

What is the new behavior?

The typing now correctly unpacks the values of FormGroup nested in FormArrays.

Does this PR introduce a breaking change?

[x] Yes
[ ] No

Users might encounter a breaking change if they have the above scenario AND rely on the current incorrect typing. Fixing resulting errors is likely low effort

Other information

stackblitz[bot] commented 1 year ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.