What problem does it solve?
Prevents runtime errors and invalid program states by promoting type-first design, clear domain modelling, and disciplined runtime validation practices for TypeScript and JavaScript codebases.
Core Features & Use Cases
- Make illegal states unrepresentable: use discriminated unions, branded types, and const assertions to ensure only valid combinations are possible at compile time.
- Exhaustive handling and safer patterns: advocate for exhaustive switch checks, never-based guards, and simplified complex types for clearer reasoning and maintainability.
- Runtime validation with Zod: define schemas as the single source of truth, infer TypeScript types from schemas, and choose safeParse versus parse appropriately for input validation and trust boundaries.
- Use Case: validate and normalize API responses and user-submitted forms, convert them into strongly typed domain models, and reduce production crashes from malformed data.
Quick Start
Ask the assistant to review a TypeScript file and apply typescript-best-practices by introducing discriminated unions, branded types where appropriate, and Zod schemas for any external input.