lint-staged-tsc

raw JSON →
0.2.1 verified Fri May 01 auth: no javascript

A utility that extends lint-staged to run TypeScript type checking only on staged files, improving performance by avoiding full project rechecks. Currently at stable v0.2.1 with intermittent releases (last in May 2022). The key differentiator is that unlike tsc --noEmit on all files, it scopes type checking to the staged files, respecting tsconfig include and declarations. Minimal dependencies but requires lint-staged as peer. Suitable for CI and pre-commit hooks.

error Cannot find module 'lint-staged-tsc'
cause Package not installed or not in node_modules
fix
Run npm install --save-dev lint-staged-tsc
error lint-staged-tsc: command not found
cause lint-staged may be running in a shell that doesn't have the node_modules/.bin in PATH
fix
Configure lint-staged to use npx: "npx lint-staged-tsc" or ensure package is installed locally.
gotcha This tool requires TypeScript to be installed as a devDependency. It uses the local tsc binary.
fix Ensure typescript is in devDependencies (npm i -D typescript).
gotcha The tool relies on the tsconfig.json include/exclude configuration. If your tsconfig doesn't cover staged files, type checking may be skipped.
fix Verify that tsconfig.json includes the staged files. Adjust include patterns if needed.
gotcha This is not a replacement for full tsc --noEmit. It only checks staged files; errors in non-staged files will not be caught until they are staged.
fix Consider running full type check in CI or periodically.
deprecated Project has seen no updates since May 2022. May not support newer TypeScript versions or lint-staged breaking changes.
fix Monitor for updates or consider alternatives like tsc-files or custom lint-staged task.
npm install lint-staged-tsc
yarn add lint-staged-tsc
pnpm add lint-staged-tsc

Configure lint-staged to run TypeScript type checking on staged .ts/.tsx files using lint-staged-tsc.

{
  "lint-staged": {
    "**/*.{ts,tsx}": "lint-staged-tsc"
  }
}