How to get @borrows tag working in JSDoc

允我心安 提交于 2019-12-05 11:52:43

The @borrows tag doesn't seem to work directly on a symbol, but only indirectly. For example I had:

/** does amazing things */
function origFunc = function() {};

/**
 * @borrows origFunc as exportedFunc
 */
exports.exportedFunc = origFunc;

but I, like you, got nothing useful in the generated doc.

That is because, it seems, that the @borrows tag operates on a container. (If you'll notice in the examples the @borrows tag is on the "util" module/namespace, not the renamed symbol.)

So this worked for me:

/** does amazing things */
function origFunc = function() {};

/**
 * @borrows origFunc as exportedFunc
 */
exports = {
  exportedFunc: origFunc,
}

Seems like a bug in @borrows though. (Or at least a bug in the documentation.)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!