Categories
TypeScript Answers

How to transpile TypeScript to ES6?

Spread the love

Sometimes, we want to transpile TypeScript to ES6.

In this article, we’ll look at how to transpile TypeScript to ES6.

How to transpile TypeScript to ES6?

To transpile TypeScript to ES6, we can set the compilerOptions.target option to 'es2015' in tsconfig.json.

For instance, we write

{
  "compilerOptions": {
    "target": "es2015"
  }
}

into tsconfig.json to make the TypeScript compiler build our code to ES6 JavaScript code.

Conclusion

To transpile TypeScript to ES6, we can set the compilerOptions.target option to 'es2015' in tsconfig.json.

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.