How can I iterate through a key-value pair array?
This is how I declare mine:
products!: {[key: string] : ProductDTO}[];
Here's my loop:
for (let product of this.products) {
category.products.push((product as ProductDTO).serialize());
}
However, I encounter this error:
Converting type '{ [key: string]: ProductDTO; }' to type 'ProductDTO' might be an error
I also attempted:
for (let product of Object.values(this.products))
But encountered the same issue.