microsoft / microsoft/TypeScript
export import in declare module
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo motivador y el tratamiento existente de declare module, import types y export assignments. Determina cómo representaría TypeScript export import tanto para tipos como para valores sin cambiar el JavaScript emitido; se considera terminado cuando la declaración de back_module admite el uso mostrado de EnumType y conserva la compatibilidad hacia atrás.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100