← Back

jsdoc/implements-on-classes warning

Reports an issue with any non-constructor function using @implements.

Constructor functions, whether marked with @class, @constructs, or being an ES6 class constructor, will not be flagged.

To indicate that a function follows another function's signature, one might instead use @type to indicate the @function or @callback to which the function is adhering.

Examples

❌  Incorrect

/**
 * @implements {SomeClass}
 */
function quux () {

}
// Message: @implements used on a non-constructor function

✅  Correct

/**
 * @implements {SomeClass}
 * @class
 */
function quux1 () {

}

/**
 * @implements {SomeClass}
 * @constructor
 */
function quux2 () {

}

/**
 *
 */
class quux3 {
    /**
     * @implements {SomeClass}
     */
    constructor () {

    }
}

/**
 *
 */
const quux4 = class {
    /**
     * @implements {SomeClass}
     */
    constructor () {

    }
}

/**
 *
 */
function quux5 () {

}