Skip to content

Commit

Permalink
feat: expose partial remap options when the form is not a remap form …
Browse files Browse the repository at this point in the history
…so that we can override some defaults
  • Loading branch information
maxime1992 committed Nov 21, 2021
1 parent a348cd4 commit 871a5e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions projects/ngx-sub-form/new/src/ngx-sub-form.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ export interface NgxSubFormRemapOptions<ControlInterface, FormInterface> {
fromFormGroup: (formValue: FormInterface) => ControlInterface;
}

type NgxSubFormRemap<ControlInterface, FormInterface> = AreTypesSimilar<ControlInterface, FormInterface> extends true
? {}
// if the 2 types are the same, instead of hiding the remap options
// we expose them as optional so that it's possible for example to
// override some defaults
type NgxSubFormRemap<ControlInterface, FormInterface> = AreTypesSimilar<ControlInterface, FormInterface> extends true // we expose them
? Partial<NgxSubFormRemapOptions<ControlInterface, FormInterface>>
: NgxSubFormRemapOptions<ControlInterface, FormInterface>;

type NgxSubFormArray<FormInterface> = ArrayPropertyKey<FormInterface> extends never
Expand Down

0 comments on commit 871a5e3

Please sign in to comment.