I encountered an issue while using Typed Reactive Forms in Angular 14. I have defined a type that connects a model to a strict form group. The problem arises specifically when utilizing the Date or Blob type. Note: I am working with Angular 14.
Error: src/app/sumarios/submission-sumario/submission-sumario.component.ts:903:7 - error TS2740: Type 'FormControl<Date>' is missing the following properties from type 'FormGroup<ControlsOf<Date>>': controls, registerControl, addControl, removeControl, and 2 more.
903 dataCriacao: new FormControl(sumario.dataCriacao),
Source:
export type ControlsOf<T extends Record<any, any>> = {
[P in keyof T]?: T[P] extends Record<any, any>
? T[P] extends (infer U)[] ? (U extends Record<any, any> ? FormArray<FormGroup<ControlsOf<U>>> : FormArray<FormControl<U>>) : FormGroup<ControlsOf<T[P]>>
: FormControl<T[P]>
}
https://i.sstatic.net/DvCSG.png
Class:
https://i.sstatic.net/6kEwB.png
[EDIT]