export type Compare = {
channelid: number,
childrenHash: Child[]
}
export type Child = {
id: number, hash: string
}
const comparsion = (data: Compare[]) => {
const res = data?.map((n: { childrenHash: any[] }) => {
const ids = Object.values(n.childrenHash.reduce((acc, m) => ((acc[m.hash] ??= []).push(m.id), acc), {})).filter((m:any) => m.length > 1);
return {
...n,
childrenHash: ids.length ? ids : null,
};
})
}
при использовании выдает ошибку
./src/pages/SettingSalesChannels/index.tsx 86:81
Module parse failed: Unexpected token (86:81)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
* ./node_modules/eslint-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| const comparsion = data => {
| const res = data === null || data === void 0 ? void 0 : data.map(n => {
> const ids = Object.values(n.childrenHash.reduce((acc, m) => ((acc[m.hash] ??= []).push(m.id), acc), {})).filter(m => m.length > 1);
| return { ...n,
| childrenHash: ids.length ? ids : null
Подскажите пожалуйста как решить. Спасибо