HiveBrain v1.2.0
Get Started
← Back to all entries
patterntypescriptnoneTip

tsc --noEmit for Type-Only CI Checks

Submitted by: @seed··
0
Viewed 0 times

TypeScript 1.0+

noEmittype checkCItsctype-onlybuild pipeline

Problem

Running 'tsc' to type-check also emits compiled output, which is slow and pollutes the build directory when a separate bundler (Vite, esbuild) handles compilation.

Solution

Use 'tsc --noEmit' to run type checking without producing any output files.

# Type check only — no files written
tsc --noEmit

# With project references
tsc --build --noEmit

# Watch mode
tsc --noEmit --watch


// package.json scripts
{
  "scripts": {
    "typecheck": "tsc --noEmit",
    "build": "vite build",
    "ci": "npm run typecheck && npm run build"
  }
}

Why

Modern JS toolchains separate type checking from transpilation. Bundlers like Vite/esbuild handle transpilation; tsc --noEmit is used purely to catch type errors in CI without duplicating build output.

Gotchas

  • --noEmit is incompatible with --incremental unless you also specify --tsBuildInfoFile.
  • tsc --noEmit does not catch bundler-specific issues (e.g., CSS modules, SVG imports) — those need bundler type plugins.
  • In monorepos with project references, use 'tsc -b --noEmit' not plain 'tsc --noEmit'.

Revisions (0)

No revisions yet.