Skip to main content

@exports

Syntax​

@exports name

Overview​

@exports identifies which symbol represents the module's exported API. Use it inside CommonJS modules when the exported value is defined inline and JSDoc cannot determine what is being exported.

Examples​

CommonJS named export​

/**
* @exports mathUtils
*/
var mathUtils = module.exports = {
/**
* @param {number} a
* @param {number} b
* @returns {number}
*/
add(a, b) { return a + b; },
};

AMD module​

define(function () {
/**
* @exports colorUtils
*/
var colorUtils = {
/** @returns {string} */
toHex(r, g, b) {
return `#${[r, g, b].map(v => v.toString(16).padStart(2, '0')).join('')}`;
},
};

return colorUtils;
});

See also​