What is target in tsconfig.json for?

Ankit Raonka picture Ankit Raonka · Feb 23, 2017 · Viewed 42.8k times · Source

What does target in tsconfig.json signify?

{
  "compilerOptions": 
  {
    "sourceMap": true,
    "target": "es5",
    "module": "commonjs",
    "jsx": "react",
    "moduleResolution": "classic",
    "lib": [ "es2015", "dom",  "es2017" ]
  }
}

Answer

basarat picture basarat · Feb 24, 2017

I am quite new to Typescript. What does Target in tsconfig.json signify?

target signifies which target of JavaScript should be emitted from the given TypeScript. Examples:

target:es5

()=>null will become function(){return null} as ES5 doesn't have arrow functions.

target:es6

()=>null will become ()=>null as ES6 has arrow functions.