Skip to content

Commit 2c10f67

Browse files
committed
Avoid references to references
Resolves #2811
1 parent 016e6a1 commit 2c10f67

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ title: Changelog
77
### Bug Fixes
88

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

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

src/lib/converter/symbols.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,7 @@ function createAlias(
929929
// We already have this. Create a reference.
930930
const ref = new ReferenceReflection(
931931
exportSymbol?.name ?? symbol.name,
932-
target,
932+
target.isReference() ? target.getTargetReflection() : target,
933933
context.scope,
934934
);
935935
context.postReflectionCreation(ref, symbol, exportSymbol);

src/test/converter2/issues/gh2811.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export const abc = 123;
2+
3+
export { abc as rename1 };
4+
5+
import { rename1 } from "./gh2811.js";
6+
export { rename1 as rename2 };

src/test/issues.c2.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -1971,4 +1971,16 @@ describe("Issue Tests", () => {
19711971
equal(alpha2.type?.type, "reflection");
19721972
equal(alpha2.type.declaration.comment, undefined);
19731973
});
1974+
1975+
it("#2811 avoids references to references", () => {
1976+
const project = convert();
1977+
const abc = query(project, "abc");
1978+
const rename1 = query(project, "rename1");
1979+
ok(rename1.isReference());
1980+
ok(rename1.getTargetReflection() === abc);
1981+
1982+
const rename2 = query(project, "rename2");
1983+
ok(rename2.isReference());
1984+
ok(rename2.getTargetReflection() === abc);
1985+
});
19741986
});

0 commit comments

Comments
 (0)