Skip to content

jsdoc

case sensitive的问题:

https://github.com/jsdoc/jsdoc/issues/1046

enum:

// 法一:
/**
 * @param {('rect'|'circle'|'ellipse')} shapeType - The allowed type of the shape
 *

// 法二:
/**
 * @typedef {"keyvalue" | "bar" | "timeseries" | "pie" | "table"} MetricFormat
 */
/**
 * @param format {MetricFormat}
 */

Object:

法一:
/**
 * @param {{a: number, b: string, c}} myObj description
 */

法二:
/**
 * @param {Object} myObj description
 * @param {number} myObj.a description
 * @param {string} myObj.b description
 * @param {} myObj.c description
 */

法三:
/**
 * @typedef {Object} Person
 * @property {string} name how the person is called
 * @property {number} age how many years the person lived
 */

/**
 * @param {Person} p - Description of p
 */