Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Targeting ES5 with TypeScript in IntelliJ IDEA 14

Tags:

I want to use getters and setters in Typescript. At the moment when I try this I get the following:

error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. 

How do I configure my compiler in IntelliJ 14? Are there any disadvantages to this? DOes this produce a different type of Javascript that will only work on certain browsers?

Thanks

like image 852
Roaders Avatar asked Dec 27 '14 20:12

Roaders


People also ask

Does TypeScript support ES5?

TypeScript allows converting most of the ES next features to ES3, ES5, ES6, ES2016, ES2017.

Can you use TypeScript in IntelliJ?

With IntelliJ IDEA, you can run and debug client-side TypeScript code and TypeScript code running in Node. js. Learn more from Running and debugging TypeScript.


1 Answers

To change the compiler options you need to go to the FileWatcher Dialogue.

Settings -> Tools -> File Watchers

Select TypeScript and hit the edit (pencil) button.

Add

--target es5 

to the arguments field

like image 145
Roaders Avatar answered Oct 05 '22 23:10

Roaders