I want to restrict property declaration while creating a FromGroup. I have tried this way.
After that I have used this on FromGroup Generic type like this:
But in this case I am getting this error: Type 'number' is not assignable to type 'AbstractControl<any, any>'
Is it really possible to restrict FormGroup ?
Form type should be like this.
type FormType = {
id: FormControl<number | null>;
}
If you don't want to allow null values, then you can do this:
type FormType = {
id: FormControl<number>;
}
assetDeAllocationForm = new FormGroup<FormType>({
id: new FormControl(0, { nonNullable: true})
});