Skip to main content

@static

Syntax

@static

Overview

@static marks a symbol as a static member — it belongs to the parent itself, not to instances. Static members use . in their namepath: ClassName.staticMember.

Example

/** @class */
function MathUtils() {}

/**
* Returns the square of a number.
* @static
* @param {number} x
* @returns {number}
*/
MathUtils.square = function (x) {
return x * x;
};

The namepath for square is MathUtils.square.

ES2015 static methods (no @static needed)

class MathUtils {
/** @returns {number} */
static square(x) { return x * x; }
}

JSDoc recognises the static keyword automatically.

See also

Official reference: jsdoc.app/tags-static