Search code examples
javascripteclipsevalidationjshintjsdoc

JSDoc - how to check types for JavaScript in Eclipse?


I am applying JSDoc annotations:

/**
 * @param {number} millis
 * @param {function} callback
 * */
function sleep(millis, callback) {
    setTimeout(function() {
        callback();
    }, millis);
}

Then what tool would tell there is an error for line below?

sleep('aaa', 'sdsdsd');

Is JSHint aware of JSDoc type annotations? How to enable such support in Eclipse?


Solution

  • Disclaimer, I'm the author of tern.java.

    I suggest you that you install tern.java 1.0.0-SNAPSHOT. It provides the capability to validate your JavaScript files by using JSDoc annotations. Here a screenshot with the sample of this issue :

    enter image description here

    If you need improvement with JSDoc validation, please create issues here