From 806faae237d56593eefee67b81c6f0cd82fd4f86 Mon Sep 17 00:00:00 2001 From: mister-ben Date: Fri, 17 May 2024 18:40:56 +0200 Subject: [PATCH] fix(docs): Add workaround for ErrorMetadata typedef --- .jsdoc.js | 1 + build/jsdoc-workarounds.js | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 build/jsdoc-workarounds.js diff --git a/.jsdoc.js b/.jsdoc.js index b29cbe866b..748795bb23 100644 --- a/.jsdoc.js +++ b/.jsdoc.js @@ -61,6 +61,7 @@ module.exports = { plugins: [ 'plugins/markdown', 'build/jsdoc-typeof-plugin', + 'build/jsdoc-workarounds', ], markdown: { tags: ['example'], diff --git a/build/jsdoc-workarounds.js b/build/jsdoc-workarounds.js new file mode 100644 index 0000000000..4b4272ba1b --- /dev/null +++ b/build/jsdoc-workarounds.js @@ -0,0 +1,13 @@ +/** + * This jsdoc plugin works around some typescript-flavoured jsdoc that isn't actual jsdoc, + * so docs:api doesn't fail + */ +exports.handlers = { + jsdocCommentFound: event => { + // Special case for media-error.js + event.comment = (event.comment || '').replace( + '@typedef {{errorType: string, [key: string]: any}} ErrorMetadata', + '@typedef {Object} ErrorMetadata\n * @property {string} errorType Error type' + ); + } +};