Currently using Webstorm in a project with Dojo (1.10), and ESRI API Javascript.
I have a function that accept a Widget (Object/Class), but the Webstorm show me some warnings because of JSDoc.
Code:
/**
* Init toolbar
*
* @param {Object} [options] - Toolbar options
* @param {string} [options.title=Default title] - Main title
* @param {ToolbarWidget} toolbarObj - Toolbar widget to set
*/
initToolbar: function(options, toolbarObj) {
...
toolbarObj.set('title', _title);
}
The first warning was on 'toolbarObj'. I get a message 'Unresolved variable or type'.
This was easy to resolve. Just included the following JSDoc:
/**
* A dojo widget (toolbar).
* @typedef {Object} ToolbarWidget
*/
Now, the another warning was the 'set' function of toolbarObj. I get a warning with the following message: 'unresolved function or method set()'.
Already tried @name, @function (maybe not in the correct way)!
I known this is optional (is just a warning), but, I like to document everything in the right way. So, how I can document the 'set' function of a anonymous object/dojo widget?!
What about
/**
* A dojo widget (toolbar).
* @typedef {Object} ToolbarWidget
* @property {function} set
*/