假设您在ES6类(文档)中有以下代码:
假设你在 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){
}