你好,我有一个函数,它返回函数内部函数的结果。所以我不知道该把什么放在我的@return
里。我要进入JSdocs,这是一个我偶然发现的问题。
下面是代码:
/**
* @param {string} id
* @param {Array} data
* @returns ??
* @description Takes in an ID to find the processor it needs and the data it needs to pass to the processor.
*/
processData(id, data) {
let res = Object.values(methods).find(entry => entry.id === id).dataProcessor;
if (res !== undefined) return res(data);
console.error(`There is no method that belongs to id:${id}`)
}
由于它返回res.data(data)
的结果,所以您会在文档中的@返回中放入什么内容。
发布于 2019-11-15 08:59:31
通常,在这种情况下,我会返回一个{Object}
,或一个ALL {*}
,甚至一个ANY {?}
。
https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System
https://stackoverflow.com/questions/58834240
复制相似问题