Private identifiers are only available when targeting ECMAScript 2015 and higher (Angular 9)

Viewed 3029

I'm upgrading from Angular 8.2 to 9.1 and I'm trying to change private fields to be #fieldName: any as allowed by TS 3.8 instead of private fieldName: any. And I get the compiler error saying

Private identifiers are only available when targeting ECMAScript 2015 and higher.

tsconfig.json:

{
    "compilerOptions": {
        "module": "esnext"
        "target": "es2015",
    }
}

package.json:

"devDependencies": {
   "typescript": "3.8.3"
}
1 Answers

in the tsconfig.json you must replace the es2015 for the mostly recent version to suport this. Try replace the es2015 per es2017, I use es2017 is the best verion for this in my opinion

Related