# better-result > Typed, composable error handling for TypeScript with Result values, tagged errors, and generator composition. ## Docs - [A better Result type for TypeScript](https://better-result.dev/): Lightweight Result type for TypeScript with generator-based composition. ## Get started - [Installation](https://better-result.dev/getting-started/installation): Install better-result and import its ESM-only TypeScript API. - [Quickstart](https://better-result.dev/getting-started/quickstart): Build a small typed workflow with TaggedError, Result.try, generator composition, and exhaustive handling. - [Mental model](https://better-result.dev/getting-started/mental-model): Understand Result values, expected failures, defects, narrowing, and boundary design. ## Core Result API - [Creating Results](https://better-result.dev/core/creating-results): Create Ok and Err values and safely capture synchronous or asynchronous exceptions. - [Narrowing and matching](https://better-result.dev/core/narrowing-and-matching): Inspect Result status, use type guards, and fold both branches into one output. - [Generator composition](https://better-result.dev/core/generator-composition): Compose Results linearly with yield*, automatic short-circuiting, and inferred error unions. - [Transforming and chaining](https://better-result.dev/core/transforming-and-chaining): Use map, mapError, andThen, and recovery while preserving precise success and error unions. - [Async operations and retries](https://better-result.dev/core/async-and-retries): Capture promises, retry bounded failures, add backoff and jitter, and propagate cancellation. - [Collections](https://better-result.dev/core/collections): Collect, await, partition, and flatten Result values while preserving tuple and union types. - [Observing Results](https://better-result.dev/core/observing): Add logging, tracing, and metrics without changing success or error values. - [Extracting values](https://better-result.dev/core/extracting-values): Leave Result safely with match or a fallback, and understand when unwrap throws. ## Typed errors - [Tagged errors](https://better-result.dev/errors/tagged-errors): Define discriminated Error subclasses with typed properties, guards, JSON output, causes, and generator support. - [Matching errors](https://better-result.dev/errors/matching-errors): Handle tagged-error unions exhaustively or partially with inferred handler return unions. - [Panic and defects](https://better-result.dev/errors/panic-and-defects): Understand which failures throw Panic, how to report them, and why they do not widen Result error types. ## Serialization - [Result codecs](https://better-result.dev/serialization/result-codecs): Validate and transform both Result branches across RPC, persistence, queues, and server-action boundaries. ## Guides - [Application patterns](https://better-result.dev/guides/application-patterns): Place Result boundaries, translate errors, compose workflows, and keep framework concerns at the edge. - [Testing Result code](https://better-result.dev/guides/testing): Test success, every expected error variant, short-circuiting, retries, and Panic behavior through public interfaces. - [Documentation for agents](https://better-result.dev/guides/agents): Give coding agents precise better-result context through agents.txt, llms.txt, Markdown exports, and portable repository skills. ## API reference - [Result API](https://better-result.dev/reference/result): Reference for every constructor, guard, combinator, generator helper, collection helper, and codec on Result. - [Ok and Err API](https://better-result.dev/reference/ok-and-err): Reference for Result variants, discriminants, payloads, instance methods, and iterator behavior. - [Error API](https://better-result.dev/reference/errors): Reference for TaggedError, exhaustive and partial matching, UnhandledException, codec errors, and Panic. - [Exported types](https://better-result.dev/reference/exported-types): Reference for Result, inference helpers, tagged error helpers, codec types, serialized envelopes, retry context, and Standard Schema types. ## Migration - [Migrate from 2.x](https://better-result.dev/migration/from-2): Upgrade tagged error syntax, serialization, recovery inference, matching, collections, and retry configuration.