9

In an Angular application, is it safe to set the tsconfig.json compilerOptions.target to "es6" (or the equivalent "es2015") if you don't care about old browsers?

About this matter, in the official Angular documentation is written:

By default, the target is es5, you can configure the target to es6 if you only want to deploy the application to es6 compatible browser. But if you configure the target to es6 in some old browser such as IE, Syntax Error will be thrown.

So assuming that I do want to deploy my application only to es6 compatible browsers ONLY, should I just set the compile target to es6

Are there any other concerns I should be aware of?

For example, some Angular third-part libraries start not working and throw the notorious error:

TypeError: Class constructors cannot be invoked without 'new'

is it correct to assume that in these cases there is a bug in such third-part library?

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252

1 Answers1

3

Yes, Definitely you can use es6 in your tsconfig.json Currently I am using esnext for my application from past 10 months as I am targeting only google chrome, I didn't find any issues arising because of that

Thanks! Happy Coding

yaswanthkoneri
  • 408
  • 4
  • 16