My code is just warning fine, but I'm facing an Error type from Ts while accessing an element in the object using string.
useEffect(() => { const categoriesResult: CategoryResult[] = Object.values( questions?.reduce((r, e) => { const k = e.category.id; if (!r[k as keyof object]) return r[k].totalCount += 1; }, {}) ); setCategories(categoriesResult); }, [questions]);
The error is in r[k] to be more specific.
Thanks