Skip to content

"typescript.inlayHints.includeInlayParameterNameHints": "all" breaks inference with dangling commas #724

@Klaster1

Description

@Klaster1

How to reproduce:

  1. Install TypeScript 4.8.4 as a project dependency.
  2. Enable set "typescript.inlayHints.includeInlayParameterNameHints" to "all".
  3. Checks the inferred type for nums:
class Bad {
	nums = combineLatest([of(1), of(2), of(3)]).pipe(
		map(([a, b, c]) => a + b + c), // <- trailing comma
	)
}

Reproducer: tslangserver-report.zip.

Expected:
The type is inferred as Observable<number>.

Observed:
nums infers to Observable<unknown>.

Notes:
I'm using the service via the https://github.com/sublimelsp/LSP-typescript in Sublime Text 4. Disabling the setting or removing the comma fixes the inference. VSCode with language server version set to 4.8.4 infers everything correctly. This is mildly annoying as Prettier adds dangling commas by default and I can't change the project TS version yet. I can point the server to use TS 5, but I figured the bug's worth reporting anyway,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions