Type-safe error handling

Functional error handling for TypeScript

A lightweight, zero-dependency Result type inspired by Rust. Handle success and failure with clarity and type safety.

import {Result, Ok, Err} from "resultify"
const result = Result.ok(42)
if (result.isOk()) {console.log(result.unwrap()) }

Why Resultify?

Type-Safe

Enforces explicit handling of success and error cases. No more undefined surprises.

Zero Dependencies

Lightweight and minimal. No bloat, just pure functional error handling.

Functional API

Inspired by Rust. Map, unwrap, and propagate errors with clarity.

Custom Error Types

Support for custom error classes for richer, more expressive error handling.

Simple API

Create

Result.ok(value)
Result.err(error)

Check

.isOk()
.isError()

Extract

.unwrap()
.unwrapError()

Transform with Map

The map method lets you transform the value inside a Result without unwrapping it. Perfect for functional programming chains.

const result = Result.ok(5)
const newResult = result
.map(n => n * 2)
.map(n => n + 1)
// Result.ok(11)

Chain Operations

Compose multiple transformations in a clean, readable way without intermediate unwraps.

Error Propagation

Errors automatically propagate through the chain. Only success paths execute transformations.

Ready to handle errors better?

Start using Resultify in your TypeScript projects today.

© 2025 Resultify. MIT License.