I was wondering if anyone managed use complex interfaces to take advantage of the new typed FormControl and avoid boilerplate code on components.
I manage to export a 1-level-only interface with:
interface ISimple {
a: number; b: string; c: Date
}
export type AsFormControls<T> = {
[K in keyof T]: FormControl<T[K]>;
}
and then declaring my form in my component as
form: FormGroup<AsFormControls<ISimple>>;
Some of my simple forms were just plug and play, very useful, but when I have something like the following I can't figure out how to proceed, because I need the a FormGroup type for properties that contain properties.
interface INotSoSimple {
d: {
e: string;
f: Date;
}
}
Could there be a way to modify this interface for it to work with the new Form Controls? Any leads?