Skip to main content

@protected

Syntax

@protected

Overview

@protected marks a symbol as protected. Protected symbols are available to the class that defines them and any classes that extend it, but not to external consumers.

Example

class Animal {
/**
* @protected
* @type {string}
*/
_species = 'unknown';

/**
* @protected
* @returns {string}
*/
_describe() {
return `I am a ${this._species}`;
}
}

class Dog extends Animal {
constructor() {
super();
this._species = 'dog';
}
}

See also

Official reference: jsdoc.app/tags-protected