Accessors are only available when targeting ECMAScript 5 and higher
How to provide target to ES5 while using ts-loader ??
By using a tsconfig.json file.
You would want something like this:
{
"compilerOptions": {
"target": "es5"
}
"files": []
}
@jbrantly Thanks It works
Thank you. This is currently the highest google result for the error message.
For me, this migration guide for angular-cli is missing "target": "es5" in tsconfig.json
@jakeNiemiec you are right that the main (in root folder) tsconfig.json does not contain the "target": "es5", but cli have specific derived tsconfig.app.json and tsconfig.spec.json configs specified under src which both contained the target.
BTW I had to specify the "target": "es5" in the root to make it work in VSCode and remove the specific target lines from the derived once.
Thanks for the hint anyway.
Hi, I had same problem after updating angular-cli as jakeNiemiec. In my case I only needed to add the target line in tsconfig.json in the root folder and restart VSC.
If you are dealing with just a single file and not a project set --target ES2016. For eg
$ tsc --target ES2016 /filepath/filename.ts --watch
Very Helpful
nice :D
Thank you @SOHELAHMED7
if you input a file to tsc in command line it ignore the tsconfig.json and you need to insert a flag for each config you want( e.g --target ES2016) . but if you not input ant file in the command line and just add the file in the tsconfig.json tsc will read the config file stackoverflow ts docs
@SOHELAHMED7 Thank you :)
Thanks @SOHELAHMED7