微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

JSDoc - 标识符“信息”已被声明

如何解决JSDoc - 标识符“信息”已被声明

在 Javascript 中,我有两个名称相同但参数不同的函数代码工作正常,但当我尝试执行 jsdoc file.jsjsdoc2md file.js 时,我收到错误 Identifier 'info' has already been declared

对此有什么解决方案?

/**
 * Emits a log message with the added message. Level: 'info' (Same as log) 
 * @function
 * @param {String} message The message.
 */
async function info(message) {
  winstonLogger.log('info',message);
}

/**
 * Emits a log message with the added message and title. Level: 'info'
 * 
 * Example: Thu,19 Nov 2020 13:08:54 GMT | title | message |
 * @function
 * @param {String} message The message.
 * @param {String} title A title that will appear in the first seaction as an event definer.
 */
async function info(message,title) {
  winstonLogger.log('info',message,{title});
}

解决方法

虽然技术上有效,但这个 Javascript 应该被视为损坏,因为第二个 info 函数覆盖了第一个。这不是 jsdoc 或 jsdoc2md 的错误。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。