Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot link to default property #2524

Open
disog opened this issue Mar 15, 2024 · 1 comment
Open

Cannot link to default property #2524

disog opened this issue Mar 15, 2024 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@disog
Copy link

disog commented Mar 15, 2024

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

  1. Create a package.json file with the following contents:
{
  "name": "test",
  "version": "0.1.0"
}
  1. Create an index.ts file with the following contents:
/** Test */
export type Test = {
  /** Default */
  readonly default: string;
  /** {@link Test.default} */
  readonly other: string;
}
  1. 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
@disog disog added the bug Functionality does not match expectation label Mar 15, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 16, 2024

This is because TypeScript doesn't resolve that link.

image

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants