Trying to check if an array has some values and display it once in typescript
const items = products?.reduce((prev: any, current) => {
if (!current?.data()?.drinkName in prev) {
prev[current?.data()?.category] = [];
}
prev[current?.data()?.category].push(current?.data()?.category);
return prev;
}, {});
Error:
The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'.