Microsoft/TypeScript

Inlay hints look awkward for callback parameters with a single parameter

Open

#45.389 aperta il 10 ago 2021

Vedi su GitHub
 (4 commenti) (5 reazioni) (0 assegnatari)TypeScript (6726 fork)batch import
Domain: LS: Inlay HintsExperience EnhancementFix AvailableHelp WantedRescheduledSuggestion

Metriche repository

Star
 (48.455 star)
Metriche merge PR
 (Merge medio 6g 17h) (9 PR mergiate in 30 g)

Descrizione

When you have a callback whose parameter has no parentheses, inlay hints starts to look a little bit weird.

For example, in this code

            return hints.map(hint => ({
                ...hint,
                position: scriptInfo.positionToLineOffset(hint.position),
            }));

you get the following:

image

Ideally, you'd see that line rewritten as

callbackfn: (hint: InlayHint) => ({
```

Guida contributor