Como estender um parâmetro typedef no JSDOC?
Supondo que você tenha o seguinte código dentro de uma classe ES6 (documentação):
/**
* @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){
}
Agora eu gostaria de documentar outra função, vamos chamá-latest2
. Esta função tem exatamente a mesmaoptions
objeto, mas precisa de outra propriedadeparent
.
Como documentar isso sem documentar opções 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){
}