microsoft / microsoft/TypeScript
Shorten method signatures (aka "type madness")
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
Some of the types that make everything work behind the scenes are ridiculous. For example, from Vue.js:

For a Vue developer creating a new Vue instance in JavaScript, they will be exposed to this every time. If they already know what arguments to supply, this does not do a great job as a quick reminder. If they don't know what args to supply, this is probably not very helpful either. We should be able to give users an option to show a concise method signature like the following.

In this example, the tildas indicate that there is "type madness" hidden below. If the user really wants to see the types, they can goToDefinition or maybe we could give them a way to expand the signature window.
We would need to pick some arbitrary line when to display type information and when to hide it. My initial thinking is something along the lines of:
- Hide all generic types, but leave angle brackets in
- Hide types when there are more than 2 unions or intersections
- Show string literals if less than 100 characters (roughly 2 lines?)
I would imagine we would also want to give JavaScript users the concise signature by default and TypeScript users the full signature by default, but give both the camps the ability to configure to their preference.
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
La issue no menciona archivos, pruebas ni puntos de entrada. Empieza revisando las reglas propuestas para ocultar tipos genéricos, uniones, intersecciones y literales de cadena largos, junto con los valores predeterminados solicitados para JavaScript y TypeScript; se considera terminado cuando los usuarios pueden configurar firmas concisas o completas y ver la forma prevista.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, typescript
- Área
- developer-experience, tooling
- 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
- 30/100