What problem does it solve?
Replace ad-hoc exceptions and try/catch with explicit, type-safe error values so developers cannot accidentally ignore failures and must handle errors at call sites.
Core Features & Use Cases
- Represent fallible operations as Result (sync) or ResultAsync (async) values to encode success or failure in the type system.
- Compose and chain operations with map, mapErr, andThen, and use safeTry generator-based do-notation to eliminate boilerplate early returns.
- Wrap synchronous throwers and Promise-returning SDKs with Result.fromThrowable and ResultAsync.fromThrowable or fromPromise, combine parallel operations with short-circuit or collect-all semantics, and enforce consumption with an eslint plugin.
- Real-world use case: wrap database repository work in ResultAsync<AppError> and let web routers consume results and convert errors to WebAppError without try/catch.
Quick Start
Wrap a Promise-returning SDK call with ResultAsync.fromThrowable and handle the returned ResultAsync with match to convert errors into your application error type.