How to document an object within a class constructor?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
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.
javascript node.js jsdoc jsdoc3 documentationjs
add a comment |
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.
javascript node.js jsdoc jsdoc3 documentationjs
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23
add a comment |
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.
javascript node.js jsdoc jsdoc3 documentationjs
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.
javascript node.js jsdoc jsdoc3 documentationjs
javascript node.js jsdoc jsdoc3 documentationjs
edited Nov 26 '18 at 22:42
FireController1847
asked Nov 26 '18 at 22:25
FireController1847FireController1847
309112
309112
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23
add a comment |
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23
add a comment |
1 Answer
1
active
oldest
votes
I figured it out
- My debugging method wasn't helping, as the theme I was using for my documentation generator was hiding the properties.
- When making a typedef, you take out the type right before the object, and then it lists it as properties!
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
}
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490045%2fhow-to-document-an-object-within-a-class-constructor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I figured it out
- My debugging method wasn't helping, as the theme I was using for my documentation generator was hiding the properties.
- When making a typedef, you take out the type right before the object, and then it lists it as properties!
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
}
}
}
add a comment |
I figured it out
- My debugging method wasn't helping, as the theme I was using for my documentation generator was hiding the properties.
- When making a typedef, you take out the type right before the object, and then it lists it as properties!
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
}
}
}
add a comment |
I figured it out
- My debugging method wasn't helping, as the theme I was using for my documentation generator was hiding the properties.
- When making a typedef, you take out the type right before the object, and then it lists it as properties!
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
}
}
}
I figured it out
- My debugging method wasn't helping, as the theme I was using for my documentation generator was hiding the properties.
- When making a typedef, you take out the type right before the object, and then it lists it as properties!
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
}
}
}
answered Nov 26 '18 at 23:25
FireController1847FireController1847
309112
309112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53490045%2fhow-to-document-an-object-within-a-class-constructor%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did you look here? usejsdoc.org/howto-es2015-classes.html
– mjrcodin
Nov 26 '18 at 23:14
I did, and there doesn't seem to be anything related to this specific situation.
– FireController1847
Nov 26 '18 at 23:23