Skip to content

Inline union type #2920

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

Closed
sergeiivankov opened this issue Mar 27, 2025 · 1 comment
Closed

Inline union type #2920

sergeiivankov opened this issue Mar 27, 2025 · 1 comment

Comments

@sergeiivankov
Copy link

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
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 1, 2025

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

@Gerrit0 Gerrit0 closed this as completed in 6376273 Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants