Jsdoc: ES6 getter or setter, how to define them?

Created on 1 Apr 2015  路  1Comment  路  Source: jsdoc/jsdoc

class Config {

 /**
  * @memberof Config
   * @public
   * @member {String} name
   */
 static get name() {}

 /**
  * @memberof Config
   * @public
   * @member {String} name
   */
  get name() {return this._name;}

 /**
  * @memberof Config
   * @public
   * @param {string} name
   */
  set name(name) {this._name = name;}
}

Is it right?

I have not find differents between static getter and getter.

Most helpful comment

You should only document one of the getters/setters, or the same member will show up multiple times in your docs. Here's the correct way to do it:

/** Config class. */
class Config {

    /**
     * @type {string}
     */
    static get name() {}

    get name() {return this._name;}

    set name(name) {this._name = name;}
}

If you comment the static getter, the docs will show that the member is static.

(In the future, please send questions to the jsdoc-users mailing list. The issue tracker is for bug reports and feature requests. Thanks!)

>All comments

You should only document one of the getters/setters, or the same member will show up multiple times in your docs. Here's the correct way to do it:

/** Config class. */
class Config {

    /**
     * @type {string}
     */
    static get name() {}

    get name() {return this._name;}

    set name(name) {this._name = name;}
}

If you comment the static getter, the docs will show that the member is static.

(In the future, please send questions to the jsdoc-users mailing list. The issue tracker is for bug reports and feature requests. Thanks!)

Was this page helpful?
0 / 5 - 0 ratings