Doc
Doc

Reputation: 11

JSDoc 3 namespace trouble

This code

/**
 * * My namespace
 *
 * @namespace
 *
 * @type {Object}
 */
myNamespace = {

};

/**
 * My constructor
 *
 * @constructor
 */
myNamespace.MyConstructor = function () {

};

/**
 * My static class function
 *
 */
myNamespace.MyConstructor.myStaticFunction = function () {

};

compiles and gives me a nice html file. However the myConstructor syntax will show up as new MyConstrutor() instead of the right new myNamespace.MyConstructor().

If I change the comment for MyConstructor to

/**
 * My constructor
 *
 * @constructor
 * @memberOf {myNamespace}
 */
myNamespace.MyConstructor = function () {

};

then I get the expected result of new myNamespace.MyConstructor(). However now the myNamespace.MyConstructor.myStaticFunction doesn't even show up in the documentation and no matter what permutation of tags I have tried in any of the 3 comments it will not generate the way I expect it to.

I have tried letting myStaticFunction be a member of either myNamespace or MyConstructor or myNamespace.MyConstructor - but it just won't show up in the docs anywhere.

I tried compiling with the old jsdoc-toolkit 2.4 and have no problems and don't even have to use any kind of memberOf notation. It's really late here so I'm hoping a fresh pair of eyes can help me out.

Upvotes: 1

Views: 490

Answers (1)

user2314737
user2314737

Reputation: 29407

I think it should be

* @memberOf myNamespace

(no curly brackets)

With JSDoc 3.3.0 @memberOf {myNamespace} gives an error.

Upvotes: 1

Related Questions