Skip to content

Commit 1269e3a

Browse files
committed
Make parent links even more restrictive
Resolves #3007
1 parent b3a4869 commit 1269e3a

File tree

10 files changed

+1441
-4
lines changed

10 files changed

+1441
-4
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 bug introduced in 0.28.8 where TypeDoc could not render docs with some mixin classes, #3007.
10+
711
## v0.28.12 (2025-09-01)
812

913
### Bug Fixes

scripts/testcase.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ async function main() {
6666
const ext = process.argv[3] ? `.${process.argv[3]}` : guessExtension(code);
6767
const file = `src/test/converter2/issues/gh${issue}${ext}`;
6868
await writeFile(file, code.content);
69-
await exec(`code ${file} src/test/issues.c2.test.ts`);
69+
console.log(file);
70+
console.log("src/test/issues.c2.test.ts");
7071
}
7172

7273
void main();

src/lib/converter/plugins/ImplementsPlugin.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,13 @@ 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.
175+
// #2982/#3007, even more unfortunately, we only want to keep the link if it is pointing
176+
// to a reflection which will receive a link during rendering, we pick this based on it being
177+
// the type of member we expect to point to.
177178
const isValidRef = (ref: ReferenceType) =>
178-
ref.reflection && !ref.reflection.parent?.kindOf(ReflectionKind.TypeLiteral);
179+
!!ref.reflection?.parent?.kindOf(
180+
ReflectionKind.ClassOrInterface | ReflectionKind.Method | ReflectionKind.Constructor,
181+
);
179182

180183
for (const child of reflection.children || []) {
181184
if (child.inheritedFrom && !isValidRef(child.inheritedFrom)) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
interface MixinConstructor<B extends new (...args: any) => U, U> {
2+
new (...args: ConstructorParameters<B>): U;
3+
}
4+
5+
export declare class DOMBase<T extends Node> {
6+
[Symbol.iterator](): Iterator<T>;
7+
}
8+
9+
export interface DOMIterable extends Partial<DOMBase<Node>> {
10+
}
11+
12+
declare const DOMClass_base: MixinConstructor<typeof DOMBase, DOMBase<Node> & object>;
13+
14+
export declare class DOMClass extends DOMClass_base {
15+
private constructor();
16+
}

src/test/converter2/renderer/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,5 @@ export interface DisabledGroups {
138138
export * as ExpandType from "./expandType";
139139
export * as GH2982 from "./gh2982";
140140
export { gh2995 } from "./gh2995";
141+
export * as GH3007 from "./gh3007";
141142
export { box as boxAlias };

src/test/renderer/specs/classes/GH3007.DOMBase.json

Lines changed: 505 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 288 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,288 @@
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+
{
14+
"li": {
15+
"tag": "a",
16+
"props": {
17+
"href": "../modules/GH3007.json"
18+
},
19+
"children": "GH3007"
20+
}
21+
},
22+
{
23+
"li": {
24+
"tag": "a",
25+
"props": {
26+
"href": "",
27+
"aria-current": "page"
28+
},
29+
"children": "DOMClass"
30+
}
31+
}
32+
]
33+
},
34+
{
35+
"h1": "Class DOMClass"
36+
}
37+
]
38+
},
39+
{
40+
"tag": "section.tsd-panel.tsd-hierarchy",
41+
"props": {
42+
"data-refl": "146"
43+
},
44+
"children": [
45+
{
46+
"h4": "Hierarchy"
47+
},
48+
{
49+
"ul.tsd-hierarchy": {
50+
"li.tsd-hierarchy-item": [
51+
{
52+
"span.tsd-signature-type": "DOMClass_base"
53+
},
54+
{
55+
"ul.tsd-hierarchy": {
56+
"li.tsd-hierarchy-item": {
57+
"span.tsd-hierarchy-target": "DOMClass"
58+
}
59+
}
60+
}
61+
]
62+
}
63+
}
64+
]
65+
},
66+
{
67+
"aside.tsd-sources": {
68+
"ul": {
69+
"li": [
70+
"Defined in ",
71+
{
72+
"tag": "a",
73+
"props": {
74+
"href": "gh3007.ts"
75+
},
76+
"children": "gh3007.ts:14"
77+
}
78+
]
79+
}
80+
}
81+
},
82+
{
83+
"section.tsd-panel-group.tsd-index-group": {
84+
"section.tsd-panel.tsd-index-panel": {
85+
"tag": "details.tsd-index-content.tsd-accordion",
86+
"props": {
87+
"open": true
88+
},
89+
"children": [
90+
{
91+
"summary.tsd-accordion-summary.tsd-index-summary": {
92+
"h5.tsd-index-heading.uppercase": "Index"
93+
}
94+
},
95+
{
96+
"div.tsd-accordion-details": {
97+
"section.tsd-index-section": [
98+
{
99+
"h3.tsd-index-heading": "Methods"
100+
},
101+
{
102+
"div.tsd-index-list": [
103+
{
104+
"tag": "a.tsd-index-link.tsd-is-inherited",
105+
"props": {
106+
"href": "#iterator"
107+
},
108+
"children": {
109+
"span": "[iterator]"
110+
}
111+
},
112+
"\n"
113+
]
114+
}
115+
]
116+
}
117+
}
118+
]
119+
}
120+
}
121+
},
122+
{
123+
"tag": "details.tsd-panel-group.tsd-member-group.tsd-accordion",
124+
"props": {
125+
"open": true
126+
},
127+
"children": [
128+
{
129+
"tag": "summary.tsd-accordion-summary",
130+
"props": {
131+
"data-key": "section-Methods"
132+
},
133+
"children": {
134+
"h2": "Methods"
135+
}
136+
},
137+
{
138+
"section": {
139+
"section.tsd-panel.tsd-member.tsd-is-inherited": [
140+
{
141+
"h3.tsd-anchor-link#iterator": [
142+
{
143+
"span": "[iterator]"
144+
},
145+
{
146+
"tag": "a.tsd-anchor-icon",
147+
"props": {
148+
"href": "#iterator",
149+
"aria-label": "Permalink"
150+
}
151+
}
152+
]
153+
},
154+
{
155+
"ul.tsd-signatures.tsd-is-inherited": {
156+
"li.tsd-is-inherited": [
157+
{
158+
"div.tsd-signature.tsd-anchor-link#iterator-1": [
159+
{
160+
"span.tsd-kind-call-signature": "\"[iterator]\""
161+
},
162+
{
163+
"span.tsd-signature-symbol": "()"
164+
},
165+
{
166+
"span.tsd-signature-symbol": ":"
167+
},
168+
" ",
169+
{
170+
"span.tsd-signature-type": "Iterator"
171+
},
172+
{
173+
"span.tsd-signature-symbol": "<"
174+
},
175+
{
176+
"span.tsd-signature-type": "Node"
177+
},
178+
{
179+
"span.tsd-signature-symbol": ">"
180+
},
181+
{
182+
"tag": "a.tsd-anchor-icon",
183+
"props": {
184+
"href": "#iterator-1",
185+
"aria-label": "Permalink"
186+
}
187+
}
188+
]
189+
},
190+
{
191+
"div.tsd-description": [
192+
{
193+
"h4.tsd-returns-title": [
194+
"Returns ",
195+
{
196+
"span.tsd-signature-type": "Iterator"
197+
},
198+
{
199+
"span.tsd-signature-symbol": "<"
200+
},
201+
{
202+
"span.tsd-signature-type": "Node"
203+
},
204+
{
205+
"span.tsd-signature-symbol": ">"
206+
}
207+
]
208+
},
209+
{
210+
"aside.tsd-sources": [
211+
{
212+
"p": "Inherited from DOMClass_base.[iterator]"
213+
},
214+
{
215+
"ul": {
216+
"li": [
217+
"Defined in ",
218+
{
219+
"tag": "a",
220+
"props": {
221+
"href": "gh3007.ts"
222+
},
223+
"children": "gh3007.ts:6"
224+
}
225+
]
226+
}
227+
}
228+
]
229+
}
230+
]
231+
}
232+
]
233+
}
234+
}
235+
]
236+
}
237+
}
238+
]
239+
}
240+
]
241+
},
242+
{
243+
"div.col-sidebar": {
244+
"div.page-menu": {
245+
"tag": "details.tsd-accordion.tsd-page-navigation",
246+
"props": {
247+
"open": true
248+
},
249+
"children": [
250+
{
251+
"summary.tsd-accordion-summary": {
252+
"h3": "On This Page"
253+
}
254+
},
255+
{
256+
"div.tsd-accordion-details": {
257+
"tag": "details.tsd-accordion.tsd-page-navigation-section",
258+
"props": {
259+
"open": true
260+
},
261+
"children": [
262+
{
263+
"tag": "summary.tsd-accordion-summary",
264+
"props": {
265+
"data-key": "section-Methods"
266+
},
267+
"children": "Methods"
268+
},
269+
{
270+
"div": {
271+
"tag": "a.tsd-is-inherited",
272+
"props": {
273+
"href": "#iterator"
274+
},
275+
"children": {
276+
"span": "[iterator]"
277+
}
278+
}
279+
}
280+
]
281+
}
282+
}
283+
]
284+
}
285+
}
286+
}
287+
]
288+
}

0 commit comments

Comments
 (0)