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' + ); + } +};