7.7 Enum and typedef comments

All enums and typedefs must be documented with appropriate JSDoc tags(@typedef or @enum) on the preceding line. Public enums and typedefs mustalso have a description. Individual enum items may be documented with a JSDoccomment on the preceding line.

  1. /**
  2. * A useful type union, which is reused often.
  3. * @typedef {!Bandersnatch|!BandersnatchType}
  4. */
  5. let CoolUnionType;
  6. /**
  7. * Types of bandersnatches.
  8. * @enum {string}
  9. */
  10. const BandersnatchType = {
  11. /** This kind is really frumious. */
  12. FRUMIOUS: 'frumious',
  13. /** The less-frumious kind. */
  14. MANXOME: 'manxome',
  15. };

Typedefs are useful for defining short record types, or aliases for unions,complex functions, or generic types.Typedefs should be avoided for record types with many fields, since they do notallow documenting individual fields, nor using templates or recursivereferences.For large record types, prefer @record.