1

Let's say I'm running TypeScript Node.js project like this: tsc && node build/index.js (and tsc builds into build/ and I have index.ts in the project).

What values should I use in lib and target (tsconfig.json) to get the best possible experience, ie. access to newest features in my TypeScript code and output newest possible JavaScript code that still runs well on vanilla node without Babel or other transpilers.

I'm using a new version of Node (10.11.0 is the official current version now) but I'd appreciate a more general answer that is not specific to this version.

elnygren
  • 5,000
  • 4
  • 20
  • 31

1 Answers1

0

Looking at https://node.green it seems that Node 10.11.0 supports 99% of ES2015 and 100% of ES2016 and ES2017 so

    "target": "es2017",
    "lib": ["es2017"],
    "module": "commonjs",

would be a good starting point.

elnygren
  • 5,000
  • 4
  • 20
  • 31