Skip to content
Tutorials Center
My learning

Topics

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.

JSON
{ "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.

TypeScript Code that passes the check

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 What the check would reject

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

JSON
{ "compilerOptions": { "noEmit": true } }
Terminal
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'.
  • noEmit plus incremental still saves .tsbuildinfo, so repeat checks are quick.
  • It writes no .d.ts files either; use emitDeclarationOnly when only declarations are wanted.
  • Keep noEmit: true in the base tsconfig.json for 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 --noEmit does not prove the bundler can compile the code: also enable isolatedModules or verbatimModuleSyntax.