@abstract
Syntax
@abstract
Overview
@abstract marks a method as abstract. An abstract method defines a signature but provides no (or only placeholder) implementation. Subclasses that extend the class are required to override the method.
Example
class Shape {
/**
* Calculate the area of the shape.
* @abstract
* @returns {number}
*/
area() {
throw new Error('Subclasses must implement area().');
}
}
class Circle extends Shape {
/** @param {number} radius */
constructor(radius) {
super();
this.radius = radius;
}
area() {
return Math.PI * this.radius ** 2;
}
}
See also
Official reference: jsdoc.app/tags-abstract