Search code examples
node.jstypescriptcompiler-optionsecma

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.


Solution

  • 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.