¿Cómo extender un parámetro typedef en JSDOC?
Suponiendo que tiene el siguiente código dentro de una clase ES6 (documentación):
/**
* @typedef Test~options
* @type {object.<string>}
* @property {array} elements - An array containing elements
* @property {number} length - The array length
*/
/**
* @param {Test~options} opt - Option object
*/
test(opt){
}
Ahora me gustaría documentar otra función, vamos a nombrarlatest2
. Esta función toma exactamente lo mismooptions
objeto, pero necesita otra propiedadparent
.
¿Cómo documentar esto sin documentar opciones redundantes? Redundante significa:
/**
* @typedef Test~options
* @type {object.<string>}
* @property {array} elements - An array containing elements
* @property {number} length - The array length
*/
/**
* @param {Test~options} opt - Option object
*/
test(opt){
}
/**
* @typedef Test~options2
* @type {object.<string>}
* @property {array} elements - An array containing elements
* @property {number} length - The array length
* @property {object} parent - The parent element
*/
/**
* @param {Test~options2} opt - Option object
*/
test2(opt){
}