I am trying to make tslint proper return type, and have something like this
get formControls(): any {
return this.form.controls;
}
It returns the error Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type.
In previous question FormControl type angular typescript I got answer to my question to make it like this
get formControls(): { [key: string]: AbstractControl } {
return this.form.controls;
}
It is now OK, but then I have problems with other functions inside component, because I have more get like this
get addressFormControls(): any {
return this.formControls.address.controls;
}
get addressFormGroup(): any {
return this.formControls.address;
}
Now I got another error Property 'controls' does not exist on type 'AbstractControl'
Here is my final code, can somebody help me to write 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;
}
Thanks in advance