microsoft / microsoft/TypeScript

Inlay hints should support spread arguments for tuple types

Open
#45,868 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Proposal Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Issue Type: Bug

Inlay hints don't support rest params spread parameters.
For example, I'm using this method which has the following signature:

controls.setPosition(x: number, y: number, z: number, enableTransition: boolean);

And I want to pass in a Vector3Tuple as the position, say [0,0,0]:

type Vector3Tuple = [number, number, number];

const position: Vector3Tuple = [0,0,0];

controls.setPosition(...position, false);

This is what I see for the inlay hints:

inlay rest

In other words, ...position is showing as a single argument when it should be three.

If I expand the arguments, it does correctly show the hints:

inlay explicit

I'm not sure what the inlay hints should show for ...position, however, the final parameter of false should correctly show enableTransition.

VS Code version: Code 1.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:41:52.311Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
Remote OS version: Linux x64 5.10.16.3-microsoft-standard-WSL2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Reproduce the provided Vector3Tuple spread example with TypeScript inlay hints enabled, then compare it with the explicit-argument example; done means the final false argument is labeled enableTransition and the spread arguments receive appropriate hints.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.