4
votes

Here is my tsconfig.json file:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es6",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}

When I changed lib and target version to es2020 it gives me below error:

tsconfig.json(13,15): error TS6046: Argument for '--target' option must be: 'es3', 'es5', 'es6', 'es2015', 'es2016', 'es2017', 'es2018', 'esnext'.

2
Did my answer fix your problem?JSON Derulo
Yes. Thanks for your helpSwanand
no problem, glad I could help :)JSON Derulo

2 Answers

11
votes

es2020 support was introduced in TypeScript 3.8.

You must upgrade to Angular 9.1 (or later) to use TypeScript 3.8.

1
votes

I don't think es2020 was added as a target until Angular 9. So if you're on a version lower than that, I could see it not working.

esnext targets the latest supported features, so that should work very similarly.