Skip to content
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

When a function parameter has type NoInfer<T>, T is removed from the generated doc #2539

Closed
xuhdev opened this issue Apr 6, 2024 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@xuhdev
Copy link
Contributor

xuhdev commented Apr 6, 2024

Search terms

NoInfer, TypeScript 5.4

Expected Behavior

When NoInfer<T> is used in a function parameter, T is retained in the document output of this function parameter. This is because T is still informational, indicating that the function parameter has type T -- it's just that T can't be inferred from this function parameter.

Actual Behavior

T is removed from this function parameter in the doc.

Steps to reproduce the bug

(The corresponding test does not check for C:

equal(sig.parameters[1].type?.toString(), "NoInfer");
)

  1. Download the test file: https://github.com/TypeStrong/typedoc/blob/3398e98dce4de5d7c5a53f1f6c66e1af8aa28cc9/src/test/converter2/behavior/noInfer.ts
export function createStreetLight<C extends string>(
    colors: C[],
    defaultColor?: NoInfer<C>,
) {}

// @ts-expect-error
createStreetLight(["red", "yellow", "green"], "blue");
  1. npm install --save-dev typedoc
  2. npx typedoc NoInfer.ts
  3. Observe that C is gone from the defaultColor parameter description

Environment

  • Typedoc version: 0.25.12
  • TypeScript version: 5.4.3
  • Node.js version: 20.12.1
  • OS: Debian
@xuhdev xuhdev added the bug Functionality does not match expectation label Apr 6, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Apr 6, 2024

Huh, that's strange... I must not have been paying enough attention.

@Gerrit0 Gerrit0 closed this as completed in b76d804 Apr 6, 2024
xuhdev added a commit to 8hobbies/utils that referenced this issue Apr 8, 2024
So that the relevant typedoc bug on `NoInfer` is fixed: TypeStrong/typedoc#2539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

2 participants