microsoft / microsoft/TypeScript
[Feature Request] [Typescript Extension] Less redundant inlay hints for arrow function vars/consts
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.3k
- Merge moyen
- 2 j 4 h
- PR mergées (30 j)
- 132
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par localiser l’implémentation TypeScript des inlay hints et le paramètre « Variable Types: Suppress When Type Matches Name ». Comparez l’inlay hint existant du type de retour d’une fonction fléchée avec la suppression demandée des inlay hints de variables, puis ajoutez une couverture de tests montrant que les inlay hints de variables redondants sont masqués tandis que les inlay hints de retour restent présents.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- developer-experience
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100