Skip to content

Commit ae459f8

Browse files
committed
Check declaration merged reflections
Resolves #2033
1 parent a12573d commit ae459f8

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
lines changed

CHANGELOG.md

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

55
- Readme files within monorepos now have `@link` tags resolved, #2029.
66
- Correctly resolve unqualified links to class members within parameters, #2031.
7+
- TypeDoc will now consider other reflections with the same name as parents when resolving links, #2033.
78

89
## v0.23.10 (2022-07-31)
910

src/lib/converter/comments/declarationReferenceResolver.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ export function resolveDeclarationReference(
5555
) {
5656
high.push(reflection.parent!.parent!);
5757
} else if (high[0] !== reflection) {
58-
high.push(reflection);
58+
if (reflection.parent instanceof ContainerReflection) {
59+
high.push(
60+
...(reflection.parent.children?.filter(
61+
(c) => c.name === reflection.name
62+
) || [])
63+
);
64+
} else {
65+
high.push(reflection);
66+
}
5967
}
6068
}
6169

src/test/converter2/issues/gh2033.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export namespace Foo {
2+
export interface Bar {}
3+
}
4+
5+
/** {@link Bar} */
6+
export class Foo {}

src/test/issueTests.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,4 +726,18 @@ export const issueTests: {
726726
logger.discardDebugMessages();
727727
logger.expectNoOtherMessages();
728728
},
729+
730+
gh2033(project, logger) {
731+
const cls = project.children!.find(
732+
(c) => c.name === "Foo" && c.kind === ReflectionKind.Class
733+
);
734+
ok(cls);
735+
736+
const link = cls.comment?.summary[0];
737+
ok(link?.kind === "inline-tag");
738+
ok(link.target);
739+
740+
logger.discardDebugMessages();
741+
logger.expectNoOtherMessages();
742+
},
729743
};

0 commit comments

Comments
 (0)