microsoft / microsoft/TypeScript
Allow '--noEmit' to override 'emitDeclarationOnly' from config.
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne bei der Compiler-Optionsvalidierung, die TS5053 meldet, und verfolge, wie das Befehlszeilen-noEmit mit tsconfig emitDeclarationOnly zusammengeführt wird. Ergänze Tests für die angeforderte Vorrangregel und überprüfe sowohl den Pfad zur Deklarationsausgabe als auch den noEmit-Typprüfungspfad; abgeschlossen ist die Aufgabe, wenn tsc --noEmit die Konfiguration akzeptiert und das normale Verhalten von tsc intakt bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- cli, compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100