Visitar URL original
Extend `@interface` support to `@typedef`s · Issue #3050 · TypeStrong/typedoc · GitHub
Skip to content

Extend @interface support to @typedefs #3050

Closed as not planned
Closed as not planned

Description

@stwlam

Search Terms

interface typedef

Problem

type Foo = { a: number; b: boolean };

/** @interface */
type Bar = Omit<Foo, "b">; // Expands to { a: number }
/**
 * @typedef Foo
 * @property {number} a
 * @property {boolean} b
 */

/**
 * @typedef {Omit<Foo, "b">} Bar
 * Still rendered as `Omit<Foo, "b">`
 * @interface
 */

Suggested Solution

The rendered result is the same between typescript and javascript.

I understand javascript support isn't the primary focus of this project. If there is a disinclination to extend the @interface feature, would it at all be feasible as a plugin (before I dive in myself to try)?

Activity

  1. added theissue type on Dec 10, 2025
  2. stwlam commented on Dec 10, 2025

    @stwlam
    Author

    Actually, I see from #2916 that this isn't possible with a separate @interface line. I might try to parse out a hint buried in descriptions with a plugin.

  3. added a commit that references this issue on Dec 13, 2025
    3185698
  4. Gerrit0 commented on Dec 13, 2025

    @Gerrit0
    Collaborator

    Coming back to this several months later, there is a way to do this by allowing TypeDoc to parse {@interface} as a modifier tag when parsing comments for @typedef (and friends)... it's kind of hacky, but honestly most things to do with @typedef are kind of hacky.

  5. stwlam commented on Dec 13, 2025

    @stwlam
    Author

    In case it has any relevance, I also recently noticed that block tags like @template must be above the @typedef line for vscode (and presumably therefore tsc) to process them correctly:

    /**
     * not ok
     * @typedef Foo
     * @template {number} T
     * @property {T} a
     */
    /**
     * ok
     * @template {number} T
     * @typedef Foo
     * @property {T} a
     */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions