1

My function accepts an array (rows) of array (columns) containing data (cell value), e.g.

table([
    ['A0', 'B0', 'C0'],
    ['A1', 'B1', 'C1'],
    ['A2', 'B2', 'C2'],
]);

How to describe the parameter value of the table function?

/**
 * @typedef column
 */

/**
 * @param {column[]} rows
 */
table = (rows) => {};

I cannot find documentation how to describe that column @typedef is an array of string values.

Gajus
  • 69,002
  • 70
  • 275
  • 438

1 Answers1

2

I misread the @typedef documentation. @typdef syntax allows defining type in addition to the namepath:

@typedef [<type>] <namepath>

Therefore, my example would read:

/**
 * @typedef {String[]} column
 */

/**
 * @param {column[]} rows
 */
table = (rows) => {};
Gajus
  • 69,002
  • 70
  • 275
  • 438