I'm trying to get all ids in Array, and then remove duplicates with React TypeScript.
Here is my code :
const uniqueMuscle = workoutexercices.map((exercice: any) => {
let exercicesId = exercice.id;
exercicesId = [...new Set(exercicesId)];
return exercicesId;
});
VSCode underlines [...new Set(exercicesId)];
in red and tells me :
Type 'Set<unknown>' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher
So I went to my ts.config
and I changed the value, but still the same error.
Here is my ts.config
:
{
"compilerOptions": {
"target": "es2015",
I "downlevelIteration": true
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
Any idea why I keep having this error ?