Visitar URL original
`@inline` and `@inlineType` not usable with `@typedef` · Issue #2916 · TypeStrong/typedoc · GitHub
Skip to content

@inline and @inlineType not usable with @typedef #2916

Closed as not planned
Closed as not planned

Description

@stwlam

I wasn't sure whether to report this as a bug or feature request since @inline, etc. aren't explicitly marked as supporting @typedef. But since @typedefs are converted to type aliases or interfaces, it seems it should have worked out of the box.

Search terms

inline, expand, typedef

Expected Behavior

The @inline tag may be placed on type aliases and interfaces. When a type is annotated with @inline and the type is referenced, TypeDoc will attempt to inline the referenced type within the other type.

Actual Behavior

The referenced type and type definition itself fall back to any:

Image

Image

Steps to reproduce the bug

/**
 * @typedef HelloProps
 * @inline
 * @property {string} name Name property docs
 */

/**
 * Hello component - HelloProps will be inlined here as
 * if you had written `Hello(props: { name: string })`
 * @param {HelloProps} props
 */
export function hello(props) {
  return "Hello {props.name}!";
}

Moving the placement of @inline to above @typedef or below the @property has it get ignored entirely (perhaps expected).

Environment

  • Typedoc version: 0.28.1
  • TypeScript version: 5.6.3
  • Node.js version: 22.14.0
  • OS: Ubuntu 22.04.5

Activity

  1. added theissue type on Mar 23, 2025
  2. changed the issue type fromtoon Mar 23, 2025
  3. Gerrit0 commented on Mar 24, 2025

    @Gerrit0
    Collaborator

    Switching to feature type -- @typedef, despite being converted as a type alias, takes an entirely different code path because it is special and doesn't follow the normal structure that TypeDoc relies on for type aliases. It should be relatively straightforward to add support for @inline.

    I'd kind of expect @expand to work already as that tag is used when rendering, at which point TypeDoc has unified both typedef and type aliases into a common reflection structure...

  4. added
    help wantedContributions are especially encouraged
    good first issueEasier issue for first time contributors
    on Mar 24, 2025
  5. added
    jsThis issue relates to better TS-in-JS support
    on Apr 7, 2025
  6. changed the title [-]`@inline`, `@expand`, etc. not usable with `@typedef`[/-] [+]`@inline`, and `@inlineType` not usable with `@typedef`[/+] on Apr 7, 2025
  7. changed the title [-]`@inline`, and `@inlineType` not usable with `@typedef`[/-] [+]`@inline` and `@inlineType` not usable with `@typedef`[/+] on Apr 7, 2025
  8. added and removed
    help wantedContributions are especially encouraged
    good first issueEasier issue for first time contributors
    jsThis issue relates to better TS-in-JS support
    on Apr 7, 2025
  9. Gerrit0 commented on Apr 7, 2025

    @Gerrit0
    Collaborator

    After further review, so far as I can tell there is absolutely no way for TypeDoc to support this with @inline because of a limitation of TypeScript's JSDoc parser. It does not support additional tags within the description of a typedef alias.

    TypeDoc respects TypeScript's rules for how to parse typedef comments, and there is no place in which @inline can be placed in the typedef comment where TypeScript considers it to be a part of the typedef comment.

    (after typedef -- ends parse of @typedef, so TypeDoc's any was correct)
    Image

    (after properties -- not a part of the typedef declaration, TS allows multiple typedefs in a single comment)
    Image

    (before typedef -- not a part of the typedef declaration, ditto)
    Image


    You can, however, use @inlineType HelloProps in the comment for hello to inline the type.

    Image

  10. added a commit that references this issue on Apr 7, 2025
  11. deleted a comment from 0Qaismoradi on Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions