Skip to main content

@property

Syntax

@property {type} name - description
@property {type} [name] - optional property
@property {type} [name=default] - optional with default

Overview

@property documents a named property of an Object parameter, a @typedef, or a @namespace. It follows the same syntax as @param.

Examples

Properties of a typedef

/**
* @typedef {Object} User
* @property {number} id - Unique identifier.
* @property {string} name - Display name.
* @property {string} [email] - Email address (optional).
*/

Properties of a namespace

/**
* Application configuration constants.
* @namespace config
* @property {string} config.apiUrl - Base URL for API requests.
* @property {number} config.timeout - Request timeout in milliseconds.
*/
const config = {
apiUrl: 'https://api.example.com',
timeout: 5000,
};

Nested properties

Use dot notation to document nested object properties:

/**
* @typedef {Object} Response
* @property {Object} data - The response payload.
* @property {number} data.status - HTTP status code.
* @property {string} data.message - Human-readable message.
* @property {Object[]} data.results - Result array.
*/

See also

Official reference: jsdoc.app/tags-property