Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

How to document array destructured parameter in JSDoc

$
0
0

Given the following code, how do I properly document that using the latest JSDoc?

function docMe([foo, bar = null, baz = 1]) { 
  /* */ 
}

I have tried this:

/**
 * @param {Array} options Array containing the options.
 * @param {HTMLElement} options[0].foo An HTML element.
 * @param {Object} [options[1].bar] An object.
 * @param {Number} [options[2].baz] A number.
 */

Obviously this didn't work, and all that the JSDoc documentation mentions is how to document a destructured object parameter, not a destructured array parameter.


Viewing all articles
Browse latest Browse all 138192

Trending Articles