TS2821

Import assertions are only supported when the --module option is set to esnext or nodenext.

Broken Code ❌

import accounts from './accounts.json' assert { type: 'json' };
 
console.log(accounts);
tsconfig.json
{
  "compilerOptions": {
    "module": "node16"
  }
}

Fixed Code ✔️

Make sure that "module" in your tsconfig.json is set to esnext or nodenext before using an import assertion.

tsconfig.json
{
  "compilerOptions": {
    "module": "nodenext"
  }
}