title: trying to add jsdocs to dynamically generated functions
body: <p>I have a class that generates simple CRUD functions of a given table. I have the jsdoc documentation working the way I want it (mostly for autofill purposes) when I init it once. ie <code>const providerService = new CrudFunctions('provider')</code>. However I may be adding more tables in the future, and I'll be wanting to generate all the tables in a loop so I don't have to repeat a bunch of code. Here's what I have so far to generate all the functions so far:</p>
  <pre><code>const generateTableFunctions = (tableArray) =&gt; {
    const tableFunctions = {};
  
    tableArray.forEach((table) =&gt; {
      tableFunctions[table] = new CrudFunctions(table);
    });
    return tableFunctions;
  };
  
  const foo = generateTableFunctions([
    'service',
    'payment',
    'certification',
    'provider',
    'provider_certifcation',
    'provider_payment',
    'provider_service'
  ]);
  </code></pre>
  <p>What I would really like is for &quot;foo.&quot; to suggest a table name, but if nothing else I would really like &quot;foo.provider.&quot; to suggest <code>getAll, getOne, and add</code>. I've tried making the generator function a jsdoc template, I've tried using typedef but no matter what I don't get any suggestions for foo. Here's the class:</p>
  <pre><code>/** Class representing crud functions of a given table */
  class CrudFunctions {
    /**
     * @param {string} table - the name of the table from the database
     */
    constructor(table) {
      this.table = table;
    }
    /**
     * get all items from the table
     *
     * @returns {Object} all rows from table
     */
    async getAll() {
      const { rows } = await handleQuery(`SELECT * FROM ${this.table}`);
      return rows;
    }
  
    /**
     * gets a single item from the table
     *
     * @param {number} id - the unique id of the item we're looking up
     * @returns {Object} the item from the table
     */
    async getOne(id) {
      const { rows } = await handleQuery(
        `SELECT * FROM ${this.table} WHERE ID=${id}`
      );
      return rows;
    }
  
    /**
     *
     * @param {object} item - an item to be added to the table. all keys should be valid in the database already
     * @returns confirmation that the item got added
     */
    async add(item) {
      const res = await handleQuery(
        buildQuery(`INSERT INTO ${this.table}`, Object.keys(item)),
        Object.values(item)
      );
      return res;
    }
  }
  
  </code></pre>