我正在尝试找出如何在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 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);
}
};