I got an error in my foreach with an array:
function setRowData({ json }: NewType): void {
// foreach key and value in json object
// fill into an object
// add object to array
let tableRows: { id: string; key: string; de: string; it: string; }[] = [];
Object.entries(json).forEach(([key, value]) => tableRows.push({
id: key, key: key, de: value, it: (typeof value === 'string' ? value : "")
}));
setTableData(tableRows);
}
The error occurs on the line with the following content: id: key, key: key, de: value, it: (typeof value === 'string' ? value : "")
Does anyone know why the value variable called value inside my array is undefined?
In addition I post a photo of it and where the error occurs:

This one is the description of the foreach, why is the second type in the array undefined?



NewTypedefinition look like?jsoninstead of{json}.NewTypehave a property calledjson?