javascript - JsDoc: How do I document that an object can have arbritrary (unknown) properties but with a particular type? -
this similar question 30360391. want express parameter of function plain js object can have arbitrary properties (with unknown) names properties objects fixed properties.
an example: function this
/** * @param {descriptor} desc */ function foo( desc ) { // ... }
and typical desc
looks like
desc = { unknownentity1: { priority: 5; writable: false; }, unknownentity2: { priority: 42; writable: true; }, unknownentity3: { priority: 9; writable: false; } }
i have
/** * @typedef {object} descriptorentry * @property {number} priority - priority of entity * @property {boolean} writable - true, if entity can modified */
i still need typedef
descriptor
express descriptor object arbitrary properties of type descriptorentry
. pseudo-code like
/** * @typedef {object} descriptor * @property {descriptorentry} * */
of course, asterisk *
wildcard "any property" invalid jsdoc syntax. how do correctly?
Comments
Post a Comment