I’ve been working on adjusting tslint for the proper return type, and here’s what I have so far:
get formControls(): any {
return this.form.controls;
}
However, I encountered an error stating Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
In a previous inquiry on FormControl type angular typescript, I received guidance to modify it as follows:
get formControls(): { [key: string]: AbstractControl } {
return this.form.controls;
}
This adjustment resolved the issue in that specific case, but now I’m facing difficulties with other functions within the component due to similar declarations like these:
get addressFormControls(): any {
return this.formControls.address.controls;
}
get addressFormGroup(): any {
return this.formControls.address;
}
As a result, I’m encountering another error – Property 'controls' does not exist on type 'AbstractControl'
Below is my revised code snippet. Would appreciate any assistance in defining the proper return type:
get formControls(): { [key: string]: AbstractControl } {
return this.form.controls;
}
get addressFormControls(): any {
return this.formControls.address.controls;
}
get addressFormGroup(): any {
return this.formControls.address;
}
Thank you in advance for any help provided.