7.6 Class comments
Classes, interfaces and records must be documented with a description and anytemplate parameters, implemented interfaces, visibility, or other appropriatetags. The class description should provide the reader with enough information toknow how and when to use the class, as well as any additional considerationsnecessary to correctly use the class. Textual descriptions may be omitted on theconstructor. @constructor
and @extends
annotations are not used with theclass
keyword unless the class is being used to declare an @interface
orit extends a generic class.
/**
* A fancier event target that does cool things.
* @implements {Iterable<string>}
*/
class MyFancyTarget extends EventTarget {
/**
* @param {string} arg1 An argument that makes this more interesting.
* @param {!Array<number>} arg2 List of numbers to be processed.
*/
constructor(arg1, arg2) {
// ...
}
};
/**
* Records are also helpful.
* @extends {Iterator<TYPE>}
* @record
* @template TYPE
*/
class Listable {
/** @return {TYPE} The next item in line to be returned. */
next() {}
}