Here are the data types I am currently utilizing:
export interface IHelpDeskTextData {
supportPaneltext: ContactHelpdeskContex[];
selected?: number | null;
brandOptions?: string[];
textPanel?: ITextPanel[];
}
export class ContactHelpdeskContex {
public brand: string;
public paragraphList: IParagraph[];
}
interface IParagraph {
rowList: string[];
}
export interface ITextPanel {
textContent: IParagraph[];
selected: boolean;
brand: string;
}
I have variables containing data of the following types:
public supportPaneltext: ContactHelpdeskContex[];
public textPanel: ITextPanel[] = [];
I attempted to create a new variable using the map function on the above variable:
public getLabel() {
if (!this.supportPaneltext) {
return;
}
this.textPanel = Object.values(this.supportPaneltext).map((item,i) => {
return {
brand: item[i].brand,
selected: false,
textContent: item[i].paragraphList
}}
)}
Unfortunately, I encountered an error when trying to use the index [i]:
Element implicitly has an 'any' type because expression of type 'number' can't be used to index type 'ContactHelpdeskContex'.
No index signature with a parameter of type 'number' was found on type 'ContactHelpdeskContex'.
What could be the cause of this issue, and how can it be resolved?