microsoft / microsoft/TypeScript
Write a function to define types.
Abierto
Nadie ha tomado este issue todavía.
Awaiting More Feedback
Suggestion
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
Search Terms
type defination, functional type defination, meta, meta programming, dynamic type declaration
Suggestion
Write a function to define types.
Use Cases
Build a more complex type.
Examples
type MyType<T extends string>{
if(T extends 'a'){
return 'a' //type 'a'
}
if(T extends 'b'){
return 'b' //type 'b'
}
return string
}
Checklist
My suggestion meets these guidelines:
- [x ] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x ] This wouldn't change the runtime behavior of existing JavaScript code
- [x ] This could be implemented without emitting different JS based on the types of the expressions
- [x ] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- [x ] This feature would agree with the rest of TypeScript's Design Goals.
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
El issue no menciona archivos, tests ni puntos de entrada. Lee primero la discusión del issue para aclarar la sintaxis y la semántica de la función propuesta a nivel de tipos; después, identifica el área relevante del compilador y define tests que establezcan el comportamiento esperado.
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