How can I use closure type annotation with Aptana?

If I introduce the following JavaScript code in Aptana Studio 3, then I expect some errors, but will not show anything.

/** * @type {string} */ var abc = 23; abc.doesNotExists(); 

How to enable support for closing type annotation?

+6
source share
1 answer

Aptana currently only supports annotations, but not actual type checking either. To check the type, you must compile this code using the google close compiler. If you set the compiler to fully optimized mode, it will scream that abc is a string (since you put it in the annotation comment), but instead you set a numerical value. To be able to take this from the closure compiler command line and integrate it into aptana, you need a plugin, but as far as I know, the closure plugin for eclipse / aptana has not been updated in the last 1 or 2 years, as well as this function that you wanted would have not been implemented in the latest version of this plugin.

In other words, you either run the closure compiler separately, and check for warnings or errors in certain files, OR you fork the repository of the eclipse closure plugin and implement this function yourself.

I had the same problem as you, but too much work forced me to choose the first solution (running the close compiler separately in the console). I even placed the hook, so every time I saved the file in this project, it would launch the compiler in the aptana console view so that I could check if I introduced new errors or warnings.

+1
source

All Articles