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
| Package | Purpose |
|---|---|
antithrow | The core Result, Ok, Err, Pending, and composition utilities. |
@antithrow/std | Non-throwing wrappers around standard globals (fetch, JSON, base64, URI helpers). |
@antithrow/node | Non-throwing wrappers around Node.js APIs (fs/promises, os). |
@antithrow/standard-schema | Bridge Standard Schema validators (Zod, Valibot, ArkType) to antithrow results. |
@antithrow/eslint-plugin | ESLint rules that enforce correct Result usage. |
Install
- npm
- Yarn
- pnpm
- Bun
npm install antithrow
yarn add antithrow
pnpm add antithrow
bun add antithrow