From 205405d47ebd2811ec37fb24c55789d4241f693b Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Sat, 4 Jul 2026 16:06:31 +0300 Subject: [PATCH 1/2] fix(theme): improve destructured parameters rendering and flatten lists --- plugins/processor/index.mjs | 22 ++++++++++++++++++++++ plugins/theme/partials/index.mjs | 21 +++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/plugins/processor/index.mjs b/plugins/processor/index.mjs index 3f53030..35fee36 100644 --- a/plugins/processor/index.mjs +++ b/plugins/processor/index.mjs @@ -37,6 +37,28 @@ export function load(app) { .getReflectionsByKind(ReflectionKind.Reference) .forEach(ref => context.project.removeReflection(ref)); + // Destructured parameters are not supported by TypeDoc, so we rename them to + // a more generic name. + context.project + .getReflectionsByKind(ReflectionKind.Parameter) + .forEach(param => { + if (param.name.startsWith('__namedParameters')) { + if ( + param.type?.type === 'reflection' && + param.type.declaration?.children + ) { + const destructuredKeys = param.type.declaration.children.map( + child => child.name + ); + param.name = `{ ${destructuredKeys.join(', ')} }`; + } else if (param.type?.type === 'reference' && param.type.name) { + param.name = param.type.name; + } else { + param.name = 'options'; + } + } + }); + applyExportEqualsReflections(context.project); applySourceMetadata(context.project); }); diff --git a/plugins/theme/partials/index.mjs b/plugins/theme/partials/index.mjs index 1151a64..457a0fa 100644 --- a/plugins/theme/partials/index.mjs +++ b/plugins/theme/partials/index.mjs @@ -55,9 +55,7 @@ export default ctx => { stability, stability && '', model.parameters?.length && - ctx.partials.parametersList(model.parameters, { - headingLevel: options.headingLevel, - }), + ctx.partials.parametersList(model.parameters), ctx.helpers.typedListItem({ label: 'Returns', type: model.type ?? 'void', @@ -301,7 +299,22 @@ export default ctx => { memberTitle: model => getMemberTitle(model, { local: isTypePage(ctx.page.model) }), - parametersList: ctx.helpers.typedList, + parametersList(parameters) { + const flatList = []; + + parameters.forEach(param => { + if ( + param.type?.type === 'reflection' && + param.type.declaration?.children + ) { + flatList.push(...param.type.declaration.children); + } else { + flatList.push(param); + } + }); + + return ctx.helpers.typedList(flatList); + }, typeDeclarationList: ctx.helpers.typedList, propertiesTable: ctx.helpers.typedList, From ebbdf637b05c3fb406ad2907bec1851aedc0da68 Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Sat, 4 Jul 2026 20:50:17 +0300 Subject: [PATCH 2/2] chore: change the first char in interface to lowercase --- plugins/processor/index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/processor/index.mjs b/plugins/processor/index.mjs index 35fee36..3d503fd 100644 --- a/plugins/processor/index.mjs +++ b/plugins/processor/index.mjs @@ -52,7 +52,9 @@ export function load(app) { ); param.name = `{ ${destructuredKeys.join(', ')} }`; } else if (param.type?.type === 'reference' && param.type.name) { - param.name = param.type.name; + const interfaceName = param.type.name; + param.name = + interfaceName[0].toLowerCase() + interfaceName.slice(1); } else { param.name = 'options'; }