How can I tell JSDoc about the structure of an object that is returned. I have found the @return {{field1: type, field2: type, ...}} description syntax and trie
A clean solution is to write a class and return that.
/**
* @class Point
* @type {Object}
* @property {number} x The X-coordinate.
* @property {number} y The Y-coordinate.
*/
function Point(x, y) {
return {
x: x,
y: y
};
}
/**
* @returns {Point} The location of the event.
*/
var getEventLocation = function(e, type) {
...
return new Point(x, y);
};