gpt4 book ai didi

javascript - 如何使用 Js 文档记录柯里化(Currying)函数

转载 作者:行者123 更新时间:2023-12-05 02:48:31 26 4
gpt4 key购买 nike

我尝试使用 Js docs 生成我的项目的静态文档,但是当我尝试运行 js doc 命令时出现了很多解析错误,只发生在我有 curried 函数的地方,我的代码正常工作,错误是仅在 js 文档上,它是一个 lib 错误还是我做错了什么?

/**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 }

错误: enter image description here

最佳答案

我不认为你可以从接收它的函数中记录返回函数的参数。你必须像这样拆分文档:

/**
* @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;

关于javascript - 如何使用 Js 文档记录柯里化(Currying)函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64428661/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com