Skip to content

hyperlink not generated for {@link type#property} #2808

@techfg

Description

@techfg

Search terms

anchor, hyperlink, property, member

Expected Behavior

Per the release notes for v0.27.0, it indicates that "TypeDoc can now link to type alias properties, #2524." Unless I'm misunderstanding what was fixed and what scenarios the fix covers, when using {@link type#property}, the generated HTML should contain a hyperlink to the corresponding anchor tag on the type declaration page.

import { z } from 'zod';

export const foo = {
  /** foo a property */
  a: '',
  /** foo b property */
  b: '',
};
export type FooType = typeof foo;
/** @useDeclaredType */
export type FooTypeDT = typeof foo;
export type FooExplicit = {
  /** FooExplicit a property */
  a: string;
  /** FooExplicit b property */
  b: string;
};
export const zfoo = z.object({
  /** ZodFoo a property */
  a: z.string(),
  /** ZodFoo b property */
  b: z.string(),
});
export type ZodFoo = z.infer<typeof zfoo>;
/** @useDeclaredType */
export type ZodFooDT = z.infer<typeof zfoo>;

/**
 * Link Tests
 *
 * {@link foo} | {@link foo.a}
 *
 * {@link FooType} | {@link FooType.a}
 *
 * {@link FooTypeDT} | {@link FooTypeDT.a}
 * 
 * {@link FooExplicit} | {@link FooExplicit.a}
 *
 * {@link ZodFoo} | {@link ZodFoo#a}
 *
 * {@link ZodFooDT} | {@link ZodFooDT#a}
 */
export const doSomething = () => {};

Actual Behavior

image

  1. The property is hyperlinked but it links to foo.a instead of FooTypeDT.a. I'm not 100% sure if it should link to FooTypeDT.a but mentioning this as a potential bug/issue since I would think it should link to FooTypeDT.a since FooTypeDT is decorated with @useDeclaredType.
  2. Not hyperlinked
  3. Not hyperlinked

For 2 & 3, I was unable to narrow this down any further except for when zod is used, apologies for that. Although I could be mistaken, I do not think this is a zod and/or typedoc-plugin-zod issue because the anchor tag is emitted on the ZodFoo & ZodFooDT declaration pages, the {@link} reference does not error meaning it finds the corresponding type/property, it's only that the hyperlink is not emitted.

Steps to reproduce the bug

Repro: https://stackblitz.com/edit/vitejs-vite-gbh2bhqb

  1. Open repro
  2. npm run docs
  3. View docs/functions/doSomething.html

Environment

  • Typedoc version: 0.27.4
  • TypeScript version: 5.7.2
  • Node.js version: 18.20.3 & 20.18.0
  • OS: linux & windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions