Skip to content
Tutorials Center
My learning

Topics

TypeScript Reference ยท The tsc Command Line

tsc --noEmit

Reference for tsc --noEmit: running only the type checker, using it in CI and with bundlers, and how it interacts with incremental builds and exit codes.

tsc --noEmit runs the whole type checker and writes nothing: no .js, no .d.ts, no source maps. The only result is the list of errors and the exit status.

That is exactly what you want when something else produces the JavaScript. Bundlers such as Vite or esbuild, Babel, Node's own type stripping, and test runners all remove types without checking them, so tsc --noEmit is the step that actually enforces the types.

TEXT
tsc --noEmit
tsc -p tsconfig.json --noEmit

Try it

Because tools that strip types never complain about type errors, this program would run fine if types were simply erased. The checker is what catches it.

TypeScript A type error that stripping 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.

TypeScript The same code, fixed

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

TEXT
tsc --noEmit
JSON
{ "compilerOptions": { "noEmit": true } }

Behavior: the program is fully parsed and checked, then emit is skipped. With errors, the exit code is 1; with none it is 0.

Edge cases: noEmit together with composite or declaration conflicts in older setups, because those need output. Use emitDeclarationOnly for a declarations-only build instead. With incremental, tsc --noEmit may still write a .tsbuildinfo file (in recent versions it does so to speed up later checks).

Usage notes

  • CI recipe: an npm script "typecheck": "tsc --noEmit" run next to lint and tests.
  • Pair it with isolatedModules and verbatimModuleSyntax, so what the checker accepts is also safe for single-file transpilers.
  • Faster in watch mode: tsc --noEmit --watch keeps the checker warm during development.
  • Does not replace tests. It proves types fit, not that values are right.
  • Decide on noEmitOnError if you do emit: it stops JavaScript from being written when there are errors. It is the opposite trade-off from --noEmit.