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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *