UPDATE: @spenibus helped me reach the conclusion that this may be an issue with JSDoc itself. I added my findings to this open issue on their GitHub. @spenibus found a solution, but it requires a slightly altered version of the IIFE
I'm using an IIFE in a CommonJS module to be able to work with CommonJS and fallback to assigning the interface to the window object if it module.exports doesn't exist. How do I properly document this so that the passed in exports object is treated as module.exports?
/**
* This is a description
* @module someModule
*/
(function (exports) {
/**
* Returns true if something.
* @param {String} type
* @returns {boolean}
* @static
*/
var isSomething = function isSomething(type){
return true;
};
exports.isSomething = isSomething;
})(
//if exports exists, this is a node.js environment so attach public interface to the `exports` object
//otherwise, fallback to attaching public interface to the `window` object
(typeof exports === 'undefined') ?
window
: exports
);