Skip to content

Commit 7bdb05f

Browse files
committed
Fix inconsistent anchors for aliases
Resolves #2990
1 parent e764a51 commit 7bdb05f

File tree

6 files changed

+90
-2
lines changed

6 files changed

+90
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ title: Changelog
44

55
## Unreleased
66

7+
### Bug Fixes
8+
9+
- Fixed inconsistent anchors on module pages for re-exports, #2990.
10+
711
## v0.28.9 (2025-08-01)
812

913
### Features

scripts/rebuild_specs.js

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env node
12
// @ts-check
23
"use strict";
34

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function moduleMemberSummary(
7575
context: DefaultThemeRenderContext,
7676
member: DeclarationReflection | DocumentReflection,
7777
) {
78-
const id = context.slugger.slug(member.name);
78+
const id = member.isReference() ? context.getAnchor(member)! : context.slugger.slug(member.name);
7979
context.page.pageHeadings.push({
8080
link: `#${id}`,
8181
text: getDisplayName(member),

src/test/converter2/renderer/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ export interface DisabledGroups {
136136

137137
export * as ExpandType from "./expandType";
138138
export * as GH2982 from "./gh2982";
139+
export { box as boxAlias };

src/test/renderer/specs/interfaces/GH2982.TMXDataNode.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
{
9797
"tag": "section.tsd-panel.tsd-hierarchy",
9898
"props": {
99-
"data-refl": "122"
99+
"data-refl": "123"
100100
},
101101
"children": [
102102
{

src/test/renderer/specs/modules.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,56 @@
516516
]
517517
}
518518
]
519+
},
520+
{
521+
"tag": "details.tsd-panel-group.tsd-member-group.tsd-accordion",
522+
"props": {
523+
"open": true
524+
},
525+
"children": [
526+
{
527+
"tag": "summary.tsd-accordion-summary",
528+
"props": {
529+
"data-key": "section-References"
530+
},
531+
"children": {
532+
"h2": "References"
533+
}
534+
},
535+
{
536+
"dl.tsd-member-summaries": [
537+
{
538+
"dt.tsd-member-summary#boxalias": {
539+
"span.tsd-member-summary-name": [
540+
{
541+
"span": "boxAlias"
542+
},
543+
{
544+
"span": " → "
545+
},
546+
{
547+
"tag": "a",
548+
"props": {
549+
"href": "functions/box.json"
550+
},
551+
"children": "box"
552+
},
553+
{
554+
"tag": "a.tsd-anchor-icon",
555+
"props": {
556+
"href": "#boxalias",
557+
"aria-label": "Permalink"
558+
}
559+
}
560+
]
561+
}
562+
},
563+
{
564+
"dd.tsd-member-summary": []
565+
}
566+
]
567+
}
568+
]
519569
}
520570
]
521571
},
@@ -855,6 +905,38 @@
855905
}
856906
}
857907
]
908+
},
909+
{
910+
"tag": "details.tsd-accordion.tsd-page-navigation-section",
911+
"props": {
912+
"open": true
913+
},
914+
"children": [
915+
{
916+
"tag": "summary.tsd-accordion-summary",
917+
"props": {
918+
"data-key": "section-References"
919+
},
920+
"children": "References"
921+
},
922+
{
923+
"div": {
924+
"tag": "a",
925+
"props": {
926+
"href": "#boxalias"
927+
},
928+
"children": {
929+
"span": [
930+
"box",
931+
{
932+
"wbr": []
933+
},
934+
"Alias"
935+
]
936+
}
937+
}
938+
}
939+
]
858940
}
859941
]
860942
}

0 commit comments

Comments
 (0)