Skip to content

Commit

Permalink
Check declaration merged reflections
Browse files Browse the repository at this point in the history
Resolves #2033
  • Loading branch information
Gerrit0 committed Aug 13, 2022
1 parent a12573d commit ae459f8
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,7 @@

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

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

Expand Down
10 changes: 9 additions & 1 deletion src/lib/converter/comments/declarationReferenceResolver.ts
Expand Up @@ -55,7 +55,15 @@ export function resolveDeclarationReference(
) {
high.push(reflection.parent!.parent!);
} else if (high[0] !== reflection) {
high.push(reflection);
if (reflection.parent instanceof ContainerReflection) {
high.push(
...(reflection.parent.children?.filter(
(c) => c.name === reflection.name
) || [])
);
} else {
high.push(reflection);
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/test/converter2/issues/gh2033.ts
@@ -0,0 +1,6 @@
export namespace Foo {
export interface Bar {}
}

/** {@link Bar} */
export class Foo {}
14 changes: 14 additions & 0 deletions src/test/issueTests.ts
Expand Up @@ -726,4 +726,18 @@ export const issueTests: {
logger.discardDebugMessages();
logger.expectNoOtherMessages();
},

gh2033(project, logger) {
const cls = project.children!.find(
(c) => c.name === "Foo" && c.kind === ReflectionKind.Class
);
ok(cls);

const link = cls.comment?.summary[0];
ok(link?.kind === "inline-tag");
ok(link.target);

logger.discardDebugMessages();
logger.expectNoOtherMessages();
},
};

0 comments on commit ae459f8

Please sign in to comment.