Skip to content

API Reference

This reference is generated from the source with TypeDoc at build time.

Packages

  • unthrown — the core Result / AsyncResult types, constructors (Ok, Err — a Defect has no constructor; it arises only at boundaries), guards, boundary interop (fromNullable, fromThrowable, fromSafeThrowable, fromPromise, fromSafePromise), aggregation (all / allFromDict), the tagged-error factory (TaggedError), and the built-in match / P (P.tag included) that drive the exhaustive error matcher.
  • @unthrown/vitest — custom Vitest matchers (toBeOk, toBeOkWith, toBeErr, toBeErrWith, toBeErrTagged, toBeDefect).
  • @unthrown/effect — bijective Result ↔ Exit bridges (Effect has a genuine defect channel, Cause.die), plus toEither with a mandatory onDefect.
  • @unthrown/neverthrowto*/from* bridges to neverthrow's Result/ResultAsync; every to* takes a mandatory onDefect (neverthrow has no defect channel).
  • @unthrown/boxedto*/from* bridges to Boxed's Result/Future; every to* takes a mandatory onDefect.
  • @unthrown/standard-schemafromSchema / fromSchemaAsync: run any Standard Schema validator (Zod, Valibot, ArkType) into a Result with the validation issues as the modeled error.
  • @unthrown/orpc — the oRPC (v2) bridge: handlerResult / .result() for Result-returning procedure handlers, createResultClient / fromCall for an AsyncResult client, with the inferable ORPCError union as the modeled error.
  • @unthrown/prisma — a Prisma Client extension ($extends(unthrownPrisma)) adding try* variants of every model operation (each an AsyncResult whose error channel is exactly the P-codes it can raise), plus $tryTransaction and tryPaginate(...).withCursor(...).
  • @unthrown/drizzle — a Drizzle ORM Postgres database that replaces the stock one: every query resolves to an AsyncResult, with the five integrity-constraint SQLSTATEs as tagged errors, reads declaring E = never, and Result-driven transactions.

@unthrown/oxlint (the recommended rules no-ambiguous-error-type, no-catch-all-pattern, no-unhandled-result, no-unused-matcher, prefer-async-result, and the opt-in no-throw / prefer-ensure) has no generated API page — it is documented in the Linting guide.

Released under the MIT License.