Document collection (array of type) return value and parameter in JSDoc

If you’re looking for how to document the type of objects in an array, you want something like this:

/**
 * @param {String[]} aliases
 */

Here inside curly-braces the String[] is the parameter type: type String as array [].

See also jsdoc-toolkit, archived wiki page about @Param tag, Parameter Type Information:

Parameter Type Information

Use curly-braces around the expected type of the parameter to document this information.

/** * @param {String} userName */ function logIn(userName) { // ... }

Use a pipe symbol to document that multiple types are permitted.

/** * @param {String|Number} product */

Use the [] notation after a type to indicate an array of those types.

/** * @param {String[]} aliases */

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)