microsoft / microsoft/TypeScript

Support declaring @types as the supported route for typings dependencies in the package.json

Abierto
#38,249 8 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

In Discussion Needs Proposal Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Search Terms

package json types field types types module

Suggestion

Allow libraries written in JavaScript to be able to declare that they have types in DT (or other modules), and that they support a certain version of it.

For example:

Express does not support TypeScript but trusts that the DefinitelyTyped express maintainers know what they are doing generally. They want to declare that DT is the way for TypeScript users to get types out of the box. Today that's not really possible.

Examples

Two potential routes:

  1. Override the "types" parameter to support: "types": "@types/express:^3.0" in a package.json

  2. Recommend a new field in the package.json: "typesModule": "@types/express:^3.0" - then when TypeScript normally offers a 'no types found', then it can offer the command to install with the correct semver range.

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.

/cc @wesleytodd @isaacs @ljharb

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza revisando cómo TypeScript lee los metadatos de package.json y el funcionamiento de la ruta existente “no types found”; el issue no menciona archivos fuente ni tests. El diseño debe elegir y especificar primero cómo declara un paquete un módulo de typings externo y su rango de semver compatible, y después verificar que TypeScript pueda usar esa declaración para orientar la instalación.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
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
32/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.