javascript - 如何使用 Js 文档记录 curried 函数
问题描述
我试图使用 Js docs 来生成我的项目的静态文档,但是当我尝试运行 js doc 命令时出现很多解析错误,仅发生在我有 curried 函数的地方,我的代码正常工作,错误仅在 js 上docs,它是一个库错误还是我做错了什么?
/**Responsible for fetch the data that will be loaded in the graph within the dialog
*
* @param {function} dispatch redux dispatch function
* @param {String} timeMode time mode used on metric page Example: 'Mensal'
* @param {String} dialogType type of the dialog used to request de correct data and render the body Example: 'WARN_NETWORK_DRIVE'
* @returns {(timeMode: String) => (dialogType: String) => Promise<void>}
*/
export const fetchGraphicData = dispatch => timeMode => async dialogType => {...function logic }
解决方案
我认为您不能从接收它的函数中记录返回函数的参数。您必须拆分文档,例如:
/**
* @param {String} dialogType type of the dialog used to request de correct data and render the body Example: 'WARN_NETWORK_DRIVE'
*/
const dialogFn = async dialogType => { };
/**
* @param {String} timeMode time mode used on metric page Example: 'Mensal'
*/
const timeModeFn = timeMode => dialogFn;
/**
* Responsible for fetch the data that will be loaded in the graph within the dialog
*
* @param {function} dispatch redux dispatch function
* @returns {timeModeFn} timeModeFn
*/
export const fetchGraphicData = dispatch => timeModeFn;
推荐阅读
- python - 将 2 个字典的值与不匹配的值进行比较
- html - Card content doesn't adjust to screen size at breakpoint
- python - python django中MEDIA_ROOT(媒体文件)和STATIC_ROOT(静态文件)的真正区别以及如何正确使用它们
- python - 函数在python中是如何工作的
- dialogflow-es - 使用 dialogflow-fulfillment 时如何设置会话实体
- ios - 是否可以使用 URL 方案(FaceTime 链接)启动 Group FaceTime 通话?
- integration - Qna maker 与 Power 虚拟代理集成时,在 power 虚拟代理中看不到后续提示
- asp.net - 用 ASP 比较两个主键(Access 数据库)
- sendgrid - 如何添加变量作为 Sendgrid 按钮的链接
- reactjs - 如何在 React 中从 Web API 获取响应代码