Skip to main content

@memberof

Syntax

@memberof ParentName
@memberof! ParentName

Overview

@memberof overrides JSDoc's automatic parent-detection. Use it when JSDoc would assign a symbol to the wrong parent, or when a symbol is defined outside the class/namespace it logically belongs to.

The ! variant (@memberof!) forces the symbol to be a direct member of the parent even if the parent is a function.

Examples

Override parent

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

/**
* @memberof MyClass
* @param {string} name
*/
function rename(name) {
this.name = name;
}

MyClass.prototype.rename = rename;

Namespace membership

/**
* Formats a date.
* @memberof utils
* @param {Date} date
* @returns {string}
*/
function formatDate(date) {
return date.toISOString();
}

See also

Official reference: jsdoc.app/tags-memberof