Skip to main content

antithrow

Rust-style Result<T, E> types for type-safe error handling in TypeScript, without throwing exceptions.

Where to start

The documentation is organised into four sections, each with a different purpose.

  • Tutorial — a single end-to-end lesson. Start here if you have never used antithrow before.
  • How-to guides — short, goal-oriented recipes. Go here when you know what you want to achieve.
  • Reference — the complete API surface for every package. Go here to look up a specific export.
  • Explanation — the reasoning behind antithrow's design. Go here to understand why things are the way they are.

Packages

PackagePurpose
antithrowThe core Result, Ok, Err, Pending, and composition utilities.
@antithrow/stdNon-throwing wrappers around standard globals (fetch, JSON, base64, URI helpers).
@antithrow/nodeNon-throwing wrappers around Node.js APIs (fs/promises, os).
@antithrow/standard-schemaBridge Standard Schema validators (Zod, Valibot, ArkType) to antithrow results.
@antithrow/eslint-pluginESLint rules that enforce correct Result usage.

Install

npm install antithrow