'Element implicitly has an 'any' type because expression of type 'string' can't be used to index type In Angular ForkJoin operator
I have used the angular forkJoin operator to call several service functions. The code is below:
private populateLists(): void {
forkJoin({
countries: this.countryService.getCountryLists(),
floorLists: this.variableService.getFloorLists(),
memberTypes: this.variableService.getMemberTypeLists(),
memberCategories: this.variableService.getMemberCategoryLists(),
businessTypes: this.variableService.getBusinessTypeLists(),
voterRelations: this.variableService.getVoterRelationLists(),
bloodGroups: this.variableService.getBloodGroupLists(),
designations: this.variableService.getDesignations()
}).subscribe(data => {
for (const [key, value] of Object.entries(data)) {
this[key] = value;
}
});
}
Now I am getting error in this line: this[key] = value. The error is:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'MemberDetailsComponent'. No index signature with a parameter of type 'string' was found on type 'MemberDetailsComponent'.ts(7053)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
