diff --git a/projects/ngx-sub-form/src/lib/helpers.ts b/projects/ngx-sub-form/src/lib/helpers.ts index d4e4f025..fc7026e3 100644 --- a/projects/ngx-sub-form/src/lib/helpers.ts +++ b/projects/ngx-sub-form/src/lib/helpers.ts @@ -16,6 +16,7 @@ import { } from './ngx-sub-form.types'; import { ArrayPropertyKey, + Controls, ControlsNames, NewFormErrors, OneOfControlsTypes, @@ -122,7 +123,9 @@ export function createFormDataFromOptions; const defaultValues: FormInterface = cloneDeep(formGroup.value); - const formGroupKeys: (keyof FormInterface)[] = Object.keys(defaultValues) as (keyof FormInterface)[]; + const formGroupKeys: (keyof Controls)[] = Object.keys( + options.formControls, + ) as (keyof Controls)[]; const formControlNames: ControlsNames = formGroupKeys.reduce>( (acc, curr) => { acc[curr] = curr;