Type Definitions

Define and document custom types and interfaces

@typedef
Defines a custom type

Syntax:

@typedef {Object} TypeName

Example:

/**
 * @typedef {Object} User
 * @property {string} name
 * @property {number} age
 */
@property
Documents object properties

Syntax:

@property {type} name Description

Example:

/**
 * @property {string} email - User email address
 */
@enum
Documents enumeration values

Syntax:

@enum {type}

Example:

/**
 * @enum {string}
 */
const Status = {
  PENDING: "pending",
  COMPLETE: "complete"
}
@type
Specifies the type of a variable

Syntax:

@type {type}

Example:

/**
 * @type {string|number}
 */
let value;