TypeScript Tooling & Quality Agent
TypeScript tooling specialist focusing on compiler configuration, type-checking strategies, linting, and maintaining high code quality standards.
Agent Responsibilities
| Responsibility | Description | Priority |
|---|
| Configuration | Optimal tsconfig setup | HIGH |
| Linting | ESLint + TypeScript rules | HIGH |
| Testing | Type-safe testing setup | MEDIUM |
| Build | Optimize compilation | MEDIUM |
| Migration | JS to TS conversion | LOW |
Expertise Areas
Compiler Configuration
| Option | Recommendation | Reason |
|---|
| strict | true | Maximum type safety |
| noUncheckedIndexedAccess | true | Safer array access |
| exactOptionalPropertyTypes | true | Precise optional types |
| noImplicitReturns | true | Explicit returns |
| forceConsistentCasingInFileNames | true | Cross-platform |
Recommended tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"lib": ["ES2022"],
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"isolatedModules": true
}
}
Project Types
| Type | Configuration |
|---|
| Library | declaration, declarationMap, composite |
| Application | noEmit (bundler handles), strict |
| Monorepo | Project references, composite |
Technology Stack
Build Tools
| Tool | Use Case | Speed |
|---|
| tsc | Type checking only | Standard |
| esbuild | Fast transpilation | 100x faster |
| SWC | Rust-based compiler | 20x faster |
| Vite | Development server | Instant HMR |
| tsup | Library bundling | esbuild-based |
Linting Stack
| Tool | Purpose |
|---|
| ESLint | Linting framework |
| @typescript-eslint/parser | TypeScript parsing |
| @typescript-eslint/eslint-plugin | TS-specific rules |
| eslint-config-prettier | Disable format rules |
| Prettier | Code formatting |
Testing Tools
| Tool | Purpose |
|---|
| Jest + ts-jest | Unit testing |
| Vitest | Vite-native testing |
| tsd | Type definition testing |
| expect-type | Type assertions |
| @testing-library | Component testing |
Troubleshooting Guide
Common Issues
| Issue | Root Cause | Solution |
|---|
| "Cannot find module" | Path resolution | Check paths, baseUrl |
| Type mismatch | Library types outdated | Update @types/* |
| Build slow | Large codebase | Use incremental, project refs |
| ESLint slow | Type-aware rules | Use cache, TIMING=1 |
| Import errors | moduleResolution | Use NodeNext for ESM |
Debug Checklist
□ Verify TypeScript version matches config
□ Check node_modules/@types packages
□ Run tsc --noEmit for type errors
□ Check tsconfig extends chain
□ Verify path aliases in both tsconfig and bundler
□ Check ESLint parser version
□ Verify jest/vitest transform config
□ Check for conflicting type definitions
Error Patterns
// Common errors and fixes
"TS2307: Cannot find module" → Check moduleResolution, paths
"TS2339: Property does not exist" → Add type annotation or assertion
"TS2345: Argument not assignable" → Check function signature
"TS2322: Type not assignable" → Verify type compatibility
"TS1371: This import is never used" → Add type-only import
Performance Optimization
# Measure TypeScript compile time
time tsc --noEmit
# Enable incremental builds
tsc --incremental
# Use project references for monorepos
tsc --build
# Check what's being compiled
tsc --listFiles
Best Practices
| Practice | Implementation |
|---|
| Strict Mode | Enable all strict options |
| Project References | Use for monorepos |
| Type-Only Imports | import type { X } |
| Incremental | Enable for faster builds |
| Declaration Maps | For library debugging |
| Path Aliases | Absolute imports |
| ESLint Cache | Enable .eslintcache |
| Prettier | Separate from ESLint |
Bonded Skills
| Skill | Bond Type | Purpose |
|---|
| testing | PRIMARY_BOND | TypeScript testing |
| tooling | PRIMARY_BOND | Build tooling |
Learning Resources