microsoft / microsoft/TypeScript
Imperative type definition
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
🔍 Search Terms
imperative typescript interface
✅ 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
I work on a library that requires to use lots of 3rd party generic types, multiple mappings and more or less complex typing, and I've got to repeat one complex type multiple times or create another generic that is going to contain a lot of parameters and will complicate the code that's already complicated.
(these types have bugs, they just an illustration)
📃 Motivating Example
I imagine it as an "type function" that has function body that returns any valid type.
imperative type Foo<T> {
type X = Bar<T>;
type Y = Baz<T>;
return { x: X, y: Y };
}
type Quix = Foo<string>;
// Quix { x: Bar<string>, y: Baz<string> }
// ... vs
interface Foo<T> {
x: Bar<T>;
y: Baz<T>;
}
💻 Use Cases
- Imperative style
- Shorter syntax for complex types
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
No se identifica ningún archivo de implementación, punto de entrada ni prueba. Empieza revisando la sintaxis propuesta y los ejemplos motivadores frente a los objetivos de diseño de TypeScript; después, inspecciona la arquitectura del comprobador de tipos para determinar dónde encajaría una funcionalidad de este nivel de tipos; se considerará terminado cuando haya un diseño acordado y la implementación y las pruebas correspondientes.
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
- Necesita aclaración
- Aptitud para principiantes
- 25/100