Skip to main content

@hex-di ecosystem

Result

Type-Safe Error Handling for TypeScript

Get Started
npm install @hex-di/result

:: features

Why Result?

No More Try-Catch

Errors are values, not exceptions. Pattern match on success and failure paths with full type safety.

Railway-Oriented

Chain operations with map, flatMap, and recover. Errors propagate automatically through the pipeline.

Exhaustive Matching

TypeScript ensures you handle every error variant. No silent failures, no forgotten catch blocks.

Zero Runtime Cost

Lightweight wrapper with no dependencies. Result<T, E> compiles away to simple objects.

Composable

Combine multiple Results with combine, all, and sequence. Build complex flows from simple parts.

Framework Agnostic

Works everywhere TypeScript runs. No decorators, no reflection, no magic.

:: ecosystem

Part of the HexDI Stack

Result integrates seamlessly with the HexDI dependency injection ecosystem. Use it standalone or compose it with other libraries.

Explore HexDI