[英]JsDoc: How do I document an object only
在 JSDoc 中,如何实际记录 object,而不是作为参数?
例子
let object1 = {
name: '' //string,
age: '' //number,
};
真实的例子
/**
* Update User
* @param {Object} params
* @param {String} params.oldName
* @param {String} params.oldAge
*/
const onChangeUser = params => {
....
//I want to document this object
let object1 = {
// name: '', string,
// age: '' number,
};
};
这个 object 不属于任何 function 只是 object 在 ZC1C425268E68384D1AB5074 中使用,但不用作 paramC425268E68384D1AB5074
可以使用typedef
@documentation给复杂类型起别名
/**
* @typedef PersonProperties
* @type {object}
* @property {string} name - Full Name of the Person.
* @property {number} age - Age of Person.
*/
用法:
/** @type {PersonProperties} */
let object1 = {
name: '',
age: ''
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.