You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trailing fixed tuple elements correspond to the last arguments, not
the first positions after a rest element. Without aligning from the
end, inlay hints point to the wrong parameter and can hide names of
later parameters.
A spread can leave the effective argument count unknown even when
explicit arguments follow it. Those trailing arguments still have
known positions from the end of the call.
Optional tuple elements may be omitted, so their names cannot always
be inferred from the end of a call. An argument before a known
trailing suffix must not be labeled as that suffix either.
Optional and variable tuple elements make the next parameter position
uncertain. Keep hints for positions known from the end of a required
tuple suffix, but omit names that could refer to a different argument.
Avoid aligning optional trailing tuple elements as required
tsc/internal/ls/inlay_hints.go:897
This alignment uses trailingCount, so an optional suffix is treated as present whenever the call has enough arguments. For declare function f(...args: [...head: number[], tail?: string]); f(1), index == 0 is remapped to tail, even though the optional tail may be omitted and 1 belongs to head; this regresses the existing start-to-end mapping for optional trailing tuples. Only apply this known-arity remapping when all trailing fixed elements are required (and add a regression case for an omitted optional suffix).
The reason will be displayed to describe this comment to others. Learn more.
I have mostly been able to track this stuff, but I'm starting to find it hard to keep track of in this branch. Maybe you could add some comments at each branch to show concrete situations that we're trying to handle?
This branch has not been deployed
No deployments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It was easier to just write what I meant on #64363 than to describe it better.
Fixes #59979
Closes #64363