Javascript JSDocs:函数返回函数->;如何正确声明返回的函数
我试图找出如何在JSDocs中正确声明返回函数。这是我当前的代码Javascript JSDocs:函数返回函数->;如何正确声明返回的函数,javascript,function,types,typedef,jsdoc,Javascript,Function,Types,Typedef,Jsdoc,我试图找出如何在JSDocs中正确声明返回函数。这是我当前的代码 /** * An assertation function. * @typedef {Function} Assertation * @param {boolean} condition - Condition of assertation * @param {string} source - Source of the error * @param {Object|string} msg - Message to sh
/**
* An assertation function.
* @typedef {Function} Assertation
* @param {boolean} condition - Condition of assertation
* @param {string} source - Source of the error
* @param {Object|string} msg - Message to show
* @param {string} [method] - Method on which errorHandler was invoked
*/
/**
* Creates an assertion by calling console[type].
* @param {string} [type=info] - Type of assertation
* @returns {Assertation}
*/
const createAssertation = (type = 'info') => (condition, source, msg, method) => {
if (condition && process.env.NODE_ENV !== 'production') {
console[type](createMessage(source, msg, method), msg);
}
};
您可以将
{Assertation}
替换为{(条件:boolean,来源:string,消息:{}}| string,方法?:string)=>void}
。虽然你不会有评论,但什么不起作用?你有错误吗?什么错误?此外,@typedef在jsdoc之后缺少声明。