Skip to content

Commit

Permalink
Avoid references to references
Browse files Browse the repository at this point in the history
Resolves #2811
  • Loading branch information
Gerrit0 committed Dec 20, 2024
1 parent 016e6a1 commit 2c10f67
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ title: Changelog
### Bug Fixes

- `@include` and `@includeCode` now work in the readme file, #2814.
- TypeDoc will now avoid making references to references, #2811.

## v0.27.5 (2024-12-14)

Expand Down
2 changes: 1 addition & 1 deletion src/lib/converter/symbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ function createAlias(
// We already have this. Create a reference.
const ref = new ReferenceReflection(
exportSymbol?.name ?? symbol.name,
target,
target.isReference() ? target.getTargetReflection() : target,
context.scope,
);
context.postReflectionCreation(ref, symbol, exportSymbol);
Expand Down
6 changes: 6 additions & 0 deletions src/test/converter2/issues/gh2811.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const abc = 123;

export { abc as rename1 };

import { rename1 } from "./gh2811.js";
export { rename1 as rename2 };
12 changes: 12 additions & 0 deletions src/test/issues.c2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1971,4 +1971,16 @@ describe("Issue Tests", () => {
equal(alpha2.type?.type, "reflection");
equal(alpha2.type.declaration.comment, undefined);
});

it("#2811 avoids references to references", () => {
const project = convert();
const abc = query(project, "abc");
const rename1 = query(project, "rename1");
ok(rename1.isReference());
ok(rename1.getTargetReflection() === abc);

const rename2 = query(project, "rename2");
ok(rename2.isReference());
ok(rename2.getTargetReflection() === abc);
});
});

0 comments on commit 2c10f67

Please sign in to comment.