microsoft / microsoft/TypeScript
Configurable import suggestions to override global types
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
Search Terms
Suggestion
In our code base we have a module export called Option which we use very often.
However, if we try to reference Option in a module where it's not currently imported, we will not get import suggestions/fixes for this.
This is because there is already a (different) global type of the same name, provided by the dom lib types.
I would like to be able to configure TypeScript and/or VS Code so that I do have import suggestions for Option.
Suggestion: any time a module references a global value, and the project has a module export of the same name, provide an import suggestion for that.
Potential caveat of this suggestion: what happens when you select "add all missing imports"? Ideally I would want it to import my Option, but what if I intentionally wanted to use the global version instead?
Checklist
My suggestion meets these guidelines:
- 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, etc.)
- 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
Comienza revisando el comportamiento solicitado de las sugerencias de importación de TypeScript y/o VS Code para una exportación de módulo que comparte nombre con un tipo DOM global. Define cómo deben elegir las sugerencias explícitas y «añadir todas las importaciones que faltan» entre la exportación del módulo y la versión global. Se considera completado cuando el comportamiento es configurable y el caso de uso intencionado de la versión global sigue siendo claro.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- 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
- Bastante claro
- Aptitud para principiantes
- 25/100