implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index type: angular 14 migration : this[key]

Anil Kumar
Mar 23, 2023

Struck with error “implicitly has an ‘any’ type because expression of type ‘string’ can’t be used to index type”

convertToValue(key: string) {

return this.clientForm.value[key].map((x, i) => x && this[key][i]).filter(x => !!x);

}

then

I have changed to

convertToValue(key: string) {

return this.clientForm?.value[key].map((x:any, i:any) => x && this[key as keyof DentalLabSignupComponent ][i]).filter((x:any) => !!x);

}

--

--