I've developed a solution for returning reactive forms as forms with available controls listed in IntelliSense. It works well for FormControls, but I'm now looking to extend this functionality to include FormGroups that are part of the queried parent FormGroup. Essentially, I want to return them as TypedFormGroup<T[key]>. Does that make sense? Is there a way I can achieve this type of assertion using something like
controls!: { [key in keyof T]: (AbstractControl & T[key] is string) | TypedFormGroup<T[key]>}
?
export class TypedFormGroup<T> extends FormGroup {
controls!: { [key in keyof T]: AbstractControl }
constructor(controls: { [key in keyof T]: AbstractControl }) {
super(controls);
}
}