@@ -75,24 +75,28 @@ export type ɵElement<T, N extends null> =
75
75
// through the distributive conditional type. This is the officially recommended solution:
76
76
// https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
77
77
//
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
+ //
78
82
// Identify FormControl container types.
79
83
[ T ] extends [ FormControl < infer U > ]
80
84
? FormControl < U >
81
85
: // Or FormControl containers that are optional in their parent group.
82
86
[ T ] extends [ FormControl < infer U > | undefined ]
83
87
? FormControl < 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 >
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 >
96
100
: // FormArray containers.
97
101
[ T ] extends [ FormArray < infer U > ]
98
102
? FormArray < U >
0 commit comments