TypeScript Compiler (tsc)¶
The TypeScript compiler type-checks code and emits JavaScript. On large codebases, tsc can take 30-60 seconds per run, making it the slowest part of most TypeScript validation pipelines.
Native Port¶
A native port of tsc shows roughly 10x speedup for type checking. The port maintains API compatibility with standard tsc:
The native port is still in development.
Usage¶
# Type check without emitting
tsc --noEmit
# Watch mode for incremental checking
tsc --watch
# Check specific files
tsc src/index.ts src/utils.ts
Configuration¶
// tsconfig.json
{
"compilerOptions": {
"strict": true,
"noEmit": true,
"skipLibCheck": true
},
"include": ["src/**/*"]
}
skipLibCheck: true speeds up type checking by skipping declaration files in node_modules. This trades thoroughness for speed.
Agent Considerations¶
Type checking runs slower than linting, so it fits better as a periodic check rather than a post-edit hook. Run it:
- Before committing
- After completing a logical unit of work
- When the agent reports type-related errors
For per-edit validation, rely on faster tools like Biome for syntax and style issues.