Hello. It seems like refering to a type from another module does not work using js doc. For instance:
| Module 1 |
|
/** @module module1 */
/** * Test me * @exports module:module1.Test1 * @constructor */ function Test1() {}
/** * My Function * @returns {number} */ Test1.prototype.myFunc = function() {return 12;}
|
| Module 2 |
/** @module module2 */ /** @type {module:module1.Test1|*} */ // Appears highlited in red in Webstorm with the error 'unresolved variable or type: Test1|' and 'Invalid syntax type' var b; |
Perhaps I am doing something wrong though?
Webstorm doesn't currently support @exports and @module JSDoc tags
However I'm not sure why you need them here... These tags are mainly used for documenting JS modules; to get the Test1 methods resolved, you can just use
/**
* @type {Test1}
*/
var b;
b.myFunc();
This was a simplified example. My actual usage is with an AMD module (ie: define([], /** @exports somethig */ function() {...}), and I was wondering why Webstorm was giving me an error when referring to a type in another module, whereas the built documentation was giving me the proper type referencing. But that clears it up I think. Are there any plans to support these, or any youtrack issues I can upvote?
Thanks,
Mathieu.
There are no youtrack tickets related to @module and @exports support. Please feel free to create a ticket to let others upvote it:)
Ups... I'm wrong. See http://youtrack.jetbrains.com/issue/WEB-674
See also https://gist.github.com/ulitink/9757354 for possible workaround