Skip to content

Inline union type #2920

Closed
Closed

Description

@sergeiivankov

Minimal example:

type EndpointIdentifier = 'main' | 'test';

/**
 * @inlineType EndpointIdentifier
 */
export function test(endpoint: EndpointIdentifier) {
  // ...
}

Problem found in this case usage:

/** @enum */
const Endpoint = Object.freeze({
  Main: 'main',
  Test: 'test',
});

type EndpointIdentifier = typeof Endpoint[keyof typeof Endpoint];

/**
 * @inlineType EndpointIdentifier
 */
export function test(endpoint: EndpointIdentifier = Endpoint.Main) {
  // ...
}

Search terms

inline union type

Expected Behavior

Generate function docs with all union variants:

test(endpoint: "main" | "test")

Actual Behavior

Generate empty object type:

test(endpoint: {})

Environment

  • Typedoc version: 0.28.1
  • TypeScript version: 5.8.2
  • Node.js version: 22.11.0
  • OS: Win10

Activity

  1. Gerrit0 commented on Apr 1, 2025

    @Gerrit0
    Collaborator

    Ah, yeah... @inline really wasn't intended for non-object-literals... I think it's reasonable to try to support this.

  2. added a commit that references this issue on Apr 1, 2025
    6376273
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

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions