So, let's say we have some code:

/** * Object implementation of the matrix. * * @class Table */ class Table { /** * Creates an instance of Table. * * @param {Array.<number[]>} matrix - Inital matrix * * @memberof Table */ constructor(matrix) { matrix.forEach((row, rowNum, matrix) => { this[rowNum] = []; matrix.forEach((value, colNum, row) => { this[rowNum][colNum] = new Cell(value); }) }) debugger } } /** * Object implementation of the matrix cell. * * @class Cell */ class Cell { /** * Creates an instance of Cell. * @param {number} value * * @memberof Cell */ constructor(value) { // Some code } } let table = new Table([ [0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 1, 1, 0] ]); console.log(table); 

If you call the constructor of the Table class, it returns an object with an arbitrary number of properties whose names are numbers from 0 to the dimension of the input matrix. The value of each such property will be an array of values ​​of type {Cell} .

How to explain this to the JSDoc interpreter?

Honestly, even there are no thoughts, which side to take.

  • one
    Yes, in fact, nothing. But it is possible in the class description to describe in words how the object fields are composed. - mymedia
  • Something like this was supposed to do, but suddenly a miracle would happen and someone would come up with a cunning trick. )) - Spomni
  • @Grundy, I have already considered a virtual comment - the method is good, but it does not completely solve the problem. The problem is that the number of properties is arbitrary. In fact, the question can be reformulated: how to describe an arbitrary number of the same type of properties, whose names are generated by some pattern. - Spomni

0