Document Structure Of A Value For Arbitrary Keys In An Object In Jsdoc
I have a function factory: function factory(events) { for(const key in events) { const { before, after } = events[key] } } Where the argument events is typically: { only
Solution 1:
You can use TS syntax.
p.s. honestly, I'm not sure if this works everywhere. But it works for intellisense at least
/**
* @typedefevent
* @property {function} before
* @property {function} after
*//**
* @param {{[key: string]: event}} events
*/functionfactory(events) {
for (const key in events) {
const { before, after } = events[key]
}
}
Post a Comment for "Document Structure Of A Value For Arbitrary Keys In An Object In Jsdoc"