How to document deconstructed parameters using JsDoc

How do I document a function parameter that is deconstructed in function arguments?

/**
 * Function deconstructs argument and do stuff.
 * @param {} *** what should i do here? ***
 */
function someFunction({ key1, key2, key3 }) {
    // do function stuffs
}
+4
source share
1 answer

On the @param wiki page :

If a parameter is unstructured without an explicit name, you can give the object an appropriate one and document its properties.

Documentation of 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 department.
 */
Project.prototype.assign = function({ name, department }) {
    // ...
};
+6
source

Source: https://habr.com/ru/post/1684085/


All Articles