Search code examples
ecmascript-6jsdoc

How to document instance of a ES6 class with JSDoc


Defined a class as per How to document ECMA6 classes with JSDoc? :

/**
 * Class representing some action
 */
class someActionClass {}

Now how should I define its instance? Could it be as below:

/**
* <WHAT GOES HERE?>
*/
someAction = new someActionClass();

Solution

  • Variable type can be specified with @type tag:

    /**
     * @type {someActionClass}
     */
    var someAction = new someActionClass();