microsoft / microsoft/TypeScript
[Feature Request] [Typescript Extension] Less redundant inlay hints for arrow function vars/consts
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
Example ts file without inlay hints:
//No inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext = createContext<Application>();
export const usePixi = () => useContext(PixiContext)!;
Example ts file with all inlay hints:
//All inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context<Application<Renderer> | undefined>*/ = createContext<Application>();
export const usePixi /*: () => Application<Renderer>*/ = () /*: Application<...*/ => useContext(PixiContext)!;
My suggestion is to extend the TypeScript › Inlay Hints › Variable Types: Suppress When Type Matches Name setting to also hide the inlay hint for a variable/constant when its value is an arrow function that already displays its own return type inlay hint.
Example ts file with my suggestion:
//Feature suggestion
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context<Application<Renderer> | undefined>*/ = createContext<Application>();
export const usePixi = () /*: Application<Renderer>*/ => useContext(PixiContext)!;
This would avoid redundant type information when the variable name and the function's return type provide sufficient context.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie damit, die TypeScript-Implementierung für Inlay-Hints und die Einstellung „Variable Types: Suppress When Type Matches Name“ zu lokalisieren. Vergleichen Sie den bestehenden Hinweis auf den Rückgabetyp von Arrow Functions mit der angeforderten Unterdrückung von Variablen-Hinweisen und ergänzen Sie anschließend die Testabdeckung, die zeigt, dass redundante Variablen-Hinweise ausgeblendet werden, während Rückgabe-Hinweise erhalten bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- developer-experience
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100