@@ -177,6 +177,7 @@ export class FormGroup<TControl extends {[K in keyof TControl]: AbstractControl<
177177 controls : TControl , validatorOrOpts ?: ValidatorFn | ValidatorFn [ ] | AbstractControlOptions | null ,
178178 asyncValidator ?: AsyncValidatorFn | AsyncValidatorFn [ ] | null ) {
179179 super ( pickValidators ( validatorOrOpts ) , pickAsyncValidators ( asyncValidator , validatorOrOpts ) ) ;
180+ ( typeof ngDevMode === 'undefined' || ngDevMode ) && validateFormGroupControls ( controls ) ;
180181 this . controls = controls ;
181182 this . _initObservables ( ) ;
182183 this . _setUpdateStrategy ( validatorOrOpts ) ;
@@ -588,6 +589,21 @@ export class FormGroup<TControl extends {[K in keyof TControl]: AbstractControl<
588589 }
589590}
590591
592+ /**
593+ * Will validate that none of the controls has a key with a dot
594+ * Throws other wise
595+ */
596+ function validateFormGroupControls < TControl > (
597+ controls : { [ K in keyof TControl ] : AbstractControl < any , any > ; } ) {
598+ const invalidKeys = Object . keys ( controls ) . filter ( key => key . includes ( '.' ) ) ;
599+ if ( invalidKeys . length > 0 ) {
600+ // TODO: make this an error once there are no more uses in G3
601+ console . warn ( `FormGroup keys cannot include \`.\`, please replace the keys for: ${
602+ invalidKeys . join ( ',' ) } .`) ;
603+ }
604+ }
605+
606+
591607interface UntypedFormGroupCtor {
592608 new ( controls : { [ key : string ] : AbstractControl } ,
593609 validatorOrOpts ?: ValidatorFn | ValidatorFn [ ] | AbstractControlOptions | null ,
0 commit comments