I am currently using JSDoc to attempt to document the following code...
class Test {
/**
* @param {Object} raw The raw data.
*/
constructor(raw) {
/**
* Used for things and stuff. It can be useful when referencing Test.myObject.myValue.
* @type {Object}
*/
this.myObject = {
/**
* This is my string... It does things. Very useful.
* @type {String}
*/
myValue: raw.thisIsMyValue
}
}
}
But I am not entirely sure how to do it. The example above works in VSCode, but not when generating documentation. I've tried a typedef, but that didn't work as it made it a global typedef instead of being a part of the Test class prototype. How do I even do this?
I know how to define an "anonymous" object for a function, using @param, but I have no idea how to do it for a class prototype. I've been Googling for over an hour and a half now with no luck.
I figured it out
Example
class Test {
/**
* @param {Object} raw The raw data.
*/
constructor(raw) {
/**
* Used for things and stuff. It can be useful when referencing Test.myObject.myValue.
* @typedef MyObject
* @property {String} myValue This is my string... It does things. Very useful.
*/
this.myObject = {
myValue: raw.thisIsMyValue
}
}
}