0
/**
 * @typedef {string} UUID
 * */

/**
 * @typedef {Object} ITEM
 * @property {UUID} id
 * */

/** 
 * @typedef {Object} THINGY
 * @property {??????}
 * */

const oneThingy = {
 asdf: {id: 'asdf', ...},
 sdfg: {id: 'sdfg', ...},
 dfgh: {id: 'dfgh', ...}
}

Assuming that a THINGY can have infinite k:v pairs, and that the keys will be random UUIDs, how would I document and type the @property?

Tibrogargan
  • 4,508
  • 3
  • 19
  • 38

1 Answers1

1

Thanks to a kind person named Kyriakos on the JSDoc Slack channel, TIL it's not the @property, I just need the properly-formatted @typedef:

/**
 * @typedef {string} UUID
 * */

/**
 * @typedef {Object} ITEM
 * @property {UUID} id
 * */

/** 
 * @typedef {Object.<UUID, ITEM>} THINGY // <-- this one
 * */

const oneThingy = {
 asdf: {id: 'asdf', ...},
 sdfg: {id: 'sdfg', ...},
 dfgh: {id: 'dfgh', ...}
}