Microsoft/TypeScript

Inlay hints look awkward for callback parameters with a single parameter

Open

#45.389 geöffnet am 10. Aug. 2021

Auf GitHub ansehen
 (4 Kommentare) (5 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
Domain: LS: Inlay HintsExperience EnhancementFix AvailableHelp WantedRescheduledSuggestion

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

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) => ({
```

Contributor Guide