How do I transpile TypeScript to ES6?
Yes.
You can target TypeScript compiler to ES6.
For example add this to your command line args:
--target es6
Yes, You can.
Either by adding --target es2015
, or by adding target
to Your tsconfig.json
:
{
"compilerOptions": {
"target": "es2015"
}
}
Supported options for target are:
- "ES3" (default)
- "ES5"
- "ES6"/"ES2015"
- "ES2016"
- "ES2017"
- "ESNext"
There are a lot of more config options. You can explore them here: Compiler options
Some options are only allowed in tsconfig.json
, and not through command-line switches.