Skip to content
Latchkey

What Is the TypeScript Compiler (tsc)? Explained

tsc is the TypeScript compiler: it checks your code against its types and converts TypeScript into plain JavaScript that any runtime can execute.

The TypeScript compiler, invoked as "tsc", does two jobs: it verifies that your code respects its type annotations, and it emits JavaScript. Many build tools strip types quickly without checking them, which is why running tsc as a dedicated type-check step in CI is so important.

What tsc is

tsc is the official compiler for TypeScript. Given .ts and .tsx files, it performs full type-checking, reports type errors, and emits JavaScript plus optional declaration files (.d.ts) and source maps. Its behavior is driven by a tsconfig.json that sets the target, module format, strictness, and which files to include.

Type-checking vs transpiling

There are two separable tasks: checking types and producing JavaScript. Fast tools like esbuild, SWC, and Babel transpile by deleting type annotations without checking them. tsc is the tool that actually validates the types, which is why "tsc --noEmit" (check only, emit nothing) is a standard CI gate even when another tool does the bundling.

A usage example

Type-check the whole project without emitting files.

Type-checking with tsc
# tsconfig.json sets strictness and target
# check types only, no output
npx tsc --noEmit

Role in CI/CD

In CI, "tsc --noEmit" is the canonical type-safety gate: it fails the build if any type error exists, catching bugs that fast transpilers silently ignore. Type-checking large projects is CPU-heavy and can be a slow step; incremental builds (the .tsbuildinfo cache) and project references help, and these checks finish faster on capable managed runners.

Alternatives

esbuild, SWC, and Babel can transpile TypeScript far faster but do not type-check. The "vue-tsc" and similar wrappers extend tsc for framework files. There is no real alternative for accurate type-checking; tsc is the authoritative tool, usually run alongside a faster bundler.

Key takeaways

  • tsc both type-checks TypeScript and emits JavaScript.
  • Fast bundlers strip types without checking; only tsc validates them.
  • Run "tsc --noEmit" in CI as the authoritative type-safety gate.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →