typescript - 有没有办法在 TypeScript 函数文档中引用参数?
问题描述
我试图在这样的函数描述中引用参数:
/**
* Deletes the Travel Cost with the given {@param id}
* @param id the id of the travel cost to be deleted
*/
deleteTravelCost(id: number): Observable<{}> { [...] }
但它似乎不适用于{@param id}
. 调用函数时的结果如下:
(method) TravelCostsService.deleteTravelCost(id: number): Observable<{}>
Deletes the Travel Cost with the given {@param id}
@param id — the id of the travel cost to be deleted
我希望在引用参数的文档中有一个可点击的元素(在函数的一般描述中,而不是在实际参数描述中)。是否有正确的方法来引用描述中的参数甚至函数的返回?(我正在使用 Visual Studio Code)。
解决方案
有没有办法正确引用参数
您不能交叉引用参数:https ://github.com/jsdoc/jsdoc/issues/1145#issue-126426000
返回描述中的函数
同样,您不能引用它。但是你可以用返回来记录它,例如:
/**
* Deletes the Travel Cost with the given
* @param id the id of the travel cost to be deleted
* @returns the result
*/
function deleteTravelCost(id: number): number {
return id;
}
推荐阅读
- java - 无法使用 RestTemplate 反序列化 HATEOS JSON
- python - 如何在python中比较2个列表值
- arduino-esp32 - knolleary/pubsubclient - 发布到一台服务器并监听另一台服务器
- python - 如何将“2021-06-25 15:00:08+00:00”等日期时间转换为本地时区 datetime.datetime python?
- python - 将 txt 读入 DataFrame,只有字段位置充当分隔符
- python - Django REST 框架中的 ManyToManyField 值
- django - 如何通过为异常创建单独的文件来处理 django rest 框架中的 MethodNotallowed 异常
- javascript - 为什么我的函数返回 false 而不是 true?
- sql-server - 单个 Case 语句中的多个条件
- python - 需要在每次迭代中循环两个连续列名的 pandas df 集,以在不同的 excel 表中创建单独的枢轴