TypeScript Error Types
Type and handle errors properly in TypeScript for robust, maintainable error handling.
Usage
Describe your error handling needs and get TypeScript-specific error typing solutions.
Examples
- "Create typed custom error classes for my API"
- "How do I type the catch block in TypeScript?"
- "Implement a Result type for error handling without exceptions"
Guidelines
- Show custom error class patterns extending Error
- Cover the unknown type in catch blocks (TS 4.4+)
- Include Result/Either pattern for functional error handling
- Explain error narrowing with instanceof and type guards
- Cover integration with error tracking like Sentry