I have this code that is returning an error that says :
Element implicitly has an 'any' type because index expression is not of type 'number'.ts(7015)
const communes: ICommune[] = _.filter(wilayasData, (commune) => commune.wilaya_code === wilaya.wilaya_code);
Object.keys(communes).forEach((key) => {
communes[key].commune = communes[key].commune_name_ascii;
communes[key].commune_ar = communes[key].commune_name;
communes[key].daira = communes[key].daira_name_ascii;
communes[key].daira_ar = communes[key].daira_name;
delete communes[key].commune_name_ascii;
delete communes[key].commune_name;
delete communes[key].daira_name_ascii;
delete communes[key].daira_name;
});
the ICommune is an interface that is formed as follows :
commune_name_ascii?: string;
commune_name?: string;
commune_ar?: string;
commune?: string;
daira?: string
daira_ar?: string
daira_name_ascii?: string;
daira_name?: string;
wilaya_code?: string;
wilaya_name_ascii?: string;
wilaya_name?: string;