Skip to content

Commit 1f45338

Browse files
committed
Revert "fix(forms): fix FormRecord type inference (#50750)" (#58315)
This reverts commit 18b6f33. PR Close #58315
1 parent 79d9be3 commit 1f45338

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

‎packages/forms/src/form_builder.ts‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,28 +75,24 @@ export type ɵElement<T, N extends null> =
7575
// through the distributive conditional type. This is the officially recommended solution:
7676
// https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
7777
//
78-
// Note: Because `FormRecord` implementation extends `FormGroup`, it must be checked BEFORE `FormGroup`
79-
// in the following clauses (otherwise it may incorrectly be inferred to `FormGroup`).
80-
//
81-
//
8278
// Identify FormControl container types.
8379
[T] extends [FormControl<infer U>]
8480
? FormControl<U>
8581
: // Or FormControl containers that are optional in their parent group.
8682
[T] extends [FormControl<infer U> | undefined]
8783
? FormControl<U>
88-
: // FormRecord containers.
89-
[T] extends [FormRecord<infer U>]
90-
? FormRecord<U>
91-
: // Optional FormRecord containers.
92-
[T] extends [FormRecord<infer U> | undefined]
93-
? FormRecord<U>
94-
: // FormGroup containers.
95-
[T] extends [FormGroup<infer U>]
96-
? FormGroup<U>
97-
: // Optional FormGroup containers.
98-
[T] extends [FormGroup<infer U> | undefined]
99-
? FormGroup<U>
84+
: // FormGroup containers.
85+
[T] extends [FormGroup<infer U>]
86+
? FormGroup<U>
87+
: // Optional FormGroup containers.
88+
[T] extends [FormGroup<infer U> | undefined]
89+
? FormGroup<U>
90+
: // FormRecord containers.
91+
[T] extends [FormRecord<infer U>]
92+
? FormRecord<U>
93+
: // Optional FormRecord containers.
94+
[T] extends [FormRecord<infer U> | undefined]
95+
? FormRecord<U>
10096
: // FormArray containers.
10197
[T] extends [FormArray<infer U>]
10298
? FormArray<U>

0 commit comments

Comments
 (0)