Rust-grade ✧ Result<T, E> for TypeScript
ZeroThrow makes every error path visible and typed, eliminating hidden exceptions and async surprises.
// with ZeroThrow
function readJSON(f: string): ZT.Result<Config, ZT.ZeroError> {
return ZT.try(() => fs.readFileSync(f, "utf8"))
.andThen(txt => ZT.try(() => JSON.parse(txt)));
}
pkg | status | what it does |
---|---|---|
@zerothrow/core |
alpha (dev-preview) | Result types + combinators |
@zerothrow/react |
🚧 in-progress | Suspense & error-boundary hooks |
@zerothrow/eslint-plugin |
📝 planned | no-throw rule & autofix helpers |
@zerothrow/logger-pino |
📝 planned | Structured JSON serializers |
@zerothrow/cli |
📝 planned | Codemods & migrations |
# until beta we publish under the `alpha` tag
npm install @zerothrow/core@alpha
import { ZT } from "@zerothrow/core";
const safeParse = ZT.fromThrowable(
JSON.parse,
() => "INVALID_JSON"
);
safeParse('{"ok":true}')
.map(x => x.ok)
.unwrapOr(false); // → true
🚨 Pain | 💡 Relief |
---|---|
Production crashes from hidden throw |
All error paths are in the type signature |
Pyramid of try/catch |
Fluid map , andThen , match combinators |
Slow stack unwinding | Result path ~90× faster than throw/catch on error |
Team glue-code divergence | ESLint plugin (coming) enforces one pattern |
Q3 '25 | Q4 '25 | Q1 '26 |
---|---|---|
Alpha core stable, dog-food in prod |
Beta React, logger, ESLint, CLI |
1.0 docs site, Deno & edge builds |
(Semantic-versioning guarantees start at beta.)
We ♥ early adopters. Ways to help:
- Try
@zerothrow/core
and open defects - Join the discussion on patterns & naming in Discussions
- ⭐ Star the repo – motivation fuel
Full contributing guide will land before beta.
Licensed under MIT © 2025 J. Kirby Ross & contributors
Exceptions fly; Results flow.