Whenever I run the code below, I encounter an error message that states
Element implicitly have any type because the expression of type string can't be used to index type Chapter
. Can someone help me understand what this means?
The main goal of this code is to update a specific value using the key
from the callback:
let chaptersWithStrings = props.chapters;
chaptersWithStrings.forEach((chapter) => {
Object.entries(chapter).forEach(([key, value]) => {
if (typeof value === 'object') {
chapter[key] = JSON.stringify(value)
}
})
});
This is how the chapter interface looks like:
export interface Chapter {
id: string,
code: string,
number: number,
policies: Policy | string,
}
I would really appreciate any assistance provided.
Thank you.