How to use JSDoc to document an ES6 class property

Move the JSDoc for someProperty into the constructor where it is first defined:

/**
 * SomeClass is an example class for my question.
 * @class
 * @constructor
 * @public
 */
class SomeClass {
    constructor () {
        /**
         * someProperty is an example property that is set to `true`
         * @type {boolean}
         * @public
         */
        this.someProperty = true
    }
}

I’m unsure if there is a way of accomplishing it with the documentation package using an approach that doesn’t involve inlining the JSDocs into the constructor.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)