Skip to content

Commit f1aee85

Browse files
committed
Be even more restrictive with parent links
Resolves #2982
1 parent 303eb38 commit f1aee85

File tree

8 files changed

+744
-17
lines changed

8 files changed

+744
-17
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ title: Changelog
1010

1111
### Bug Fixes
1212

13+
- Fixed bug introduced in 0.28.8 where TypeDoc could not render docs when members inherited from a complex type alias, #2982.
1314
- Fixed automatic discovery of entry points when not running in packages mode, #2988.
1415
- Fixed discovery of package.json file when running with entry points containing a glob, #2985.
1516

src/lib/converter/plugins/ImplementsPlugin.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,24 @@ export class ImplementsPlugin extends ConverterComponent {
172172
// serialization/deserialization, might point to an unexpected location. (See the mixin
173173
// converter tests, I suspect this might actually be an indication of something else slightly
174174
// broken there, but don't want to spend more time with this right now.)
175+
// #2982, even more unfortunately, we only want to keep the link if it is pointing to a reflection
176+
// which will receive a link during rendering.
177+
const isValidRef = (ref: ReferenceType) =>
178+
ref.reflection && !ref.reflection.parent?.kindOf(ReflectionKind.TypeLiteral);
179+
175180
for (const child of reflection.children || []) {
176-
if (child.inheritedFrom && !child.inheritedFrom.reflection) {
181+
if (child.inheritedFrom && !isValidRef(child.inheritedFrom)) {
177182
child.inheritedFrom = ReferenceType.createBrokenReference(child.inheritedFrom.name, project);
178183
}
179-
if (child.overwrites && !child.overwrites.reflection) {
184+
if (child.overwrites && !isValidRef(child.overwrites)) {
180185
child.overwrites = ReferenceType.createBrokenReference(child.overwrites.name, project);
181186
}
182187

183188
for (const childSig of child.getAllSignatures()) {
184-
if (childSig.inheritedFrom && !childSig.inheritedFrom.reflection) {
189+
if (childSig.inheritedFrom && !isValidRef(childSig.inheritedFrom)) {
185190
childSig.inheritedFrom = ReferenceType.createBrokenReference(childSig.inheritedFrom.name, project);
186191
}
187-
if (childSig.overwrites && !childSig.overwrites.reflection) {
192+
if (childSig.overwrites && !isValidRef(childSig.overwrites)) {
188193
childSig.overwrites = ReferenceType.createBrokenReference(childSig.overwrites.name, project);
189194
}
190195
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export type TMXNode<T> = {} & {
2+
base: T;
3+
};
4+
5+
export interface TMXDataNode extends TMXNode<{ extra: any }> {
6+
}

src/test/converter2/renderer/index.ts

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

137137
export * as ExpandType from "./expandType";
138+
export * as GH2982 from "./gh2982";

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

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

src/test/renderer/specs/modules.json

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,29 @@
106106
]
107107
}
108108
},
109+
{
110+
"dd.tsd-member-summary": []
111+
},
112+
{
113+
"dt.tsd-member-summary#gh2982": {
114+
"span.tsd-member-summary-name": [
115+
{
116+
"tag": "a",
117+
"props": {
118+
"href": "modules/GH2982.json"
119+
},
120+
"children": "GH2982"
121+
},
122+
{
123+
"tag": "a.tsd-anchor-icon",
124+
"props": {
125+
"href": "#gh2982",
126+
"aria-label": "Permalink"
127+
}
128+
}
129+
]
130+
}
131+
},
109132
{
110133
"dd.tsd-member-summary": []
111134
}
@@ -551,21 +574,32 @@
551574
"children": "Namespaces"
552575
},
553576
{
554-
"div": {
555-
"tag": "a",
556-
"props": {
557-
"href": "#expandtype"
577+
"div": [
578+
{
579+
"tag": "a",
580+
"props": {
581+
"href": "#expandtype"
582+
},
583+
"children": {
584+
"span": [
585+
"Expand",
586+
{
587+
"wbr": []
588+
},
589+
"Type"
590+
]
591+
}
558592
},
559-
"children": {
560-
"span": [
561-
"Expand",
562-
{
563-
"wbr": []
564-
},
565-
"Type"
566-
]
593+
{
594+
"tag": "a",
595+
"props": {
596+
"href": "#gh2982"
597+
},
598+
"children": {
599+
"span": "GH2982"
600+
}
567601
}
568-
}
602+
]
569603
}
570604
]
571605
},
Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
{
2+
"div.container.container-main": [
3+
{
4+
"div.col-content": [
5+
{
6+
"div.tsd-page-title": [
7+
{
8+
"tag": "ul.tsd-breadcrumb",
9+
"props": {
10+
"aria-label": "Breadcrumb"
11+
},
12+
"children": {
13+
"li": {
14+
"tag": "a",
15+
"props": {
16+
"href": "",
17+
"aria-current": "page"
18+
},
19+
"children": "GH2982"
20+
}
21+
}
22+
},
23+
{
24+
"h1": "Namespace GH2982"
25+
}
26+
]
27+
},
28+
{
29+
"tag": "details.tsd-panel-group.tsd-member-group.tsd-accordion",
30+
"props": {
31+
"open": true
32+
},
33+
"children": [
34+
{
35+
"tag": "summary.tsd-accordion-summary",
36+
"props": {
37+
"data-key": "section-Interfaces"
38+
},
39+
"children": {
40+
"h2": "Interfaces"
41+
}
42+
},
43+
{
44+
"dl.tsd-member-summaries": [
45+
{
46+
"dt.tsd-member-summary#tmxdatanode": {
47+
"span.tsd-member-summary-name": [
48+
{
49+
"tag": "a",
50+
"props": {
51+
"href": "../interfaces/GH2982.TMXDataNode.json"
52+
},
53+
"children": "TMXDataNode"
54+
},
55+
{
56+
"tag": "a.tsd-anchor-icon",
57+
"props": {
58+
"href": "#tmxdatanode",
59+
"aria-label": "Permalink"
60+
}
61+
}
62+
]
63+
}
64+
},
65+
{
66+
"dd.tsd-member-summary": []
67+
}
68+
]
69+
}
70+
]
71+
},
72+
{
73+
"tag": "details.tsd-panel-group.tsd-member-group.tsd-accordion",
74+
"props": {
75+
"open": true
76+
},
77+
"children": [
78+
{
79+
"tag": "summary.tsd-accordion-summary",
80+
"props": {
81+
"data-key": "section-Type Aliases"
82+
},
83+
"children": {
84+
"h2": "Type Aliases"
85+
}
86+
},
87+
{
88+
"dl.tsd-member-summaries": [
89+
{
90+
"dt.tsd-member-summary#tmxnode": {
91+
"span.tsd-member-summary-name": [
92+
{
93+
"tag": "a",
94+
"props": {
95+
"href": "../types/GH2982.TMXNode.json"
96+
},
97+
"children": "TMXNode"
98+
},
99+
{
100+
"tag": "a.tsd-anchor-icon",
101+
"props": {
102+
"href": "#tmxnode",
103+
"aria-label": "Permalink"
104+
}
105+
}
106+
]
107+
}
108+
},
109+
{
110+
"dd.tsd-member-summary": []
111+
}
112+
]
113+
}
114+
]
115+
}
116+
]
117+
},
118+
{
119+
"div.col-sidebar": {
120+
"div.page-menu": {
121+
"tag": "details.tsd-accordion.tsd-page-navigation",
122+
"props": {
123+
"open": true
124+
},
125+
"children": [
126+
{
127+
"summary.tsd-accordion-summary": {
128+
"h3": "On This Page"
129+
}
130+
},
131+
{
132+
"div.tsd-accordion-details": [
133+
{
134+
"tag": "details.tsd-accordion.tsd-page-navigation-section",
135+
"props": {
136+
"open": true
137+
},
138+
"children": [
139+
{
140+
"tag": "summary.tsd-accordion-summary",
141+
"props": {
142+
"data-key": "section-Interfaces"
143+
},
144+
"children": "Interfaces"
145+
},
146+
{
147+
"div": {
148+
"tag": "a",
149+
"props": {
150+
"href": "#tmxdatanode"
151+
},
152+
"children": {
153+
"span": [
154+
"TMX",
155+
{
156+
"wbr": []
157+
},
158+
"Data",
159+
{
160+
"wbr": []
161+
},
162+
"Node"
163+
]
164+
}
165+
}
166+
}
167+
]
168+
},
169+
{
170+
"tag": "details.tsd-accordion.tsd-page-navigation-section",
171+
"props": {
172+
"open": true
173+
},
174+
"children": [
175+
{
176+
"tag": "summary.tsd-accordion-summary",
177+
"props": {
178+
"data-key": "section-Type Aliases"
179+
},
180+
"children": "Type Aliases"
181+
},
182+
{
183+
"div": {
184+
"tag": "a",
185+
"props": {
186+
"href": "#tmxnode"
187+
},
188+
"children": {
189+
"span": [
190+
"TMX",
191+
{
192+
"wbr": []
193+
},
194+
"Node"
195+
]
196+
}
197+
}
198+
}
199+
]
200+
}
201+
]
202+
}
203+
]
204+
}
205+
}
206+
}
207+
]
208+
}

0 commit comments

Comments
 (0)