BACK TO DIRECTORY
hookbeginner

Type Check

Runs the TypeScript compiler in noEmit mode before every commit to catch type errors that ESLint might miss. Checks the entire project for type safety rather than just staged files, since type changes can have cascading effects. Blocks commits that introduce type errors, keeping the main branch type-safe at all times.

534 STARS
8.3k DOWNLOADS
claude-templates
typescripttsctypespre-commitsafety

CONFIGURATION

json
1{
2 "hooks": {
3 "pre-commit": {
4 "command": "npx tsc --noEmit --pretty",
5 "description": "Run TypeScript type checking on the entire project",
6 "on_failure": "block",
7 "timeout": 60000,
8 "env": {
9 "NODE_OPTIONS": "--max-old-space-size=4096"
10 }
11 }
12 },
13 "settings": {
14 "run_in_background": false,
15 "show_output_on_success": false,
16 "show_output_on_failure": true,
17 "cache": true,
18 "cache_key": "tsconfig.json"
19 },
20 "tsconfig_recommendations": {
21 "strict": true,
22 "noUncheckedIndexedAccess": true,
23 "noImplicitReturns": true,
24 "noFallthroughCasesInSwitch": true,
25 "exactOptionalPropertyTypes": true
26 }
27}