microsoft / microsoft/TypeScript
Allow '--noEmit' to override 'emitDeclarationOnly' from config.
Personne n'a encore pris cette issue.
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par la validation des options du compilateur qui signale TS5053 et suivez la manière dont noEmit de la ligne de commande est fusionné avec emitDeclarationOnly de tsconfig. Ajoutez une couverture pour la priorité demandée et vérifiez à la fois les chemins d’émission des déclarations et de vérification des types avec noEmit ; le travail est terminé lorsque tsc --noEmit accepte la configuration tout en laissant le comportement normal de tsc intact.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- typescript
- Domaine
- cli, compilers
- Type d'issue
- Fonctionnalité
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100