Pre Angular 12 this used to work:
export interface Content {
categories: string[]
concepts: Topic[]
formulas: Topic[]
guides: Topic[]
}
//this.content is of type Content
['formulas', 'concepts'].forEach(c => {
this.content[c].forEach(topic => {
//....
});
})
However now it produces the error (For the line this.content[c]):
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Content'. No index signature with a parameter of type 'string' was found on type 'Content'.ts(7053)
How do I tell Typescript that this.content[c] is an array of Topic instances?