7.9 Property comments

Property types must be documented. The description may be omitted for privateproperties, if name and type provide enough documentation for understanding thecode.

Publicly exported constants are commented the same way as properties.

  1. /** My class. */
  2. class MyClass {
  3. /** @param {string=} someString */
  4. constructor(someString = 'default string') {
  5. /** @private @const {string} */
  6. this.someString_ = someString;
  7. /** @private @const {!OtherType} */
  8. this.someOtherThing_ = functionThatReturnsAThing();
  9. /**
  10. * Maximum number of things per pane.
  11. * @type {number}
  12. */
  13. this.someProperty = 4;
  14. }
  15. }
  16. /**
  17. * The number of times we'll try before giving up.
  18. * @const {number}
  19. */
  20. MyClass.RETRY_COUNT = 33;