typedoc
typedoc copied to clipboard
Cannot link to `default` property
Search terms
link, default
Expected Behavior
It should generate the docs.
Actual Behavior
It outputs:
[warning] Failed to resolve link to "Test.default" in comment for Test.__type.other.
Steps to reproduce the bug
- Create a
package.json
file with the following contents:
{
"name": "test",
"version": "0.1.0"
}
- Create an
index.ts
file with the following contents:
/** Test */
export type Test = {
/** Default */
readonly default: string;
/** {@link Test.default} */
readonly other: string;
}
- Run the following commands:
npm install --save-dev typedoc typescript
npm exec typedoc index.ts
Environment
- Typedoc version: 0.25.12
- TypeScript version: 5.4.2
- Node.js version: v20.11.0
- OS: Linux 5.15.146.1-microsoft-standard-WSL2 x86_64 x86_64
This is because TypeScript doesn't resolve that link.
The only reason that linking to other
doesn't generate a warning is because TypeScript resolves it. TypeDoc's custom link resolution doesn't support resolving links to properties of type aliases.
In fact, while {@link Test.other}
doesn't generate a warning, it also doesn't actually work. It will generate a link to Test.html#__type.other
, but the __type.other
anchor does not exist on the page. This needs to be fixed before the default
issue.