ES 2015 Classes
JSDoc 3 makes it easy to document classes that follow the ECMAScript 2015
specification. You don't need to use tags such as @class
and @constructor
with
ES 2015 classes—JSDoc automatically identifies classes and their constructors simply by parsing your
code. ES 2015 classes are supported in JSDoc 3.4.0 and later.
Documenting a simple class
The following example shows how to document a simple class with a constructor, two instance methods, and one static method:
You can also document classes that are defined in a class expression, which assigns the class to a variable or constant:
Extending classes
When you use the extends
keyword to extend an existing class, you also need to tell JSDoc which
class you're extending. You do this with the @augments
(or @extends
) tag.
For example, to extend the Point
class shown above: