TypeScript Reference ยท tsconfig: Language, Modules and Emit Options
TypeScript noEmit option
Reference for noEmit: run tsc as a pure type checker in CI and editors while a bundler or runtime handles the JavaScript, plus how it affects build info.
noEmit makes tsc check your code and report errors, but write no files. The exit code still reports success or failure, so it works as a gate in CI or a pre-commit hook.
It is the standard setting when something else produces the JavaScript: Vite, esbuild, SWC, Babel, tsx, or Node's built-in type stripping. Those tools are fast because they do not type-check; tsc --noEmit supplies the checking.
{ "compilerOptions": { "noEmit": true } }
Try it
A type error is exactly what tsc --noEmit exists to catch. The first example type-checks and runs; the second is a plain-JavaScript mistake that a stripper would not notice.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Syntax
{ "compilerOptions": { "noEmit": true } }
tsc --noEmit tsc -p tsconfig.json --noEmit
| Name | Description |
|---|---|
noEmit |
true disables all output: no .js, .d.ts, .map files. Errors are still reported. |
Usage notes
- The second example fails on purpose with a real compiler error:
Type 'string' is not assignable to type 'number'. noEmitplusincrementalstill saves.tsbuildinfo, so repeat checks are quick.- It writes no
.d.tsfiles either; useemitDeclarationOnlywhen only declarations are wanted. - Keep
noEmit: truein the basetsconfig.jsonfor an app, and override it in a separate build config only if needed. - Editors run their own language service and do not depend on this option.
- A passing
tsc --noEmitdoes not prove the bundler can compile the code: also enableisolatedModulesorverbatimModuleSyntax.