Skip to content

JSDoc for overloads and implementation is not displayed #2599

@tats-u

Description

@tats-u

Steps to reproduce

let state: number = 0;

/**
 * Sets the state to a new value.
 * @param value - A number to set the state directly.
 * @param newState - A function that takes the previous state and returns a new state.
 */
export function setState(value: number): void;
export function setState(newState: (prevState: number) => number): void;
export function setState(valueOrFunction: number | ((prevState: number) => number)): void {
  state = typeof valueOrFunction === 'function'
    ? valueOrFunction(state)
    : valueOrFunction;
}

/**
 * Gets the current state value.
 * @returns The current state as a number.
 */
export function getState(): number {
  return state;
}

I found this regression in parseFormData in @remix-run/form-data-parser.

https://github.com/remix-run/remix/blob/e8a0bff7aca39363ce53ba4deee7310cdd0e9016/packages/form-data-parser/src/lib/form-data.ts#L74-L102

バージョン: 1.108.2 (user setup)
コミット: c9d77990917f3102ada88be140d28b038d1dd7c7
日付: 2026-01-21T13:52:09.270Z
Electron: 39.2.7
ElectronBuildId: 12953945
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200

  1. Launch VS Code
  2. Install the TS Native Preview Extension (0.20260127.1)
  3. Create a new file
  4. Paste the above code
  5. Hover the mouse pointer over the function signatures other than function setState(value: number): void
  6. "TypeScript Native Preview: Enable (Experimental)/Disable" and go to 5. again

Behavior with typescript@5.9

Non-top overload setState(newState: (prevState: number) => number): void:

Image

Implementation setState(valueOrFunction: number | ((prevState: number) => number)): void:

Image

Behavior with tsgo

"(+1 overload)" and the JSDoc are not displayed in other than the top overload signature.

Non-top overload setState(newState: (prevState: number) => number): void:

Image

Implementation setState(valueOrFunction: number | ((prevState: number) => number)): void:

Image

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions