Allow '--noEmit' to override 'emitDeclarationOnly' from config.
See original GitHub issueSearch 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.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:5
Top Results From Across the Web
Option 'noEmit' cannot be specified with option 'incremental'
Allow noEmit and composite together in 3.7 #33809 ... So you should either remove noEmit: true or change it to emitDeclarationOnly: true ....
Read more >noEmit - TSConfig Option
All the configuration options for a project. Classes. How to provide types to JavaScript ES6 classes. Made with ♥ in Redmond, Boston, SF...
Read more >TypeScript With Babel: A Beautiful Marriage - I Am Turns
Let me show you. ... But the Babel configuration improves on this with ... "noEmit": true, // Enable strictest settings like ...
Read more >A brief introduction to TypeScript's command-line interface ...
In this lesson, let's learn how to use the tsc command-line options ... we learn about different TypeScript compiler settings and the role ......
Read more >Tsconfig noemit - Lokale Tafelrunde Oberhavel
The configuration from the base file are loaded first, then overridden by those ... { "noEmit": true } }env variable name description default;...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI, this works:
@SamB seems reasonable, although to retain the general idea that CLI flags generally override configured behavior, cli flags should always override code emit settings from config, and
noEmit
should only override emit requests at the same levelFor example, the
noEmit
flag overrides other flags that request code be emitted, andnoEmit
key in config overrides other keys in config that request code to be emitted. However, flags requesting code to be emitted will overridenoEmit
key in config.Pseudo-code for logic: