当不确定 JSdocs 时,@return 放什么

what to put @return when not sure JSdocs

你好,我有一个函数,它 return 是该函数内部函数的结果。所以我有点不确定要在我的 @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}`)
}

因为它 return 是 res.data(data) 的结果,您会在文档的 @return 中输入什么。

在这种情况下,通常我会 return {Object},或全部 {*},甚至是任何 {?}

https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System