# dmmulroy/better-result

Lightweight Result type for TypeScript with generator-based composition.

Repository: https://github.com/dmmulroy/better-result
Canonical: https://ross.abutalabs.com/products/better-result
Language: TypeScript
License: MIT
License Family: permissive
Topics: error-handling, result-type, rust, try-catch, typescript
Last push: 2026-08-23T17:37:03+00:00

## Health v2 (maintenance only)
Score: 82/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 97, longevity 16
- inputs: {"age_days": 237, "days_push": 10, "days_rel": 22, "gap_med": 2.0, "n_releases_24m": 21}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1931, forks 42 (observed 2026-08-28T04:05:55.903991+00:00)

## What it is
A lightweight TypeScript library providing a typed Result<T, E> type that makes expected failures explicit in function signatures. It supports generator-based composition with yield* for writing multi-step workflows that short-circuit on the first error, plus tagged errors, async support, and retry utilities.

## Use cases
- handle errors explicitly in TypeScript instead of try-catch
- write multi-step async workflows that stop on first failure
- define typed tagged error classes for domain failures
- validate input like parsing a port number with typed errors
- retry flaky async operations with error handling
- map and chain results with ok/err matching

## When to choose
- you want Rust-style Result semantics in TypeScript with zero runtime dependencies
- you prefer explicit error types over thrown exceptions for expected failures
- you want generator-based do-notation for sequential error-prone steps
- you need an ESM-only, lightweight alternative to heavier effect libraries

## When to avoid
- your codebase relies on exception-based error handling and cannot adopt Result patterns
- you need a full effect system with dependency injection, resources, or structured concurrency
- you target TypeScript older than 5.4 or need CommonJS support

## Facets
- artifact type: library
- maturity: active
- function: error-handling
- domain: developer-tools, web-development, programming-languages
- platform: bun, cross-platform
- tags: result-type, typescript, functional-programming, generator-composition, tagged-errors, esm-only, zero-dependencies, nodejs, deno

## Member repositories
- dmmulroy/better-result (main) score 82

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:55.903991+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:08:42.181156+00:00, confidence not recorded.
  - readme: https://github.com/dmmulroy/better-result (fetched 2026-08-28T04:05:55.903991+00:00, sha 488ec1f680cb)
  - registry_npm: https://registry.npmjs.org/better-result (fetched 2026-08-29T10:48:31.664612+00:00, sha 26f157e79ed1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
