microsoft / microsoft/TypeScript

Allow '--noEmit' to override 'emitDeclarationOnly' from config.

Abierto
#32,380 6 comentarios 15 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Awaiting More Feedback Suggestion
Lenguaje dominante
Go
Estrellas
111k
Forks
14.3k
Merge medio
1 d 19 h
PR fusionados (30 d)
117

Descripción

Search Terms

  • TS5053
  • emitDeclarationOnly

Suggestion

Using "emitDeclarationOnly": true in your tsconfig.json prevents you to do typechecking only runs as running tsc --noEmit will throw the following error.

error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

And the CLI does not look like to have any flag to bypass the error (eg. something like --noEmitDeclarationOnly).

I don't see a reason why a noEmit cli flag would not take precedence over the emitDeclarationOnly from the tsconfig.

Use Cases

With a project with a tsconfig.json set with emitDeclarationOnly and using another compiler like babel to produce the built javascript code, you want to be able to both:

  • Compile declaration files (running tsc)
  • Perform typechecking as a test stage (eg. travis) (running tsc --noEmit). Especially since you do not use TypeScript to compile (so a build could pass with typings errors).

Examples

https://github.com/mgcrea/node-influx-syslog

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

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 en la validación de opciones del compilador que informa de TS5053 y sigue cómo se combina noEmit de la línea de comandos con emitDeclarationOnly de tsconfig. Añade cobertura para la precedencia solicitada y verifica tanto las rutas de emisión de declaraciones como de comprobación de tipos con noEmit; el trabajo estará terminado cuando tsc --noEmit acepte la configuración y el comportamiento normal de tsc permanezca intacto.

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

Evaluación

Stack tecnológico
typescript
Área
cli, compilers
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.