JSDocs @Interface

I have a virtual interface (from the JSDocs site) defined as :

/**
* @interface SVGTool
* @property {string} SVGTool#name
* @property {string} SVGTool#type
* @method SVGTool#createShape
* @method SVGTool#renderShape
* @method SVGTool#updateShape
*/

 

Which I use elsewhere as:

/** @type SVGTool the current selected/active tool*/
var selectedTool = null;

When I control click on the above to go to the declaration I get a popup window showing 'multiple declarations'  one is a Property icon pointing at the SVGTool interface and the other is a Lambda icon pointing again at the same SVGTool interface definition.

Is there a way to get webstorm to recognise this as one single interface declaration? 

TIA
Rob

 

 

 

 

3 comments

You can try defining it in the way suggested in docs (http://usejsdoc.org/tags-interface.html):

 

/**
* @interface SVGTool
*/

/**
* @function
* @name SVGTool#createShape
*/
/**
* @function
* @name SVGTool#renderShape
*/
/**
* @function
* @name SVGTool#updateShape
*/
/**
* @name SVGTool#name
* @type {string}
*/


/** @type {SVGTool} the current selected/active tool*/
var selectedTool = null;
0

Tks for that although it does remove the duplicate declarations there is no autocomplete/intraspection.


i.e. I type selectedTool. and the help window pops with just generic methods and if I continue to type selectedTool.updateShape it has no clue there is such a method.

 

TIA

Rob

0

works fine for me using the syntax from my previous comment:

0

Please sign in to leave a comment.