如何使用JsDoc记录解构参数

Pul*_*ara 7 javascript jsdoc ecmascript-6

如何记录在函数参数中解构的函数参数?

/**
 * Function deconstructs argument and do stuff.
 * @param {} *** what should i do here? ***
 */
function someFunction({ key1, key2, key3 }) {
    // do function stuffs
}
Run Code Online (Sandbox Code Playgroud)

Fel*_*ing 14

来自@param wiki页面:

如果在没有显式名称的情况下对参数进行了解构,则可以为对象提供适当的参数并记录其属性.

记录解构参数

/**
 * Assign the project to an employee.
 * @param {Object} employee - The employee who is responsible for the project.
 * @param {string} employee.name - The name of the employee.
 * @param {string} employee.department - The employee's department.
 */
Project.prototype.assign = function({ name, department }) {
    // ...
};
Run Code Online (Sandbox Code Playgroud)