Skip to content

Commit 122de2e

Browse files
committed
Rename @alias to @reexport
1 parent 713df74 commit 122de2e

9 files changed

Lines changed: 32 additions & 28 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ title: Changelog
66

77
### Features
88

9+
- Added a `@reexport` modifier tag to have TypeDoc convert variable/type references as a re-export instead of a new symbol.
910
- Introduced `generateOutputsBegin` and `generateOutputsEnd` events on `Application` for plugin use.
1011

1112
## v0.28.19 (2026-04-12)

site/tags.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ export type Foo = { a: string };
196196
```
197197

198198
- [`@abstract`](./tags/abstract.md)
199-
- [`@alias`](./tags/alias.md)
200199
- [`@alpha`](./tags/alpha.md)
201200
- [`@beta`](./tags/beta.md)
202201
- [`@class`](./tags/class.md)
@@ -221,6 +220,7 @@ export type Foo = { a: string };
221220
- [`@protected`](./tags/protected.md)
222221
- [`@public`](./tags/public.md)
223222
- [`@readonly`](./tags/readonly.md)
223+
- [`@reexport`](./tags/reexport.md)
224224
- [`@sealed`](./tags/sealed.md)
225225
- [`@useDeclaredType`](./tags/useDeclaredType.md)
226226
- [`@virtual`](./tags/virtual.md)

site/tags/alias.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: "@alias"
2+
title: "@reexport"
33
---
44

5-
# @alias
5+
# @reexport
66

77
**Tag Kind:** [Modifier](../tags.md#modifier-tags)
88

9-
The `@alias` tag is valid on type alias and variable declarations which directly reference another
9+
The `@reexport` tag is valid on type alias and variable declarations which directly reference another
1010
symbol. When present, it instructs TypeDoc that the variable it is present on should be treated as
1111
if it was a re-export of the referenced symbol rather than being converted directly.
1212

@@ -27,17 +27,17 @@ being imported from another file. Similarly, the `IsInt` type alias will be trea
2727
import { Vector as _Vector, IsInt as _IsInt } from "./utils.js"
2828

2929
export namespace Math {
30-
/** @alias */
30+
/** @reexport */
3131
export const Vector = _Vector;
3232
export type Vector = typeof _Vector;
3333

34-
/** @alias */
34+
/** @reexport */
3535
export type IsInt<T extends number> = _IsInt<T>;
3636

37-
// The following are all invalid usage of the @alias tag and will produce a warning
38-
/** @alias */
37+
// The following are all invalid usage of the @reexport tag and will produce a warning
38+
/** @reexport */
3939
export type BadAlias1 = 123;
40-
/** @alias */
40+
/** @reexport */
4141
export const BadAlias2 = { someImportedFunction };
4242
}
4343
```

src/lib/converter/symbols.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ function convertTypeAlias(
351351
if (ts.isTypeAliasDeclaration(declaration)) {
352352
const comment = context.getComment(symbol, ReflectionKind.TypeAlias);
353353

354-
if (comment?.hasModifier("@alias")) {
354+
if (comment?.hasModifier("@reexport")) {
355355
if (ts.isTypeReferenceNode(declaration.type)) {
356356
// Note: Get the symbol from the typeName here, NOT the type! The type refers to this alias,
357357
// not the type alias we want to convert.
@@ -362,12 +362,15 @@ function convertTypeAlias(
362362
return;
363363
} else {
364364
context.logger.warn(
365-
i18n.failed_to_convert_0_as_alias(exportSymbol?.name ?? symbol.name),
365+
i18n.failed_to_convert_0_as_reexport(exportSymbol?.name ?? symbol.name),
366366
declaration,
367367
);
368368
}
369369
} else {
370-
context.logger.warn(i18n.failed_to_convert_0_as_alias(exportSymbol?.name ?? symbol.name), declaration);
370+
context.logger.warn(
371+
i18n.failed_to_convert_0_as_reexport(exportSymbol?.name ?? symbol.name),
372+
declaration,
373+
);
371374
}
372375
}
373376

@@ -1023,7 +1026,7 @@ function convertVariable(
10231026
? context.checker.getTypeOfSymbolAtLocation(symbol, declaration)
10241027
: context.checker.getTypeOfSymbol(symbol);
10251028

1026-
if (comment?.hasModifier("@alias")) {
1029+
if (comment?.hasModifier("@reexport")) {
10271030
if (
10281031
declaration && ts.isVariableDeclaration(declaration) && declaration.initializer &&
10291032
(ts.isIdentifier(declaration.initializer) || ts.isPropertyAccessExpression(declaration.initializer))
@@ -1032,7 +1035,7 @@ function convertVariable(
10321035
convertSymbol(context, aliasedSymbol, exportSymbol || symbol);
10331036
return ts.SymbolFlags.Property | ts.SymbolFlags.ValueModule | ts.SymbolFlags.TypeAlias;
10341037
} else {
1035-
context.logger.warn(i18n.failed_to_convert_0_as_alias(exportSymbol?.name ?? symbol.name), declaration);
1038+
context.logger.warn(i18n.failed_to_convert_0_as_reexport(exportSymbol?.name ?? symbol.name), declaration);
10361039
}
10371040
}
10381041

src/lib/internationalization/locales/en.cts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export = {
5353
`{0} is being converted as a class, but does not have any construct signatures`,
5454
converting_0_as_enum_requires_value_declaration:
5555
`Converting {0} as an enum requires a declaration which represents a non-type value`,
56-
failed_to_convert_0_as_alias: "Failed to convert {0} as an alias because it is not direct reference.",
56+
failed_to_convert_0_as_reexport: "Failed to convert {0} as a re-export because it is not direct reference.",
5757

5858
comment_for_0_should_not_contain_block_or_modifier_tags:
5959
`The comment for {0} should not contain any block or modifier tags`,

src/lib/utils/options/tsdoc-defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const tsdocModifierTags = [
7575
export const modifierTags = [
7676
...tsdocModifierTags,
7777
"@abstract",
78-
"@alias",
7978
"@class",
8079
"@disableGroups",
8180
"@enum",
@@ -93,6 +92,7 @@ export const modifierTags = [
9392
"@overload",
9493
"@private",
9594
"@protected",
95+
"@reexport",
9696
"@showCategories",
9797
"@showGroups",
9898
"@useDeclaredType",

src/test/behavior.c2.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,10 +1512,10 @@ describe("Behavior Tests", () => {
15121512
equal(Comment.combineDisplayParts(ctor.signatures[1].typeParameters?.[0].comment?.summary), "class docs");
15131513
});
15141514

1515-
it("Supports the @alias tag", () => {
1516-
const project = convert("alias");
1515+
it("Supports the @reexport tag", () => {
1516+
const project = convert("reexport");
15171517

1518-
logger.expectMessage("warn: Failed to convert BadAlias as an alias because it is not direct reference.");
1518+
logger.expectMessage("warn: Failed to convert BadAlias as a re-export because it is not direct reference.");
15191519

15201520
equal(reflToTree(project), {
15211521
Math: {
@@ -1530,6 +1530,6 @@ describe("Behavior Tests", () => {
15301530
});
15311531

15321532
const bad = query(project, "Math.BadAlias");
1533-
equal(bad.comment?.modifierTags, new Set(["@alias"]));
1533+
equal(bad.comment?.modifierTags, new Set(["@reexport"]));
15341534
});
15351535
});
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ function _makeVec(x: number, y: number, z: number): _Vec {
1212
}
1313

1414
export namespace Math {
15-
// /** Alias comment @alias */
15+
/** Alias comment @reexport */
1616
export type IsInt<T extends number> = _IsInt<T>;
1717

18-
/** Alias comment @alias */
18+
/** Alias comment @reexport */
1919
export const Vec = _Vec;
2020
export type Vec = typeof _Vec;
2121

22-
/** Alias comment @alias */
22+
/** Alias comment @reexport */
2323
export const makeVec = _makeVec;
2424

25-
/** @alias */
25+
/** @reexport */
2626
export type BadAlias = 123;
2727
}

tsdoc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@
8080
"tagName": "@abstract",
8181
"syntaxKind": "modifier"
8282
},
83-
{
84-
"tagName": "@alias",
85-
"syntaxKind": "modifier"
86-
},
8783
{
8884
"tagName": "@document",
8985
"syntaxKind": "block"
@@ -183,6 +179,10 @@
183179
"tagName": "@protected",
184180
"syntaxKind": "modifier"
185181
},
182+
{
183+
"tagName": "@reexport",
184+
"syntaxKind": "modifier"
185+
},
186186
{
187187
"tagName": "@satisfies",
188188
"syntaxKind": "block"

0 commit comments

Comments
 (0)