使JsDoc显示“自定义”返回的注释

问题描述

当前,JsDoc显示函数返回[bool,string[],discord.MessageAttachment[]], 但@returns仍然为空:

我以为我会在回信中得到评论,但我可能是错的。 在理想的世界中,我希望将这样的内容显示在屏幕上:

returns [ MessageHasReplay : Boolean             -- If the message contains a replay
          UrlArr           : String[]            -- All urls found inside the message
          AttachArr        : MessageAttachment[] -- All attachments found inside the message
        ]

我的代码

/**
 * @typedef {boolean} MsgHasReplay If the message contains a replay
 * @typedef {string[]} UrlArray All urls found inside message
 * @typedef {MessageAttachment[]} AttachArr All attachments found inside message
 * @typedef {[MsgHasReplay,UrlArray,AttachArr]} SpecialReturn
 */
/** @returns {SpecialReturn} */
export const getMsgAttachments = msg => {
  const urlArr = [];
  const msgAttachArr = [];
  for (let msgArr of msg.attachments) {
    const msgAttach = msgArr[1];
    urlArr.push(msgAttach.url);
    msgAttachArr.push(msgAttach);
  }

  return [
    includesAny(
      urlArr.reduce((acc,cur) => (acc += cur),''),['.SC2Replay']
    ),urlArr,msgAttachArr,];
};

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)