If you use Webpack or any Angular (2+) seed project, even angular-cli, all your TypeScript code will “compiled” to ECMAScript and you can choose the version (from 5 to 7).
Just open tsconfig.json. target will give a concrete version of ECMAScript you need.
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
]
Run build
and get your JavaScript file from the outDir directory.
1
solved translate typescript to javascript [closed]