Multiple Signature Document Designer

I would like to know how to define two signatures for a constructor using jsdoc:

makeClass("Person",
/** @lends Person */
{
    /**
        @constructs
        @param {int} p1
    */
    /**
        @constructs
        @param {string} p1
    */
    constructor: function () {

    },

    /**
        @name Person.prototype.func
        @function
        @param {object} arg arg desc
    */
    /**
        @name Person.prototype.func^2
        @function
        @param {int} arg arg desc
        @param {int} arg2 arg2 desc
    */
    func: function () {

    }
});

This creates a single constructor with {string} p1.

thanks for the help

+3
source share
2 answers

JSDoc has no concept comparable to multiple Visual Studio XML Doc signatures. One of the parameters is to document the parameters as having several possible types and noting some optional ones.

/**
 * @param {Number|Object} arg Description of arg
 * @param {Number} [arg2] Description of arg2
 */
+4
source

DocumentJS , the documentation tool used / created by JavascriptMVC, has released a new @signature annotation that allows you to annotate multiple signatures for the same method.

, source ( ) :

   /**
     * @signature `observe.attr()`
     * @return {Object<String, *>} an object with all the properties in this `can.Observe`.
     * 
     * @signature `observe.attr(key)`
     * @param {String} key the property to read
     * @return {*} the value assigned to _key_.
     *
     * @signature `observe.attr(key, value)`
     * @param {String} key the property to set
     * @param {*} the value to assign to _key_.
     * @return {can.Observe} this Observe, for chaining
     */
   attr: function( attr, val ) {
+3

All Articles