microsoft / microsoft/TypeScript
`organizeImports` does not merge value and type imports
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔍 Search Terms
organizeImports type
✅ Viability Checklist
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
Merge value and type imports into one import.
📃 Motivating Example
If I have the following code
import { CascadeFunction } from "@rcompat/async/cascade";
import cascade from "@rcompat/async/cascade";
And I run organizeImports, then it will be merged into
import cascade, { CascadeFunction } from "@rcompat/async/cascade";
However, if I have
import type { CascadeFunction } from "@rcompat/async/cascade";
import cascade from "@rcompat/async/cascade";
Running organizeImports will do nothing, although I would expect it to merge the imports into
import cascade, { type CascadeFunction } from "@rcompat/async/cascade";
💻 Use Cases
- What do you want to use this for?
Keeping imports clean. - What shortcomings exist with current approaches?
Imports may be doubled, and I might not notice it despite runningorganizeImports. - What workarounds are you using in the meantime?
Merge manually if I notice it.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Partite dal punto di ingresso organizeImports e seguite come vengono gestiti gli import di valori e gli import di soli tipi dallo stesso modulo. Riproducete entrambi gli esempi, quindi verificate che gli import di soli tipi e gli import di valori diventino un unico import con uno specificatore di tipo inline, mentre il comportamento esistente degli import rimane invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 45/100