如何使用 JsDoc 记录解构的参数
How to document deconstructed parameters with JsDoc
如何记录在函数参数中解构的函数参数?
/**
* Function deconstructs argument and do stuff.
* @param {} *** what should i do here? ***
*/
function someFunction({ key1, key2, key3 }) {
// do function stuffs
}
If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties.
Documenting a destructuring parameter
/**
* 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 }) {
// ...
};
如何记录在函数参数中解构的函数参数?
/**
* Function deconstructs argument and do stuff.
* @param {} *** what should i do here? ***
*/
function someFunction({ key1, key2, key3 }) {
// do function stuffs
}
If a parameter is destructured without an explicit name, you can give the object an appropriate one and document its properties.
Documenting a destructuring parameter
/** * 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 }) { // ... };