diff --git a/CHANGELOG.md b/CHANGELOG.md index 2458b31f5..f27a53844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/lib/converter/symbols.ts b/src/lib/converter/symbols.ts index 73a22a012..fba8ef17e 100644 --- a/src/lib/converter/symbols.ts +++ b/src/lib/converter/symbols.ts @@ -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); diff --git a/src/test/converter2/issues/gh2811.ts b/src/test/converter2/issues/gh2811.ts new file mode 100644 index 000000000..d439e6113 --- /dev/null +++ b/src/test/converter2/issues/gh2811.ts @@ -0,0 +1,6 @@ +export const abc = 123; + +export { abc as rename1 }; + +import { rename1 } from "./gh2811.js"; +export { rename1 as rename2 }; diff --git a/src/test/issues.c2.test.ts b/src/test/issues.c2.test.ts index fa0d03f06..c5bbfd76f 100644 --- a/src/test/issues.c2.test.ts +++ b/src/test/issues.c2.test.ts @@ -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); + }); });