如何解决使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 举报,一经查实,本站将立刻删除。