Search code examples
javascriptjsdocjsdoc3

Declare a CommonJs module as a mixin (JsDoc)


I have multiple standalone modules who're just mixins used by classes.

Basically, my syntax is exactly this:

/** @mixin actions/actions */

var actions = module.exports;

/**
 * Some method
 */
actions.foo = function () {};

The file is detected as a mixin, but no method is attached to it inside the API description.

I'm using JsDoc 3.3 and can't find why this isn't working.


Solution

  • I found a solution that work for me. Naming the @mixin was the issue as the symbol wasn't recognize on the page. What you need to do is @alias it if needed (or keep the variable name).

    /**
     * @mixin
     * @alias actions/actions
     */
    var actions = module.exports;