-1

In typescript I can document a dictionary/map that has certain given entries but is still a dictionary/map (as you can add or remove entries) like this

type Foo = {
    bar: number;
    moo: number;
    [key: string]: number;
};

Is there a JSDoc equivalent?

gman
  • 83,286
  • 25
  • 191
  • 301

1 Answers1

1

You can use this syntax for params

/**
 * @param {Object.<string, number>} foo
 */

I'm not sure about using the same with @typedef, but guess this one should work too:

/**
 * @typedef {Object.<string, number>} Foo
 */

Type docs http://usejsdoc.org/tags-type.html

Lesha Ogonkov
  • 1,138
  • 6
  • 19