Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find the latest Typescript target support for any version of node?

Assuming any version of Node, how do I find the corresponding Typescript Compiler Option for target that gives most the functionality? I want to remove the guest work.

Specify ECMAScript target version: "ES3" (default), "ES5", "ES6"/"ES2015", "ES2016", "ES2017" or "ESNext".

I run different versions of node, and I want to know when is the minimum node version to enable the different TSC targets.

like image 202
NO WAR WITH RUSSIA Avatar asked Jan 02 '19 19:01

NO WAR WITH RUSSIA


People also ask

What version of typescript do I need for nodejs?

Ok so the answer is (As usual) Depends ! It depends on the features that you plan on using. The TypeScript version, target on the tsconfig.json and the NodeJS version. You have to look at this table, and look at your target environment column, in my case it's NodeJs column.

What is typescript's target configuration?

TypeScript's has a target configuration with many values, like esnext, es2015, es6 etc. (very confusing) NodeJs current version (11.11.0) supports many of the new features of JavaScript.

Should I use typescript or NuGet for Visual Studio?

For projects developed in Visual Studio 2019, we encourage you to use the TypeScript npm package for greater portability across different platforms and environments. For ASP.NET Core projects, it is recommended that you use the NuGet package instead. Add TypeScript support using npm The TypeScript npm package adds TypeScript support.

Which version of node is the best to target?

Based on Node-Target Mapping on the TypeScript wiki "es2018" is the right mapping for Node 10, "es2019" is the right mapping for Node 12. It seems that non-LTS versions of Node aren't documented, but given this information I feel like "es2018" is the safest target.


1 Answers

One method to accomplish this is to check out the site http://node.green. Find your version of node, and scroll down until the support for node features stops. So, for example, if you're using 10.3

ES2018 support

Then you can see that

  • 10.3.0 and later supports all of ES2018.
  • 9.11.2 and latter supports all of ES2017.
  • 7.5.0 and later supports all of ES2016.

ES2016 support is a bit more complex thanks to Array.Prototype.values which node.green doesn't register as being supported until 10.15.0.

like image 83
NO WAR WITH RUSSIA Avatar answered Oct 02 '22 20:10

NO WAR WITH RUSSIA