From 9a93d1f8ceafde922b5cb5caee6f6b669697947d Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Fri, 4 Aug 2023 15:48:03 +0100 Subject: [PATCH] Update component data JSDoc for ES modules We now store component params as key/value objects just as we do for Nunjucks options, this improves access to values by param name --- shared/lib/components.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared/lib/components.js b/shared/lib/components.js index cb615b75f9..81b4bfbade 100644 --- a/shared/lib/components.js +++ b/shared/lib/components.js @@ -295,7 +295,7 @@ module.exports = { * Component data * * @typedef {object} ComponentData - * @property {ComponentOption[]} [params] - Nunjucks macro option (or param) configs + * @property {{ [param: string]: ComponentOption }} params - Nunjucks macro option (or param) configs * @property {ComponentExample[]} [examples] - Component examples with Nunjucks macro options (or params) * @property {string} [previewLayout] - Nunjucks layout for component preview * @property {string} [accessibilityCriteria] - Accessibility criteria @@ -305,12 +305,11 @@ module.exports = { * Nunjucks macro option (or param) config * * @typedef {object} ComponentOption - * @property {string} name - Option name * @property {'array' | 'boolean' | 'integer' | 'nunjucks-block' | 'object' | 'string'} type - Option type * @property {boolean} required - Option required * @property {string} description - Option description * @property {boolean} [isComponent] - Option is another component - * @property {ComponentOption[]} [params] - Nunjucks macro option (or param) configs + * @property {{ [param: string]: ComponentOption }} [params] - Nunjucks macro option (or param) configs */ /**