Как расширить параметр typedef в JSDOC?
Предполагая, что у вас есть следующий код внутри класса ES6 (документация):
/**
* @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){
}
Теперь я хотел бы документировать другую функцию, давайте назовем ееtest2
, Эта функция занимает точно то же самоеoptions
объект, но нуждается в другом свойствеparent
.
Как документировать это без документирования избыточных опций? Избыточный означает:
/**
* @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){
}