I am getting the following error when compiling my Next.js app (with Typescript) with the "npm run build" command.
Type error: Type 'Set' can only be iterated through when using the '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
In my tsconfig.json file, I tried changing the target value from "es5" to "es6", "es2015", and "es2022". I still got the same error. I even tried adding the "downlevelIteration":true property, as suggested in the accepted answer from the thread below. However, I am still getting the same error.
What can I do to get rid of the error?