Skip to content
Latchkey

tsc Command: Compile TypeScript in CI

tsc type-checks TypeScript and emits JavaScript (and declaration files).

tsc is the TypeScript compiler and the standard type-check gate in CI. Many pipelines run it with --noEmit purely to catch type errors, while build pipelines use it (or --build for project references) to emit JS and .d.ts files.

Common flags

  • --noEmit - type-check only, do not write output (common CI gate)
  • -p / --project PATH - use a specific tsconfig.json
  • --build / -b - build project references incrementally
  • --outDir DIR - output directory for emitted JS
  • --strict - enable all strict type-checking options
  • --watch - recompile on file changes (local, not CI)
  • --incremental - reuse .tsbuildinfo for faster rebuilds

Example in CI

Run a pure type-check gate against the project tsconfig:

shell
tsc --noEmit -p tsconfig.json

Common errors in CI

  • error TS2307: Cannot find module 'X' or its corresponding type declarations
  • error TS2304: Cannot find name 'X' - missing import or lib option
  • error TS2345: Argument of type A is not assignable to parameter of type B
  • error TS5023: Unknown compiler option 'X' - typo or version mismatch in tsconfig

Key takeaways

  • tsc --noEmit is the canonical CI type-check that emits nothing.
  • Use --build/-b for monorepos with project references.
  • TS2307/TS2304 are the most common CI failures (missing module or name).

Related guides

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