【问题标题】:JSDoc - Identifier 'info' has already been declaredJSDoc - 标识符“信息”已被声明
【发布时间】:2021-01-29 07:39:59
【问题描述】:

在 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});
}

【问题讨论】:

    标签: node.js jsdoc jsdoc2md


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2019-10-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-28
      • 2021-03-28
      • 1970-01-01
      相关资源
      最近更新 更多