unthrown 5.0.0-beta.3 → 5.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,9 +7,14 @@
7
7
  [API Reference](https://btravstack.github.io/unthrown/api/core/)
8
8
 
9
9
  ```sh
10
- pnpm add unthrown
10
+ pnpm add unthrown ts-pattern
11
11
  ```
12
12
 
13
+ `ts-pattern` (`^5`) is a peer dependency — it powers the exhaustive error
14
+ matchers and is re-exported as `match` / `P`. Declaring it a peer means you own
15
+ the single copy, so `import { P } from "ts-pattern"` composes with unthrown's
16
+ matchers.
17
+
13
18
  ```ts
14
19
  import { fromPromise, P, TaggedError } from "unthrown";
15
20
 
@@ -22,7 +27,7 @@ const user = fromPromise(fetchUser(id), (cause, defect) =>
22
27
 
23
28
  const status = await user.match({
24
29
  ok: () => 200,
25
- err: (matcher) => matcher.with(P._, () => 404), // `err` takes the exhaustive matcher
30
+ errCases: (matcher) => matcher.with(P._, () => 404), // `errCases` takes the exhaustive matcher
26
31
  defect: () => 500,
27
32
  });
28
33
  ```
@@ -34,11 +39,15 @@ const status = await user.match({
34
39
  to triage each failure into a modeled error or a defect.
35
40
  - **Tagged errors** — `TaggedError(tag)` + `tag(t)`, folded exhaustively through
36
41
  `match`'s ts-pattern error matcher.
37
- - One tiny runtime dependency (`ts-pattern`), ESM-first, dual CJS/ESM.
42
+ - One tiny runtime dependency (`ts-pattern`, a peer you share), ESM-first, dual
43
+ CJS/ESM.
38
44
 
39
45
  See the [full documentation](https://btravstack.github.io/unthrown/) for the guide
40
46
  and complete API.
41
47
 
48
+ **Upgrading from 4.x?** See
49
+ [Upgrade from 4.x to 5.0](https://btravstack.github.io/unthrown/how-to/upgrade-to-v5).
50
+
42
51
  ## License
43
52
 
44
53
  [MIT](https://github.com/btravstack/unthrown/blob/main/LICENSE) © Benoit TRAVERS
package/dist/index.cjs CHANGED
@@ -152,7 +152,7 @@ var Res = class {
152
152
  return defectRes(cause);
153
153
  }
154
154
  }
155
- mapErr(f) {
155
+ mapErrCases(f) {
156
156
  if (this.tag !== "Err") return passThrough(this);
157
157
  try {
158
158
  const out = runMatch(f, this.error);
@@ -162,7 +162,7 @@ var Res = class {
162
162
  return defectRes(cause);
163
163
  }
164
164
  }
165
- flatMapErr(f) {
165
+ flatMapErrCases(f) {
166
166
  if (this.tag !== "Err") return passThrough(this);
167
167
  try {
168
168
  const out = runMatch(f, this.error);
@@ -173,7 +173,7 @@ var Res = class {
173
173
  return defectRes(cause);
174
174
  }
175
175
  }
176
- recoverErr(f) {
176
+ recoverErrCases(f) {
177
177
  if (this.tag !== "Err") return passThrough(this);
178
178
  try {
179
179
  const out = runMatch(f, this.error);
@@ -183,7 +183,7 @@ var Res = class {
183
183
  return defectRes(cause);
184
184
  }
185
185
  }
186
- tapErr(f) {
186
+ tapErrCases(f) {
187
187
  if (this.tag !== "Err") return this;
188
188
  try {
189
189
  runMatch(f, this.error);
@@ -192,7 +192,7 @@ var Res = class {
192
192
  return observerThrowToDefect(cause, this.error);
193
193
  }
194
194
  }
195
- flatTapErr(f) {
195
+ flatTapErrCases(f) {
196
196
  if (this.tag !== "Err") return this;
197
197
  try {
198
198
  const r = runMatch(f, this.error);
@@ -232,7 +232,7 @@ var Res = class {
232
232
  match(cases) {
233
233
  switch (this.tag) {
234
234
  case "Ok": return cases.ok(this.value);
235
- case "Err": return cases.err((0, ts_pattern.match)(this.error)).run();
235
+ case "Err": return cases.errCases((0, ts_pattern.match)(this.error)).run();
236
236
  case "Defect": return cases.defect(this.cause);
237
237
  }
238
238
  }
@@ -357,7 +357,8 @@ function defectRes(cause) {
357
357
  * isResult(Ok(1).toAsync()); // => false (an AsyncResult is not a Result)
358
358
  *
359
359
  * const x: unknown = Ok(1);
360
- * if (isResult(x)) x.match({ ok: () => 1, err: () => 0, defect: () => -1 });
360
+ * if (isResult(x))
361
+ * x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
361
362
  * ```
362
363
  *
363
364
  * @category Guards
@@ -410,7 +411,7 @@ function runMatch(f, error) {
410
411
  return f((0, ts_pattern.match)(error), defect).run();
411
412
  }
412
413
  /**
413
- * A throw inside a *failure observer* (`tapErr` / `tapDefect` / `flatTapErr`)
414
+ * A throw inside a *failure observer* (`tapErrCases` / `tapDefect` / `flatTapErrCases`)
414
415
  * must not destroy the failure being observed — that is the exact place (e.g. a
415
416
  * failing error-logger) where losing the underlying failure hurts most. The
416
417
  * resulting Defect aggregates both: `errors[0]` is the observer's throw,
@@ -547,7 +548,7 @@ var AsyncRes = class AsyncRes {
547
548
  }
548
549
  }));
549
550
  }
550
- mapErr(f) {
551
+ mapErrCases(f) {
551
552
  return new AsyncRes(this.#promise.then((r) => {
552
553
  if (r.tag !== "Err") return passThrough(r);
553
554
  try {
@@ -559,7 +560,7 @@ var AsyncRes = class AsyncRes {
559
560
  }
560
561
  }));
561
562
  }
562
- flatMapErr(f) {
563
+ flatMapErrCases(f) {
563
564
  return new AsyncRes(this.#promise.then(async (r) => {
564
565
  if (r.tag !== "Err") return passThrough(r);
565
566
  try {
@@ -573,7 +574,7 @@ var AsyncRes = class AsyncRes {
573
574
  }
574
575
  }));
575
576
  }
576
- recoverErr(f) {
577
+ recoverErrCases(f) {
577
578
  return new AsyncRes(this.#promise.then((r) => {
578
579
  if (r.tag !== "Err") return passThrough(r);
579
580
  try {
@@ -585,7 +586,7 @@ var AsyncRes = class AsyncRes {
585
586
  }
586
587
  }));
587
588
  }
588
- tapErr(f) {
589
+ tapErrCases(f) {
589
590
  return new AsyncRes(this.#promise.then((r) => {
590
591
  if (r.tag !== "Err") return r;
591
592
  try {
@@ -596,7 +597,7 @@ var AsyncRes = class AsyncRes {
596
597
  }
597
598
  }));
598
599
  }
599
- flatTapErr(f) {
600
+ flatTapErrCases(f) {
600
601
  return new AsyncRes(this.#promise.then(async (r) => {
601
602
  if (r.tag !== "Err") return passThrough(r);
602
603
  try {
@@ -1342,7 +1343,7 @@ const AsyncResult = {
1342
1343
  * *narrowing* structured field.
1343
1344
  *
1344
1345
  * `_tag` is the discriminant matched by {@link tag} in the error combinators
1345
- * (`result.mapErr((matcher) => matcher.with(tag("NotFound"), …))`) and in
1346
+ * (`result.mapErrCases((matcher) => matcher.with(tag("NotFound"), …))`) and in
1346
1347
  * `match`; `Error.name` is the human-facing label in stack traces and logs. By
1347
1348
  * default they coincide, but
1348
1349
  * they can be **decoupled** with `options.name` — so a tag can be namespaced for
@@ -1416,7 +1417,7 @@ function TaggedError(tag, options) {
1416
1417
  *
1417
1418
  * @example
1418
1419
  * ```ts
1419
- * result.mapErr((matcher) =>
1420
+ * result.mapErrCases((matcher) =>
1420
1421
  * matcher
1421
1422
  * .with(tag("NotFound"), () => new NotFoundException())
1422
1423
  * .with(tag("Conflict"), (e) => new ConflictException(e.key)),
package/dist/index.d.cts CHANGED
@@ -99,7 +99,7 @@ type MatchOut<M> = M extends ExhaustiveMatch<infer O> ? O : never;
99
99
  type MatchErrOut<M> = Exclude<MatchOut<M>, Defect>;
100
100
  /**
101
101
  * The fluent method surface every {@link Result} variant carries — the
102
- * combinators (`map`, `flatMap`, `mapErr`, `match`, `get`, …), documented one
102
+ * combinators (`map`, `flatMap`, `mapErrCases`, `match`, `get`, …), documented one
103
103
  * per entry below. Factored out so the three variants ({@link OkView},
104
104
  * {@link ErrView}, {@link DefectView}) can each intersect it; {@link AsyncResult}
105
105
  * mirrors this surface with async signatures.
@@ -272,7 +272,7 @@ type ResultMethods<out T, out E> = {
272
272
  * @remarks
273
273
  * The callback receives `match(error)` (an {@link ErrMatcher}) and the
274
274
  * injected `defect` helper. Chain `.with(pattern, handler)` and **return the
275
- * un-terminated builder** — `mapErr` calls `.exhaustive()` itself, so a
275
+ * un-terminated builder** — `mapErrCases` calls `.exhaustive()` itself, so a
276
276
  * missing case is a compile error at the call site (there is no `.exhaustive()`
277
277
  * to forget, and no way to slip in `.otherwise()`). The outgoing error type is
278
278
  * the union of the branch returns with the `Defect` arm subtracted
@@ -287,7 +287,7 @@ type ResultMethods<out T, out E> = {
287
287
  * @typeParam M - the exhaustive builder the callback returns.
288
288
  * @param f - builds the match over the error (returns the un-terminated builder).
289
289
  */
290
- mapErr<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T, MatchErrOut<M>>;
290
+ mapErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T, MatchErrOut<M>>;
291
291
  /**
292
292
  * Sequence from an `Err` by producing another `Result` — the error-channel
293
293
  * mirror of {@link ResultMethods.flatMap | flatMap}, **matching the error
@@ -300,7 +300,7 @@ type ResultMethods<out T, out E> = {
300
300
  * @typeParam M - the exhaustive builder the callback returns.
301
301
  * @param f - builds the match; each branch produces a fallback `Result`.
302
302
  */
303
- flatMapErr<M extends ExhaustiveMatch<Result$1<unknown, unknown> | Defect>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T | OkOf<MatchOut<M>>, ErrOf<MatchOut<M>>>;
303
+ flatMapErrCases<M extends ExhaustiveMatch<Result$1<unknown, unknown> | Defect>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T | OkOf<MatchOut<M>>, ErrOf<MatchOut<M>>>;
304
304
  /**
305
305
  * Recover from an `Err` by producing a success value, emptying the error
306
306
  * channel — **matching the error exhaustively** ({@link ErrMatcher}). Pairs
@@ -315,7 +315,7 @@ type ResultMethods<out T, out E> = {
315
315
  * @typeParam M - the exhaustive builder the callback returns.
316
316
  * @param f - builds the match; each branch produces a success value.
317
317
  */
318
- recoverErr<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T | MatchErrOut<M>, never>;
318
+ recoverErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): Result$1<T | MatchErrOut<M>, never>;
319
319
  /**
320
320
  * Run a side effect on the error — **matched exhaustively** ({@link ErrMatcher})
321
321
  * — and pass the `Result` through unchanged.
@@ -330,11 +330,11 @@ type ResultMethods<out T, out E> = {
330
330
  * because the branch results are discarded, a returned `Promise` would float
331
331
  * unobserved and its rejection would vanish. A failable
332
332
  * `Result`-returning effect belongs in
333
- * {@link ResultMethods.flatTapErr | flatTapErr}.
333
+ * {@link ResultMethods.flatTapErrCases | flatTapErrCases}.
334
334
  *
335
335
  * @param f - builds the match; branch returns are ignored.
336
336
  */
337
- tapErr<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): Result$1<T, E>;
337
+ tapErrCases<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): Result$1<T, E>;
338
338
  /**
339
339
  * Run a **failable** side effect on the error, keeping the original error but
340
340
  * threading the effect's own error — **matched exhaustively**
@@ -353,7 +353,7 @@ type ResultMethods<out T, out E> = {
353
353
  * @typeParam M - the exhaustive builder the callback returns.
354
354
  * @param f - builds the match; each branch is a failable effect (its `Ok` is ignored).
355
355
  */
356
- flatTapErr<E2>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<Result$1<unknown, E2>>): Result$1<T, E | E2>;
356
+ flatTapErrCases<E2>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<Result$1<unknown, E2>>): Result$1<T, E | E2>;
357
357
  /**
358
358
  * Recover from a `Defect` — the **only** combinator that can touch one.
359
359
  *
@@ -382,7 +382,7 @@ type ResultMethods<out T, out E> = {
382
382
  * Run a side effect on **any failure** — `Err` or `Defect` — and pass the
383
383
  * `Result` through unchanged. The one cross-channel observer, for the shared
384
384
  * "it went KO" concern (logging, metrics, rollback) that would otherwise be
385
- * duplicated across {@link ResultMethods.tapErr | tapErr} and
385
+ * duplicated across {@link ResultMethods.tapErrCases | tapErrCases} and
386
386
  * {@link ResultMethods.tapDefect | tapDefect}.
387
387
  *
388
388
  * @remarks
@@ -393,7 +393,7 @@ type ResultMethods<out T, out E> = {
393
393
  * treat it opaquely for a shared logger. Runs on `Err` and `Defect`; `Ok`
394
394
  * passes through. It **observes without consuming**: the failure flows on
395
395
  * unchanged — to also recover, use
396
- * {@link ResultMethods.recoverErr | recoverErr} /
396
+ * {@link ResultMethods.recoverErrCases | recoverErrCases} /
397
397
  * {@link ResultMethods.recoverDefect | recoverDefect} (deliberately separate
398
398
  * acts) or {@link ResultMethods.match | match} at the edge. If `f` throws, the
399
399
  * result is a `Defect` whose cause is an `AggregateError` of `[thrown,
@@ -411,25 +411,26 @@ type ResultMethods<out T, out E> = {
411
411
  * is typically the single place a pipeline is handled at the edge — mapping
412
412
  * `Ok`/`Err`/`Defect` to (for example) 2xx / 4xx / 5xx with no `try`/`catch`.
413
413
  *
414
- * The `err` handler does not take a single blanket callback: it receives
414
+ * The `errCases` handler does not take a single blanket callback: it receives
415
415
  * `match(error)` (an {@link ErrMatcher}) and **matches the error exhaustively**,
416
- * exactly like the error combinators. Chain `.with(pattern, handler)` and
417
- * **return the un-terminated builder** — `match` calls `.exhaustive()` itself,
418
- * so a missing case is a compile error at the call site (no `.exhaustive()` to
419
- * forget). Use `.with(P._, …)` for a uniform catch-all. Unlike the combinators
420
- * the branches receive **no `defect` helper** — `match` is total elimination
421
- * to a value, with no `Defect` output channel; the `defect` case handles a
422
- * `Result` that already carries one. (A `Result` is also a discriminated
423
- * union — for richer whole-`Result` matching, `match(result).with(…)`.)
416
+ * exactly like the error combinators — which is why the key carries the same
417
+ * `…Cases` suffix. Chain `.with(pattern, handler)` and **return the
418
+ * un-terminated builder** — `match` calls `.exhaustive()` itself, so a missing
419
+ * case is a compile error at the call site (no `.exhaustive()` to forget). Use
420
+ * `.with(P._, …)` for a uniform catch-all. Unlike the combinators the branches
421
+ * receive **no `defect` helper** — `match` is total elimination to a value,
422
+ * with no `Defect` output channel; the `defect` case handles a `Result` that
423
+ * already carries one. (A `Result` is also a discriminated union — for richer
424
+ * whole-`Result` matching, `match(result).with(…)`.)
424
425
  *
425
426
  * @typeParam ROk - the `ok` handler return type.
426
427
  * @typeParam RDefect - the `defect` handler return type.
427
- * @typeParam M - the exhaustive builder the `err` handler returns.
428
- * @param cases - the `ok`/`defect` handlers plus the `err` matcher builder.
428
+ * @typeParam M - the exhaustive builder the `errCases` handler returns.
429
+ * @param cases - the `ok`/`defect` handlers plus the `errCases` matcher builder.
429
430
  */
430
431
  match<ROk, RDefect, M extends ExhaustiveMatch<unknown>>(cases: {
431
432
  ok: (value: T) => ROk;
432
- err: (matcher: ErrMatcher<E>) => M;
433
+ errCases: (matcher: ErrMatcher<E>) => M;
433
434
  defect: (cause: unknown) => RDefect;
434
435
  }): ROk | RDefect | MatchOut<M>;
435
436
  /**
@@ -437,7 +438,7 @@ type ResultMethods<out T, out E> = {
437
438
  *
438
439
  * @remarks
439
440
  * Compiles only when the error channel is empty (`E = never`) — eliminate
440
- * modeled errors first (`match` / `recoverErr` / `flatMapErr`), or reach for the
441
+ * modeled errors first (`match` / `recoverErrCases` / `flatMapErrCases`), or reach for the
441
442
  * `getOr` / `getOrElse` / `getOrNull` / `getOrUndefined` family (which
442
443
  * recover an `Err`). If you get a `'this' context` type error here, that is
443
444
  * the gate: the receiver still has a non-`never` error channel.
@@ -501,8 +502,8 @@ type ResultMethods<out T, out E> = {
501
502
  * `throw` behind a method, so a `no-throw` lint rule can ban raw throws while
502
503
  * this one sanctioned extraction remains — _not_ to replace principled
503
504
  * handling. When you can keep the error a value, prefer
504
- * {@link ResultMethods.match | match} / {@link ResultMethods.recoverErr | recoverErr} /
505
- * {@link ResultMethods.flatMapErr | flatMapErr}.
505
+ * {@link ResultMethods.match | match} / {@link ResultMethods.recoverErrCases | recoverErrCases} /
506
+ * {@link ResultMethods.flatMapErrCases | flatMapErrCases}.
506
507
  *
507
508
  * Type-gated as the **complement** of {@link ResultMethods.get | get}: it
508
509
  * compiles only when the error channel is **non-empty** (`E` is not `never`) —
@@ -515,7 +516,7 @@ type ResultMethods<out T, out E> = {
515
516
  * @throws the modeled `error` on `Err`; re-throws the original `cause` on a
516
517
  * `Defect` (a panic, like the rest of the `getOr…` family).
517
518
  */
518
- getOrThrow(this: [E] extends [never] ? never : Result$1<T, E>): T;
519
+ getOrThrow(this: [E] extends [never] ? "unthrown: getOrThrow is unnecessary here — the Err channel is empty (E = never), so there is nothing to throw. Use get() instead." : Result$1<T, E>): T;
519
520
  /** Whether this result is `Ok` — narrows `this` to its {@link OkView} on `true`. */
520
521
  isOk(): this is OkView<T, E>;
521
522
  /** Whether this result is `Err` — narrows `this` to its {@link ErrView} on `true`. */
@@ -637,7 +638,7 @@ type FailureView<E, T = never> = ErrView<E, T> | DefectView<T, E>;
637
638
  *
638
639
  * const message = half(10).match({
639
640
  * ok: (n) => `got ${n}`,
640
- * err: (matcher) => matcher.with(P._, (e) => `failed: ${e}`),
641
+ * errCases: (matcher) => matcher.with(P._, (e) => `failed: ${e}`),
641
642
  * defect: (cause) => `bug: ${String(cause)}`,
642
643
  * });
643
644
  * ```
@@ -666,7 +667,7 @@ type Awaitable<out T> = {
666
667
  };
667
668
  /**
668
669
  * The async method surface every {@link AsyncResult} carries — the combinators
669
- * (`map`, `flatMap`, `mapErr`, `match`, `get`, …) with their asynchronous
670
+ * (`map`, `flatMap`, `mapErrCases`, `match`, `get`, …) with their asynchronous
670
671
  * signatures, documented one per entry below. The async mirror of
671
672
  * {@link ResultMethods}: each entry links its synchronous counterpart and states
672
673
  * only the async delta.
@@ -756,24 +757,24 @@ type AsyncResultMethods<out T, out E> = {
756
757
  /** Boolean form of the asynchronous {@link ResultMethods.ensure | ensure} — validates without refining, keeping `T`. */
757
758
  ensure<E2>(predicate: (value: T) => boolean, onFail: (value: T) => E2 & NotThenable<E2>): AsyncResult$1<T, E | E2>;
758
759
  /**
759
- * Asynchronous {@link ResultMethods.mapErr | mapErr} — the same exhaustive
760
+ * Asynchronous {@link ResultMethods.mapErrCases | mapErrCases} — the same exhaustive
760
761
  * {@link ErrMatcher} form; the combinator calls `.exhaustive()`.
761
762
  */
762
- mapErr<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T, MatchErrOut<M>>;
763
+ mapErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T, MatchErrOut<M>>;
763
764
  /**
764
- * Asynchronous {@link ResultMethods.flatMapErr | flatMapErr} — the same
765
+ * Asynchronous {@link ResultMethods.flatMapErrCases | flatMapErrCases} — the same
765
766
  * exhaustive {@link ErrMatcher} form. Unlike the sync form, a branch may
766
767
  * return a `Result` **or** an `AsyncResult`.
767
768
  */
768
- flatMapErr<M extends ExhaustiveMatch<Result$1<unknown, unknown> | AsyncResult$1<unknown, unknown> | Defect>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | OkOf<MatchOut<M>> | AsyncOkOf<MatchOut<M>>, ErrOf<MatchOut<M>> | AsyncErrOf<MatchOut<M>>>;
769
+ flatMapErrCases<M extends ExhaustiveMatch<Result$1<unknown, unknown> | AsyncResult$1<unknown, unknown> | Defect>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | OkOf<MatchOut<M>> | AsyncOkOf<MatchOut<M>>, ErrOf<MatchOut<M>> | AsyncErrOf<MatchOut<M>>>;
769
770
  /**
770
- * Asynchronous {@link ResultMethods.recoverErr | recoverErr} — the same
771
+ * Asynchronous {@link ResultMethods.recoverErrCases | recoverErrCases} — the same
771
772
  * exhaustive {@link ErrMatcher} form. Branches are synchronous; a throw
772
773
  * becomes a `Defect`.
773
774
  */
774
- recoverErr<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | MatchErrOut<M>, never>;
775
+ recoverErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | MatchErrOut<M>, never>;
775
776
  /**
776
- * Asynchronous {@link ResultMethods.tapErr | tapErr}. `f` is synchronous; if it
777
+ * Asynchronous {@link ResultMethods.tapErrCases | tapErrCases}. `f` is synchronous; if it
777
778
  * throws, the result is a `Defect` whose cause is an `AggregateError` of
778
779
  * `[thrown, original failure]` — observing a failure never destroys it. An
779
780
  * async branch is rejected at compile time ({@link NotThenable} on the
@@ -781,18 +782,18 @@ type AsyncResultMethods<out T, out E> = {
781
782
  * would float unobserved. The
782
783
  * {@link AsyncResultMethods.tap | tap} fire-and-forget caveat applies here
783
784
  * too — a failable effect belongs in
784
- * {@link AsyncResultMethods.flatTapErr | flatTapErr}.
785
+ * {@link AsyncResultMethods.flatTapErrCases | flatTapErrCases}.
785
786
  */
786
- tapErr<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): AsyncResult$1<T, E>;
787
+ tapErrCases<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): AsyncResult$1<T, E>;
787
788
  /**
788
- * Asynchronous {@link ResultMethods.flatTapErr | flatTapErr} — the
789
+ * Asynchronous {@link ResultMethods.flatTapErrCases | flatTapErrCases} — the
789
790
  * error-channel mirror of `flatTap`. `f` may return a `Result` **or** an
790
791
  * `AsyncResult`; its `Ok` value is discarded, an `Err`/`Defect` from `f`
791
792
  * threads through, and if `f` throws, the result is a `Defect` whose cause is
792
793
  * an `AggregateError` of `[thrown, original failure]` — observing a failure
793
794
  * never destroys it.
794
795
  */
795
- flatTapErr<E2>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<Result$1<unknown, E2> | AsyncResult$1<unknown, E2>>): AsyncResult$1<T, E | E2>;
796
+ flatTapErrCases<E2>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<Result$1<unknown, E2> | AsyncResult$1<unknown, E2>>): AsyncResult$1<T, E | E2>;
796
797
  /**
797
798
  * Asynchronous {@link ResultMethods.recoverDefect | recoverDefect}. `f` may
798
799
  * return a `Result` or an `AsyncResult`.
@@ -816,12 +817,12 @@ type AsyncResultMethods<out T, out E> = {
816
817
  tapFailure<R>(f: (failure: FailureView<E, T>) => R & NotThenable<R>): AsyncResult$1<T, E>;
817
818
  /**
818
819
  * Asynchronous {@link ResultMethods.match | match}. Handlers are synchronous
819
- * (the `err` handler returns an exhaustive {@link ErrMatcher} builder, no
820
+ * (the `errCases` handler returns an exhaustive {@link ErrMatcher} builder, no
820
821
  * `defect` helper); resolves to a `Promise` of the folded value.
821
822
  */
822
823
  match<ROk, RDefect, M extends ExhaustiveMatch<unknown>>(cases: {
823
824
  ok: (value: T) => ROk;
824
- err: (matcher: ErrMatcher<E>) => M;
825
+ errCases: (matcher: ErrMatcher<E>) => M;
825
826
  defect: (cause: unknown) => RDefect;
826
827
  }): Promise<ROk | RDefect | MatchOut<M>>;
827
828
  /**
@@ -850,7 +851,7 @@ type AsyncResultMethods<out T, out E> = {
850
851
  * on a `Defect`), rather than throwing synchronously. Gated the same way: it
851
852
  * compiles only when the error channel is non-empty (`E` is not `never`).
852
853
  */
853
- getOrThrow(this: [E] extends [never] ? never : AsyncResult$1<T, E>): Promise<T>;
854
+ getOrThrow(this: [E] extends [never] ? "unthrown: getOrThrow is unnecessary here — the Err channel is empty (E = never), so there is nothing to throw. Use get() instead." : AsyncResult$1<T, E>): Promise<T>;
854
855
  };
855
856
  /**
856
857
  * The asynchronous counterpart of {@link Result}: an awaitable wrapper carrying
@@ -864,7 +865,7 @@ type AsyncResultMethods<out T, out E> = {
864
865
  * {@link fromPromise} forces. To do further async work, re-enter through a
865
866
  * qualified boundary and compose it: `ar.flatMap((v) => fromPromise(work(v),
866
867
  * qualify))`. The eliminators (`get`, …) return promises; the binds
867
- * (`flatMap`, `flatTap`, `flatMapErr`, `recoverDefect`) additionally accept an
868
+ * (`flatMap`, `flatTap`, `flatMapErrCases`, `recoverDefect`) additionally accept an
868
869
  * `AsyncResult`. Its combinators are documented one per entry on
869
870
  * {@link AsyncResultMethods}.
870
871
  *
@@ -1173,7 +1174,8 @@ declare class GetError<E = unknown> extends Error {
1173
1174
  * isResult(Ok(1).toAsync()); // => false (an AsyncResult is not a Result)
1174
1175
  *
1175
1176
  * const x: unknown = Ok(1);
1176
- * if (isResult(x)) x.match({ ok: () => 1, err: () => 0, defect: () => -1 });
1177
+ * if (isResult(x))
1178
+ * x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
1177
1179
  * ```
1178
1180
  *
1179
1181
  * @category Guards
@@ -1396,7 +1398,7 @@ declare function fromSafeThrowable<A extends unknown[], T>(fn: (...args: A) => T
1396
1398
  * // when fetchUser rejects with NotFoundError: user is Err("not_found")
1397
1399
  * ```
1398
1400
  */
1399
- declare function fromPromise<T, R>(promise: Promise<T> | (() => Promise<T>), qualify: (cause: unknown, defect: (cause: unknown) => Defect) => R, ..._guard: [R] extends [never] ? [] : [R] extends [PromiseLike<unknown>] ? ["unthrown: qualify must be synchronous — its Promise would land in E un-triaged"] : []): AsyncResult$1<T, Exclude<R, Defect>>;
1401
+ declare function fromPromise<T, R>(promise: Promise<T> | (() => Promise<T>), qualify: (cause: unknown, defect: (cause: unknown) => Defect) => R, ..._guard: [Extract<R, PromiseLike<unknown>>] extends [never] ? [] : ["unthrown: qualify must be synchronous — its Promise would land in E un-triaged"]): AsyncResult$1<T, Exclude<R, Defect>>;
1400
1402
  /**
1401
1403
  * Wrap a `Promise` asserted **not** to fail in any modeled way: any rejection
1402
1404
  * becomes a `Defect`.
@@ -1583,7 +1585,7 @@ declare const Result: {
1583
1585
  * alias. Its fluent combinators (`map`, `flatMap`, `match`, `get`, …) are
1584
1586
  * documented one per entry on {@link ResultMethods} — the shared method surface
1585
1587
  * every variant carries. For "which one do I reach for?", see the
1586
- * [Choosing a combinator](/guide/choosing-a-combinator) guide.
1588
+ * [Choosing a combinator](/reference/combinators) guide.
1587
1589
  *
1588
1590
  * @category Facade
1589
1591
  */
@@ -1634,7 +1636,7 @@ declare const AsyncResult: {
1634
1636
  * `AsyncResult` carries the async fluent surface; its combinators (`map`,
1635
1637
  * `flatMap`, `match`, `get`, …) are documented one per entry — with their
1636
1638
  * async signatures — on {@link AsyncResultMethods}. For "which one do I reach
1637
- * for?", see the [Choosing a combinator](/guide/choosing-a-combinator) guide.
1639
+ * for?", see the [Choosing a combinator](/reference/combinators) guide.
1638
1640
  *
1639
1641
  * @category Facade
1640
1642
  */
@@ -1704,7 +1706,7 @@ type TaggedErrorConstructor<Tag extends string> = {
1704
1706
  * *narrowing* structured field.
1705
1707
  *
1706
1708
  * `_tag` is the discriminant matched by {@link tag} in the error combinators
1707
- * (`result.mapErr((matcher) => matcher.with(tag("NotFound"), …))`) and in
1709
+ * (`result.mapErrCases((matcher) => matcher.with(tag("NotFound"), …))`) and in
1708
1710
  * `match`; `Error.name` is the human-facing label in stack traces and logs. By
1709
1711
  * default they coincide, but
1710
1712
  * they can be **decoupled** with `options.name` — so a tag can be namespaced for
@@ -1756,7 +1758,7 @@ declare function TaggedError<Tag extends string>(tag: Tag, options?: {
1756
1758
  *
1757
1759
  * @example
1758
1760
  * ```ts
1759
- * result.mapErr((matcher) =>
1761
+ * result.mapErrCases((matcher) =>
1760
1762
  * matcher
1761
1763
  * .with(tag("NotFound"), () => new NotFoundException())
1762
1764
  * .with(tag("Conflict"), (e) => new ConflictException(e.key)),
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/defect.ts","../src/types.ts","../src/constructors.ts","../src/core.ts","../src/do.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;cAEM;;;;;;;;;;;;;;;KAgBM;YACA;WACD;;;;;;;;;;KCRC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e;aAAuB;aAA0B;MACnE,oBAAoB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8Dd,YAAY,oBAC1B,KAAK,KACL;WAAqB;IACpB,uBAAuB;;;;;;;;;;;;;;;;;;;;;iBA8DV,UAAU,oBAAoB,OAAO;EAAQ,MAAM"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/defect.ts","../src/types.ts","../src/constructors.ts","../src/core.ts","../src/do.ts","../src/interop.ts","../src/facade.ts","../src/tagged.ts"],"mappings":";;cAEM;;;;;;;;;;;;;;;KAgBM;YACA;WACD;;;;;;;;;;KCRC,SAAS,QAAQ,WAAW,IAAI,EAAE;;;;;;;;;KAUlC,MAAM,GAAG,kBAAkB,KAAK,SAAS,KAAK,GAAG,iBAAiB,KAAK,IAAI;;;;;;;;;;;;;;;;;KAkB3E,YAAY,MAAM,YAAY;;;;;;;;;;;;;;KAiB9B,WAAW,KAAK,kBAAkB,QAAM;;;;;;;;;;;KAYxC,gBAAgB;EAC1B,gBAAgB;EAChB,WAAW;;;;;;;KAQD,SAAS,KAAK,UAAU,sBAAsB,KAAK;;;;;;;;;KAUnD,YAAY,KAAK,QAAQ,SAAS,IAAI;;;;;;;;;;;;;;;;;KAkBtC,kBAAkB,OAAO;;;;;;;;;;;;EAYnC,IAAI,GAAG,IAAI,OAAO,MAAM,IAAI,YAAY,KAAK,SAAO,GAAG;;;;;;;;;;;EAWvD,QAAQ,GAAG,IAAI,IAAI,OAAO,MAAM,SAAO,GAAG,MAAM,SAAO,GAAG,IAAI;;;;;;;;;;;;;;;;;;;EAmB9D,IAAI,GAAG,IAAI,OAAO,MAAM,IAAI,YAAY,KAAK,SAAO,GAAG;;;;;;;;;;;;;;;;;EAiBvD,QAAQ,IAAI,IAAI,OAAO,MAAM,kBAAgB,MAAM,SAAO,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;EAoBjE,KAAK,kBAAkB,GAAG,IAC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