Skip to content

Commit 5478293

Browse files
committed
Fix double render of Hierarchy header
Closes #2053.
1 parent 42fba94 commit 5478293

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
- TypeDoc will now prefer comments on variable declarations over signature comments, #2042.
1111
- Fixed double rendering of "Type Parameters" header, #2054.
12+
- Fixed double rendering of "Hierarchy" header, #2053.
1213
- Removed unused `widgets.png` and `[email protected]` files from generated assets folder.
1314

1415
## v0.23.14 (2022-09-03)

src/lib/output/themes/default/partials/hierarchy.tsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,26 @@ import type { DefaultThemeRenderContext } from "../DefaultThemeRenderContext";
22
import { JSX } from "../../../../utils";
33
import type { DeclarationHierarchy } from "../../../../models";
44

5-
export const hierarchy = (context: DefaultThemeRenderContext, props: DeclarationHierarchy | undefined) => (
6-
<>
7-
{!!props && (
8-
<section class="tsd-panel tsd-hierarchy">
9-
<h4>Hierarchy</h4>
10-
<ul class="tsd-hierarchy">
11-
{props.types.map((item, i, l) => (
12-
<li>
13-
{props.isTarget ? <span class="target">{item.toString()}</span> : context.type(item)}
14-
{i === l.length - 1 && !!props.next && context.hierarchy(props.next)}
15-
</li>
16-
))}
17-
</ul>
18-
</section>
19-
)}
20-
</>
21-
);
5+
export function hierarchy(context: DefaultThemeRenderContext, props: DeclarationHierarchy | undefined) {
6+
if (!props) return;
7+
8+
return (
9+
<section class="tsd-panel tsd-hierarchy">
10+
<h4>Hierarchy</h4>
11+
{hierarchyList(context, props)}
12+
</section>
13+
);
14+
}
15+
16+
function hierarchyList(context: DefaultThemeRenderContext, props: DeclarationHierarchy) {
17+
return (
18+
<ul class="tsd-hierarchy">
19+
{props.types.map((item, i, l) => (
20+
<li>
21+
{props.isTarget ? <span class="target">{item.toString()}</span> : context.type(item)}
22+
{i === l.length - 1 && !!props.next && hierarchyList(context, props.next)}
23+
</li>
24+
))}
25+
</ul>
26+
);
27+
}

0 commit comments

Comments
 (0)