microsoft / microsoft/TypeScript
export import in declare module
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 2g 4h
- PR unite (30g)
- 132
Descrizione
Suggestion
🔍 Search Terms
declare module enum export import
✅ Viability Checklist
My suggestion meets these guidelines:
- [v] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [v] This wouldn't change the runtime behavior of existing JavaScript code
- [v] This could be implemented without emitting different JS based on the types of the expressions
- [v] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [v] This feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
Allow export import for types and values in declare module
📃 Motivating Example
declare module './back_module' {
/** @deprecated for backward compatible */
export import EnumType = import('./front_module').EnumType; // Suggestion feature
}
(back_module as any).RawTypeId = front_module.RawTypeId;
// ...
import { EnumType } from './back_module';
type foobar = EnumType.Value; // it's impossible with just `type =` and `let =`
type foobar2 = OnlyForEnumType<EnumType>; // it's impossible if enum is new
💻 Use Cases
I moved EnumType to a different module but I wish to keep it backward compatible.
and back_module cannot import front_module for my situation.
So I want to declare it on the other module which combines them.
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
Inizia dall’esempio motivante e dalla gestione esistente di declare module, import types ed export assignments. Determina come TypeScript rappresenterebbe export import sia per i tipi sia per i valori senza modificare il JavaScript emesso; il lavoro è completato quando la dichiarazione di back_module supporta l’utilizzo mostrato di EnumType mantenendo la compatibilità all’indietro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100