JSDoc refer to type in another module

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?

4 comments
Comment actions Permalink

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();

0
Comment actions Permalink

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.

0
Comment actions Permalink

There are no youtrack tickets related to @module and @exports support. Please feel free to create a ticket to let others upvote it:)

0

Please sign in to leave a comment.