API Reference
This reference is generated from the source with TypeDoc at build time.
Packages
- unthrown — the core
Result/AsyncResulttypes, constructors (Ok,Errand the pre-liftedOkAsync/ErrAsync— aDefecthas no constructor; it arises only at boundaries), do-notation (Do/DoAsync), guards, boundary interop (fromNullable,fromThrowable,fromSafeThrowable,fromPromise,fromSafePromise,fromExecutor), aggregation (fail-fastall/allFromDictand the accumulatingvalidateAll/validateAllFromDict, each with an…Asynctwin), the tagged-error factory (TaggedError), and the built-inmatch/P(P.tagincluded) that drive the exhaustive error matcher. - @unthrown/vitest — custom Vitest matchers (
toBeOk,toBeOkWith,toBeErr,toBeErrWith,toBeErrTagged,toBeDefect,toBeDefectWith). - @unthrown/saga —
SagaAsync(): a sequence of steps carrying compensating undos, unwound LIFO the moment one fails, with the failure returned unchanged. - @unthrown/effect — bijective
Result ↔ Exitbridges (Effect has a genuine defect channel,Cause.die), plustoResultwith a mandatoryonDefect. - @unthrown/neverthrow —
to*/from*bridges to neverthrow'sResult/ResultAsync; everyto*takes a mandatoryonDefect(neverthrow has no defect channel). - @unthrown/boxed —
to*/from*bridges to Boxed'sResult/Future; everyto*takes a mandatoryonDefect. - @unthrown/standard-schema —
fromSchema/fromSchemaAsync: run any Standard Schema validator (Zod, Valibot, ArkType) into aResultwith the validation issues as the modeled error. - @unthrown/orpc — the oRPC (v2) bridge:
handlerResult/.result()forResult-returning procedure handlers,createResultClient/fromCallfor anAsyncResultclient, with the inferableORPCErrorunion as the modeled error. - @unthrown/pothos — a Pothos plugin:
resultField/resultConnectionresolved by aResult, each failure answered as the typed refusal its case maps to in the field's result union. - @unthrown/prisma — a Prisma Client extension (
$extends(unthrownPrisma)) addingtry*variants of every model operation (each anAsyncResultwhose error channel is exactly the P-codes it can raise), plus$tryTransactionandtryPaginate(...).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 declaringE = never, andResult-driven transactions.
@unthrown/oxlint has no generated API page — it is documented in the Linting guide. Its recommended preset enables no-ambiguous-error-type, no-async-result-race, no-catch-all-pattern, no-unhandled-result, no-unused-matcher and prefer-async-result; the opt-in rules are no-get-or-throw, no-throw and prefer-pre-lifted.