我需要用JSDoc记录一个ES6类,该类接收一个对象,该对象的属性将键名用作人员名称,因此键名几乎可以是任何字符串,而无需预定义。因此,对象的结构应如下所示:
{
"Name of person": {
"age": 31,
"hobby": "Tennis"
},
"Name of another person": {
"age": 29,
"hobby": "Running"
}
}
Run Code Online (Sandbox Code Playgroud)
因此,每个人的名字都是关键,但可以是任何东西,不是预先定义的。我要记录的示例:
class ExampleClass {
/**
* Creates an instance of ExampleClass
* @param {Object} peopleObj - Contains information about people.
* @param {String} peopleObj.name - The name of the person. <----- how should this be documented?
* @param {Number} peopleObj.name.age - The age of the person.
* @param {String} peopleObj.name.hobby - The hobby of the person.
* @memberof …Run Code Online (Sandbox Code Playgroud)