Roman Mahotskyi
Roman Mahotskyi

Reputation: 6625

How to select target for a node version?

How to know which target version of ECMAScript I can use with no errors?

P.S. I want to use the most latest version that is supported by my node.js

tsconfig.json

"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */

package.json

"typescript": "^3.8.3"

Terminal

$ node -v
v12.14.1

Upvotes: 1

Views: 3033

Answers (1)

jfriend00
jfriend00

Reputation: 707446

For node v12.14.1, you can safely select ES2019.

This will show you the details about support: https://node.green/ If you scroll down until you see Node.js ES2019 Support at the top left and look in the latest node v12.10 column, you should be good for ES2019.

You could also choose ES2020 except for just a couple features you could choose not to use, but select ES2019 if you want to be able to use those new features.

Upvotes: 2

Related Questions