ts-chas gives you the building blocks for writing TypeScript that is explicit about errors, safe at runtime, and easy to compose. Instead of scattered try/catch blocks and null checks, you get a suite of tightly integrated modules: Result, Guard, Task, Option, TaggedErrors, and Pipe/Flow that work nicely together.
Installation
Add ts-chas to your project in under a minute.
Quick Start
See the key patterns with working examples.
Core Concepts
Understand Result, Guard, Task, and more.
API Reference
Browse the full public API surface.
What’s inside
Result & ResultAsync
Replace
try/catch with explicit, type-safe Result<T, E> and ResultAsync<T, E> that carry error types in the signature.Guard
Chainable runtime type validators that double as TypeScript type predicates, with built-in schema parsing and Standard Schema v1 support.
Task
Lazy async pipelines with retries, timeouts, circuit breakers, throttling, and caching; all composable and cancellable.
Tagged Errors
Discriminated error unions built on native
Error objects, enabling exhaustive pattern matching across your call stack.Option
Model the presence or absence of a value explicitly, with the same rich API as
Result.Pipe & Flow
Compose functions into readable, reusable data pipelines with full TypeScript type inference.
Get started
Explore the concepts
Read through Core Concepts to understand how the modules fit together, or jump straight to a Quick Start example.