microsoft / microsoft/TypeScript
[Feature Request] [Typescript Extension] Less redundant inlay hints for arrow function vars/consts
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Example ts file without inlay hints:
```ts
//No inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext = createContext();
export const usePixi = () => useContext(PixiContext)!;
```
Example ts file with all inlay hints:
```ts
//All inlay hints
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context | undefined>*/ = createContext();
export const usePixi /*: () => Application*/ = () /*: 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:
```ts
//Feature suggestion
import { createContext, useContext } from "solid-js";
import type { Application } from "pixi.js";
export const PixiContext /*: Context | undefined>*/ = createContext();
export const usePixi = () /*: Application*/ => useContext(PixiContext)!;
```
This would avoid redundant type information when the variable name and the function's return type provide sufficient context.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin by locating the TypeScript inlay-hints implementation and the “Variable Types: Suppress When Type Matches Name” setting. Compare the existing arrow-function return-type hint with the requested variable-hint suppression, then add coverage showing redundant variable hints are hidden while return hints remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100