javascript - jsdoc: How do I get instance method parameters to appear? -


i'm trying document old code jsdoc3, , i'm stuck trying include in documentation parameters instance methods - or show instance property @ all. suspect problem code not follow expected idiom faking classes in javascript, want documented before start rewriting anything. i've tried make small example of problem, structure of actual code:

/**  * global function  * @param  {object} v stuff they're trying avoid making global  * @return {object}   updated v  */ jsdoc_test = function( v ) {     /**      * stuff defined in namespace      * @namespace space      */     var space = {};     /**      * acts class      * @name space.someclass      * @memberof space      * @constructor      * @type {function}      * @param  {any}    y blah blah      * @return {object}   constructed object      */     space.someclass = function( w ) {         var obj = {             source:  w,        // might need again             derived: foo( w ), // need             etc:     "etc"     // , on         };         /**          * should member function, appears static property          * @name space.someclass.methoda          * @memberof space.someclass          * @type {function}          * @instance          * @param  {any}    x parameters not appear in documentation          * @return {object}            */         obj.methoda = function( x ) {             bar( x ); // or whatever methoda             return this;         }         /**          * should member function, doesn't show @          * @name space.someclass.methodb          * @memberof space.someclass#          * @type {function}          * @param  {any}    y parameters not appear in documentation          * @return {object}            */         obj.methodb = function( y ) {             baz( y ); // or whatever methodb             return this;         }         return obj;         /**          * should member function, doesn't show @          * @name space.someclass.methodc          * @memberof space.someclass.prototype          * @type {function}          * @param  {any}    z parameters not appear in documentation          * @return {object}            */         obj.methodc = function( z ) {             qux( z ); // or whatever methodc             return this;         }         return obj;     }     // ... } 

i want 3 methods appear in generated documentation instance methods. is, methoda appears static property, while methodb , methodc (which follow suggestions here) not appear @ all

how jsdoc3 document instance methods, parameters, without rewriting code?

looks you're using many tags on code. when use @constructor, shouldn't need @name or @type, since covered using constructor.

so, you've got 2 options, think.

use @constructor , remove redundant (conflicting) tags:

/**  * acts class  * @constructor space.someclass  * @memberof space  * @param  {any}    y blah blah  * @return {object}   constructed object  */ 

or, if don't want use @constructor tag, add appropriate hinting yourself:

/**  * acts class  * @name space.someclass  * @memberof space  * @kind class  * @param  {any}    y blah blah  * @return {object}   constructed object  */ 

in both cases, @type redundant since you're documenting class; type technically full name of function (i.e., @type {space.someclass}).