In JSDoc, how to actually document an object, not as a param?
example
let object1 = {
name: '' //string,
age: '' //number,
};
real example
/**
* 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,
};
};
this object doesn't belongs to any function is just an object inside a function but is not used as a param
Complex types can be aliased using a typedef
@documentation
/**
* @typedef PersonProperties
* @type {object}
* @property {string} name - Full Name of the Person.
* @property {number} age - Age of Person.
*/
Usage:
/** @type {PersonProperties} */
let object1 = {
name: '',
age: ''
};
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.