unthrown 5.0.0-beta.6 → 5.0.0-beta.8

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
@@ -14,7 +14,7 @@ No peer dependencies — the exhaustive error matcher is built-in and exported a
14
14
  `match` / `P` / `tag`.
15
15
 
16
16
  ```ts
17
- import { fromPromise, P, TaggedError } from "unthrown";
17
+ import { fromPromise, tag, TaggedError } from "unthrown";
18
18
 
19
19
  class NotFound extends TaggedError("NotFound") {} // our modeled domain failure
20
20
  class NotFoundError extends Error {} // what `fetchUser` rejects with on a 404
@@ -25,7 +25,8 @@ const user = fromPromise(fetchUser(id), (cause, defect) =>
25
25
 
26
26
  const status = await user.match({
27
27
  ok: () => 200,
28
- errCases: (matcher) => matcher.with(P._, () => 404), // `errCases` takes the exhaustive matcher
28
+ // `errCases` takes the exhaustive matcher — every case of E named:
29
+ errCases: (matcher) => matcher.with(tag("NotFound"), () => 404),
29
30
  defect: () => 500,
30
31
  });
31
32
  ```
package/dist/index.cjs CHANGED
@@ -93,6 +93,13 @@ var MatcherImpl = class {
93
93
  }
94
94
  return this;
95
95
  }
96
+ /**
97
+ * Type-level only — pinning the output type has no runtime meaning, so the
98
+ * builder is returned unchanged (as ts-pattern does).
99
+ */
100
+ returnType() {
101
+ return this;
102
+ }
96
103
  exhaustive() {
97
104
  if (this.#matched) return this.#result;
98
105
  throw new NonExhaustiveError(this.#value);
@@ -110,8 +117,10 @@ Object.freeze(MatcherImpl.prototype);
110
117
  * @remarks
111
118
  * This is unthrown's own matcher (the former ts-pattern re-export): the same
112
119
  * call-site shape, with exhaustiveness computed by plain `Exclude` over the
113
- * builder's `Remaining` parameter. A `P._` catch-all is provably exhaustive
114
- * even over an unresolved generic input.
120
+ * builder's `Remaining` parameter. Name every case of the input union; the
121
+ * `P._` catch-all is the escape hatch, and is provably exhaustive even over an
122
+ * unresolved generic input — one of the two cases it is irreplaceable for (see
123
+ * {@link P}).
115
124
  *
116
125
  * @category Constructors
117
126
  */
@@ -126,9 +135,18 @@ const universal = pattern(() => true);
126
135
  /**
127
136
  * The pattern namespace (unthrown's own; the former ts-pattern `P`):
128
137
  *
129
- * - `P._` / `P.any` — the universal catch-all. Matches anything, and (because
130
- * its phantom type is `unknown`) makes the builder provably exhaustive even
131
- * when the matched input is an unresolved type parameter.
138
+ * - `P._` / `P.any` — the universal catch-all, and an **escape hatch** rather
139
+ * than the default: matching the error channel means naming its cases, so
140
+ * reach for this only where they cannot be named. Matches anything, and
141
+ * (because its phantom type is `unknown`) makes the builder provably
142
+ * exhaustive even when the matched input is an unresolved type parameter.
143
+ * Two situations are legitimate: a **helper generic in `E`**, where no arm
144
+ * list can prove exhaustiveness against an unresolved type parameter; and an
145
+ * **`E` that is a single type**, not a union of cases (a validator's issues
146
+ * array, say), where one arm _is_ the enumeration. `@unthrown/oxlint`'s
147
+ * `no-catch-all-pattern` (in its `recommended` preset) flags every other use;
148
+ * keep the deliberate ones behind a targeted `oxlint-disable` saying which of
149
+ * the two it is.
132
150
  * - `P.instanceOf(Cls)` — an `instanceof` check, narrowing to the class
133
151
  * instance type (for union members that are not tagged, e.g. a third-party
134
152
  * error class).
@@ -334,7 +352,8 @@ var Res = class {
334
352
  tapErrCases(f) {
335
353
  if (this.tag !== "Err") return this;
336
354
  try {
337
- runMatch(f, this.error);
355
+ const out = runMatch(f, this.error);
356
+ if (isDefectMarker(out)) return observerThrowToDefect(out.cause, this.error);
338
357
  return this;
339
358
  } catch (cause) {
340
359
  return observerThrowToDefect(cause, this.error);
@@ -344,6 +363,7 @@ var Res = class {
344
363
  if (this.tag !== "Err") return this;
345
364
  try {
346
365
  const r = runMatch(f, this.error);
366
+ if (isDefectMarker(r)) return observerThrowToDefect(r.cause, this.error);
347
367
  if (!isResult(r)) return nonResultCallbackDefect();
348
368
  return r.tag === "Ok" ? this : passThrough(r);
349
369
  } catch (cause) {
@@ -498,7 +518,7 @@ function defectRes(cause) {
498
518
  *
499
519
  * @example
500
520
  * ```ts
501
- * import { isResult, Ok } from "unthrown";
521
+ * import { isResult, Ok, P } from "unthrown";
502
522
  *
503
523
  * isResult(Ok(1)); // => true
504
524
  * isResult({ tag: "Ok" }); // => false (look-alike, wrong prototype)
@@ -506,6 +526,9 @@ function defectRes(cause) {
506
526
  *
507
527
  * const x: unknown = Ok(1);
508
528
  * if (isResult(x))
529
+ * // `E` is `unknown` here — an untyped boundary has no cases to enumerate,
530
+ * // so the `P._` escape hatch is the only arm that can terminate the match:
531
+ * // oxlint-disable-next-line unthrown/no-catch-all-pattern -- untyped boundary: `E` is `unknown`
509
532
  * x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
510
533
  * ```
511
534
  *
@@ -559,16 +582,21 @@ function runMatch(f, error) {
559
582
  return f(match(error), defect).run();
560
583
  }
561
584
  /**
562
- * A throw inside a *failure observer* (`tapErrCases` / `tapDefect` / `flatTapErrCases`)
563
- * must not destroy the failure being observed — that is the exact place (e.g. a
564
- * failing error-logger) where losing the underlying failure hurts most. The
565
- * resulting Defect aggregates both: `errors[0]` is the observer's throw,
566
- * `errors[1]` the original failure.
585
+ * A throw inside a *failure observer* (`tapErrCases` / `tapDefect` /
586
+ * `tapFailure` / `flatTapErrCases`) must not destroy the failure being observed
587
+ * — that is the exact place (e.g. a failing error-logger) where losing the
588
+ * underlying failure hurts most. The resulting Defect aggregates both:
589
+ * `errors[0]` is the observer's own failure, `errors[1]` the original failure.
590
+ *
591
+ * An observer branch returning the injected `defect(cause)` marker
592
+ * (`tapErrCases` / `flatTapErrCases`) takes the same route: it is the
593
+ * lint-clean, expression-position form of a `throw` (Thesis #5), so it must not
594
+ * behave differently from one.
567
595
  *
568
596
  * @internal
569
597
  */
570
598
  function observerThrowToDefect(thrown, original) {
571
- return defectRes(new AggregateError([thrown, original], "unthrown: a failure-observer callback threw; errors[0] is the callback's throw, errors[1] the original failure"));
599
+ return defectRes(new AggregateError([thrown, original], "unthrown: a failure-observer callback failed; errors[0] is the callback's failure (a throw, or a deliberate defect), errors[1] the original failure"));
572
600
  }
573
601
  /**
574
602
  * Validate that a `bind`/`let` scope is a real (non-null) object before merging a
@@ -738,7 +766,8 @@ var AsyncRes = class AsyncRes {
738
766
  return new AsyncRes(this.#promise.then((r) => {
739
767
  if (r.tag !== "Err") return r;
740
768
  try {
741
- runMatch(f, r.error);
769
+ const out = runMatch(f, r.error);
770
+ if (isDefectMarker(out)) return observerThrowToDefect(out.cause, r.error);
742
771
  return r;
743
772
  } catch (cause) {
744
773
  return observerThrowToDefect(cause, r.error);
@@ -749,7 +778,9 @@ var AsyncRes = class AsyncRes {
749
778
  return new AsyncRes(this.#promise.then(async (r) => {
750
779
  if (r.tag !== "Err") return passThrough(r);
751
780
  try {
752
- const inner = await runMatch(f, r.error);
781
+ const out = runMatch(f, r.error);
782
+ if (isDefectMarker(out)) return observerThrowToDefect(out.cause, r.error);
783
+ const inner = await out;
753
784
  if (!isResult(inner)) return nonResultCallbackDefect();
754
785
  return inner.tag === "Ok" ? passThrough(r) : passThrough(inner);
755
786
  } catch (cause) {
package/dist/index.d.cts CHANGED
@@ -1,3 +1,24 @@
1
+ //#region src/defect.d.ts
2
+ declare const DEFECT: unique symbol;
3
+ /**
4
+ * The opaque marker a `qualify` function returns to triage a cause as
5
+ * **unexpected**.
6
+ *
7
+ * @remarks
8
+ * `qualify` (passed to {@link fromPromise} / {@link fromThrowable}) returns
9
+ * `E | Defect`: either a modeled domain error, or a `Defect` produced by the
10
+ * injected `defect` helper to say "this failure is not modeled". A `Defect` is
11
+ * opaque — it carries the original cause for the boundary to convert into the
12
+ * third runtime state of a `Result`. It is **not** a public value; the only way
13
+ * to mint one is the `defect` helper the boundary passes to `qualify`.
14
+ *
15
+ * @internal
16
+ */
17
+ type Defect = {
18
+ readonly [DEFECT]: true;
19
+ readonly cause: unknown;
20
+ };
21
+ //#endregion
1
22
  //#region src/matcher.d.ts
2
23
  /**
3
24
  * Cross-copy brand for `P.*` pattern objects: `Symbol.for` yields the same
@@ -52,6 +73,47 @@ type MatchedOf<Pt> = Pt extends PatternMatcher<infer M> ? M : Pt extends object
52
73
  type NonExhaustive<Remaining> = {
53
74
  readonly "unthrown: this match is not exhaustive — add a `.with(…)` for the remaining cases": Remaining;
54
75
  };
76
+ /**
77
+ * The "no output type declared" sentinel for a builder's `Declared` parameter.
78
+ * A `unique symbol` so no user type can collide with it. Declaration-only —
79
+ * `tsc` emits it into the `.d.ts` without it needing to be exported.
80
+ *
81
+ * @internal
82
+ */
83
+ declare const UNSET: unique symbol;
84
+ /** @internal */
85
+ type Unset = typeof UNSET;
86
+ /**
87
+ * A branch handler's return position: free inference (`O2`) while the builder
88
+ * is unpinned — today's behaviour, unchanged — or the declared type once
89
+ * `.returnType<R>()` has pinned it.
90
+ *
91
+ * `Defect` stays legal under a pin: the injected `defect` helper is the
92
+ * sanctioned deliberate `Err`→`Defect` form (Thesis #5), and `Defect` is not a
93
+ * nameable public type, so `returnType<R | Defect>()` cannot be spelled. The
94
+ * marker is subtracted from the output by {@link PinnedOut} — the same net
95
+ * result as the unpinned `Exclude<O, Defect>`, decided up front.
96
+ *
97
+ * @internal
98
+ */
99
+ type BranchReturn<Declared, O2> = [Declared] extends [Unset] ? O2 : Declared | Defect;
100
+ /**
101
+ * The builder's output: the accumulated union of branch returns while
102
+ * unpinned, or the declared type once pinned.
103
+ *
104
+ * @internal
105
+ */
106
+ type PinnedOut<Declared, O> = [Declared] extends [Unset] ? O : Declared;
107
+ /**
108
+ * The diagnostic type of `.returnType` on a builder that already has an output
109
+ * to contradict — an arm has contributed a return type, or it is already
110
+ * pinned: not callable, so the mistake is caught where it is written.
111
+ *
112
+ * @internal
113
+ */
114
+ type PinTooLate = {
115
+ readonly "unthrown: `.returnType<R>()` must come before any arm produces an output, and only once": true;
116
+ };
55
117
  /**
56
118
  * The match builder over an input union `E`. `Remaining` tracks the cases not
57
119
  * yet covered by a `.with(…)` arm; `O` accumulates the branch output union.
@@ -63,16 +125,22 @@ type NonExhaustive<Remaining> = {
63
125
  * @typeParam O - the union of branch return types so far.
64
126
  * @category Types
65
127
  */
66
- type Matcher<E, Remaining, O> = {
128
+ type Matcher<E, Remaining, O, Declared = Unset> = {
67
129
  /**
68
- * The catch-all arm: `.with(P._, handler)` / `.with(P.any, handler)`. A
69
- * **state transition**, not a computation — it returns `Matcher<E, never, …>`
70
- * with the remaining cases literally `never`, so the builder is provably
71
- * exhaustive even when `E` is an unresolved type parameter (a lazily-deferred
72
- * `Exclude<E, unknown>` would not resolve there). This is what lets a
73
- * boundary helper generic in `E` terminate with the catch-all (issue #145).
130
+ * The catch-all arm: `.with(P._, handler)` / `.with(P.any, handler)` — the
131
+ * wildcard **escape hatch**, not the way to handle a concrete error union
132
+ * (name those cases; `@unthrown/oxlint`'s `no-catch-all-pattern`, in its
133
+ * `recommended` preset, flags the wildcard).
134
+ *
135
+ * It is a **state transition**, not a computation — it returns
136
+ * `Matcher<E, never, …>` with the remaining cases literally `never`, so the
137
+ * builder is provably exhaustive even when `E` is an unresolved type
138
+ * parameter (a lazily-deferred `Exclude<E, unknown>` would not resolve
139
+ * there). That is what makes it irreplaceable for a helper generic in `E`:
140
+ * it can terminate a match no arm list could (issue #145) — one of the two
141
+ * sanctioned uses (see {@link P}).
74
142
  */
75
- with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => O2): Matcher<E, never, O | O2>;
143
+ with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => BranchReturn<Declared, O2>): Matcher<E, never, O | O2, Declared>;
76
144
  /**
77
145
  * Add an arm: one or more patterns sharing a single handler (grouped
78
146
  * patterns — `matcher.with(tag("A"), tag("B"), handler)`). The handler
@@ -80,20 +148,48 @@ type Matcher<E, Remaining, O> = {
80
148
  * `Remaining`, so cases already handled by earlier arms are excluded); the
81
149
  * matched cases are subtracted from `Remaining`.
82
150
  */
83
- with<const Pts extends readonly [unknown, ...unknown[]], O2>(...args: [...patterns: Pts, handler: (value: Extract<Remaining, MatchedOf<Pts[number]>>) => O2]): Matcher<E, Exclude<Remaining, MatchedOf<Pts[number]>>, O | O2>;
151
+ with<const Pts extends readonly [unknown, ...unknown[]], O2>(...args: [...patterns: Pts, handler: (value: Extract<Remaining, MatchedOf<Pts[number]>>) => BranchReturn<Declared, O2>]): Matcher<E, Exclude<Remaining, MatchedOf<Pts[number]>>, O | O2, Declared>;
152
+ /**
153
+ * Declare the match's output type up front: every subsequent branch handler
154
+ * is checked against `R`, and the match evaluates to `R` instead of the
155
+ * union of whatever the branches happened to return.
156
+ *
157
+ * @remarks
158
+ * Reach for it when the output is **decided by a signature rather than by
159
+ * the branches** — most sharply in code generic in `E`, where the fold's type
160
+ * has to be declared. It also stops a drifting branch from silently widening
161
+ * the outgoing type, reports the mismatch **on the offending branch**, and
162
+ * gives branch returns a contextual type (so object literals need no
163
+ * annotation).
164
+ *
165
+ * A branch may still return the injected `defect` helper's marker; the defect
166
+ * channel is not part of the declared output.
167
+ *
168
+ * Callable **before any arm has produced an output**, and only once
169
+ * (mirroring ts-pattern's up-front pin): once there is an inferred output for
170
+ * the pin to contradict — or the builder is already pinned — this is typed as
171
+ * a non-callable diagnostic. In practice that means calling it directly after
172
+ * `match(…)`; the gate is about output rather than position, so an earlier arm
173
+ * whose handler returns `never` (it always throws) contributes nothing and
174
+ * does not close it — sound, since a `never` branch can contradict no declared
175
+ * type. A no-op at runtime.
176
+ *
177
+ * @typeParam R - the declared output type of every branch.
178
+ */
179
+ returnType: [O] extends [never] ? [Declared] extends [Unset] ? <R>() => Matcher<E, Remaining, never, R> : PinTooLate : PinTooLate;
84
180
  /**
85
181
  * Terminate the match. Typed callable only when every case is covered
86
182
  * (`Remaining` is `never`); otherwise it is a branded diagnostic object
87
183
  * naming the remaining cases, and the builder fails the `ExhaustiveMatch`
88
184
  * constraint at the combinator call site.
89
185
  */
90
- exhaustive: [Remaining] extends [never] ? () => O : NonExhaustive<Remaining>;
186
+ exhaustive: [Remaining] extends [never] ? () => PinnedOut<Declared, O> : NonExhaustive<Remaining>;
91
187
  /**
92
188
  * Execute the match (the combinators call this; it runs `.exhaustive()`).
93
189
  * A value with no matching arm throws {@link NonExhaustiveError} —
94
190
  * unreachable for well-typed callers.
95
191
  */
96
- run(): O;
192
+ run(): PinnedOut<Declared, O>;
97
193
  };
98
194
  /**
99
195
  * Thrown by `.run()` / `.exhaustive()` when no arm matched the value. For
@@ -118,8 +214,10 @@ declare class NonExhaustiveError extends Error {
118
214
  * @remarks
119
215
  * This is unthrown's own matcher (the former ts-pattern re-export): the same
120
216
  * call-site shape, with exhaustiveness computed by plain `Exclude` over the
121
- * builder's `Remaining` parameter. A `P._` catch-all is provably exhaustive
122
- * even over an unresolved generic input.
217
+ * builder's `Remaining` parameter. Name every case of the input union; the
218
+ * `P._` catch-all is the escape hatch, and is provably exhaustive even over an
219
+ * unresolved generic input — one of the two cases it is irreplaceable for (see
220
+ * {@link P}).
123
221
  *
124
222
  * @category Constructors
125
223
  */
@@ -127,9 +225,18 @@ declare function match<const E>(value: E): Matcher<E, E, never>;
127
225
  /**
128
226
  * The pattern namespace (unthrown's own; the former ts-pattern `P`):
129
227
  *
130
- * - `P._` / `P.any` — the universal catch-all. Matches anything, and (because
131
- * its phantom type is `unknown`) makes the builder provably exhaustive even
132
- * when the matched input is an unresolved type parameter.
228
+ * - `P._` / `P.any` — the universal catch-all, and an **escape hatch** rather
229
+ * than the default: matching the error channel means naming its cases, so
230
+ * reach for this only where they cannot be named. Matches anything, and
231
+ * (because its phantom type is `unknown`) makes the builder provably
232
+ * exhaustive even when the matched input is an unresolved type parameter.
233
+ * Two situations are legitimate: a **helper generic in `E`**, where no arm
234
+ * list can prove exhaustiveness against an unresolved type parameter; and an
235
+ * **`E` that is a single type**, not a union of cases (a validator's issues
236
+ * array, say), where one arm _is_ the enumeration. `@unthrown/oxlint`'s
237
+ * `no-catch-all-pattern` (in its `recommended` preset) flags every other use;
238
+ * keep the deliberate ones behind a targeted `oxlint-disable` saying which of
239
+ * the two it is.
133
240
  * - `P.instanceOf(Cls)` — an `instanceof` check, narrowing to the class
134
241
  * instance type (for union members that are not tagged, e.g. a third-party
135
242
  * error class).
@@ -149,27 +256,6 @@ declare const P: Readonly<{
149
256
  number: PatternMatcher<number>;
150
257
  }>;
151
258
  //#endregion
152
- //#region src/defect.d.ts
153
- declare const DEFECT: unique symbol;
154
- /**
155
- * The opaque marker a `qualify` function returns to triage a cause as
156
- * **unexpected**.
157
- *
158
- * @remarks
159
- * `qualify` (passed to {@link fromPromise} / {@link fromThrowable}) returns
160
- * `E | Defect`: either a modeled domain error, or a `Defect` produced by the
161
- * injected `defect` helper to say "this failure is not modeled". A `Defect` is
162
- * opaque — it carries the original cause for the boundary to convert into the
163
- * third runtime state of a `Result`. It is **not** a public value; the only way
164
- * to mint one is the `defect` helper the boundary passes to `qualify`.
165
- *
166
- * @internal
167
- */
168
- type Defect = {
169
- readonly [DEFECT]: true;
170
- readonly cause: unknown;
171
- };
172
- //#endregion
173
259
  //#region src/types.d.ts
174
260
  /**
175
261
  * Flatten an intersection into a single object literal so accumulated `bind` /
@@ -430,9 +516,15 @@ type ResultMethods<out T, out E> = {
430
516
  * to a `Defect` and drops it from `E`. Runs only on `Err`; `Ok` and `Defect`
431
517
  * pass through. A branch that throws also becomes a `Defect`.
432
518
  *
433
- * `.with(P._, …)` is the deliberate uniform/catch-all (it makes the match
434
- * exhaustive). Match on anything the matcher supports — `_tag`, `code`,
435
- * structural shape, guards, or grouped patterns `.with(a, b, handler)`.
519
+ * **Name every case.** Match on anything the matcher supports — `_tag`,
520
+ * `code`, structural shape, guards — and group the cases that share a handler
521
+ * with `.with(a, b, handler)`. `.with(P._, …)` is the wildcard **escape
522
+ * hatch**, not the default: it makes any match exhaustive, so it also absorbs
523
+ * every case `E` grows later. Two uses are sanctioned — a helper generic in
524
+ * `E`, where no arm list can prove exhaustiveness against an unresolved type
525
+ * parameter, and an `E` that is a single type rather than a union of cases
526
+ * (see {@link P} for both). `@unthrown/oxlint`'s `no-catch-all-pattern` (in
527
+ * its `recommended` preset) flags the rest.
436
528
  *
437
529
  * @typeParam M - the exhaustive builder the callback returns.
438
530
  * @param f - builds the match over the error (returns the un-terminated builder).
@@ -473,16 +565,21 @@ type ResultMethods<out T, out E> = {
473
565
  * @remarks
474
566
  * The callback builds a match whose branches run side effects; their return
475
567
  * values are ignored and the original `Err` flows through. Exhaustive like the
476
- * transformers (use `.with(P._, …)` for a catch-all). If a branch throws, the
568
+ * transformers, and like them it wants every case named — `.with(P._, …)`
569
+ * remains the wildcard escape hatch. If a branch throws, the
477
570
  * result is a `Defect` whose cause is an `AggregateError` of `[thrown, original
478
571
  * failure]` — observing a failure never destroys it. An **async branch is
479
572
  * rejected at compile time** ({@link NotThenable} on the builder output):
480
573
  * because the branch results are discarded, a returned `Promise` would float
481
- * unobserved and its rejection would vanish. A failable
574
+ * unobserved and its rejection would vanish. The one branch return that is
575
+ * **not** discarded is the injected `defect(cause)` marker: it is the
576
+ * lint-clean, expression-position form of a `throw`, so it follows the throw
577
+ * rule above (an `AggregateError` of `[the branch's cause, original
578
+ * failure]`), never a silent no-op. A failable
482
579
  * `Result`-returning effect belongs in
483
580
  * {@link ResultMethods.flatTapErrCases | flatTapErrCases}.
484
581
  *
485
- * @param f - builds the match; branch returns are ignored.
582
+ * @param f - builds the match; branch returns are ignored, bar `defect(cause)`.
486
583
  */
487
584
  tapErrCases<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): Result$1<T, E>;
488
585
  /**
@@ -495,10 +592,13 @@ type ResultMethods<out T, out E> = {
495
592
  * branch returns a `Result` whose **success value is discarded** — on the
496
593
  * effect's `Ok` the original `Err` flows through, while an `Err`/`Defect` from a
497
594
  * branch short-circuits and threads its error. Note the asymmetry with a
498
- * *throw*: a branch that **returns** a `Defect` **replaces** the original `Err`
499
- * (Defect-dominance, the short-circuit rule — it is not aggregated), whereas a
500
- * branch that **throws** produces a `Defect` aggregating `[thrown, original
501
- * failure]` (observing a failure by throwing never destroys it).
595
+ * *throw*: a branch that **returns** a Defect-state `Result` **replaces** the
596
+ * original `Err` (Defect-dominance, the short-circuit rule — it is not
597
+ * aggregated), whereas a branch that **throws** produces a `Defect`
598
+ * aggregating `[thrown, original failure]` (observing a failure by throwing
599
+ * never destroys it). A branch returning the injected `defect(cause)` marker —
600
+ * reachable under a `returnType` pin — follows the *throw* rule, since it is
601
+ * the lint-clean, expression-position form of one.
502
602
  *
503
603
  * @typeParam M - the exhaustive builder the callback returns.
504
604
  * @param f - builds the match; each branch is a failable effect (its `Ok` is ignored).
@@ -566,8 +666,9 @@ type ResultMethods<out T, out E> = {
566
666
  * exactly like the error combinators — which is why the key carries the same
567
667
  * `…Cases` suffix. Chain `.with(pattern, handler)` and **return the
568
668
  * un-terminated builder** — `match` calls `.exhaustive()` itself, so a missing
569
- * case is a compile error at the call site (no `.exhaustive()` to forget). Use
570
- * `.with(P._, …)` for a uniform catch-all. Unlike the combinators the branches
669
+ * case is a compile error at the call site (no `.exhaustive()` to forget).
670
+ * Folding at the edge names every case too — `.with(P._, …)` is the wildcard
671
+ * escape hatch, not the default. Unlike the combinators the branches
571
672
  * receive **no `defect` helper** — `match` is total elimination to a value,
572
673
  * with no `Defect` output channel; the `defect` case handles a `Result` that
573
674
  * already carries one. (A `Result` is also a discriminated union — for richer
@@ -780,7 +881,7 @@ type FailureView<E, T = never> = ErrView<E, T> | DefectView<T, E>;
780
881
  *
781
882
  * @example
782
883
  * ```ts
783
- * import { Ok, Err, P, type Result } from "unthrown";
884
+ * import { Ok, Err, type Result } from "unthrown";
784
885
  *
785
886
  * function half(n: number): Result<number, "odd"> {
786
887
  * return n % 2 === 0 ? Ok(n / 2) : Err("odd");
@@ -788,7 +889,8 @@ type FailureView<E, T = never> = ErrView<E, T> | DefectView<T, E>;
788
889
  *
789
890
  * const message = half(10).match({
790
891
  * ok: (n) => `got ${n}`,
791
- * errCases: (matcher) => matcher.with(P._, (e) => `failed: ${e}`),
892
+ * // every case of `E` named — here the one literal it holds
893
+ * errCases: (matcher) => matcher.with("odd", () => "failed: odd"),
792
894
  * defect: (cause) => `bug: ${String(cause)}`,
793
895
  * });
794
896
  * ```
@@ -925,11 +1027,13 @@ type AsyncResultMethods<out T, out E> = {
925
1027
  recoverErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | MatchErrOut<M>, never>;
926
1028
  /**
927
1029
  * Asynchronous {@link ResultMethods.tapErrCases | tapErrCases}. `f` is synchronous; if it
928
- * throws, the result is a `Defect` whose cause is an `AggregateError` of
929
- * `[thrown, original failure]` — observing a failure never destroys it. An
1030
+ * throws — or a branch returns the injected `defect(cause)` marker, the
1031
+ * expression-position form of a throw — the result is a `Defect` whose cause
1032
+ * is an `AggregateError` of `[thrown, original failure]` — observing a failure
1033
+ * never destroys it. An
930
1034
  * async branch is rejected at compile time ({@link NotThenable} on the
931
- * builder output) — branch results are discarded, so a rejected `Promise`
932
- * would float unobserved. The
1035
+ * builder output) — other branch results are discarded, so a rejected
1036
+ * `Promise` would float unobserved. The
933
1037
  * {@link AsyncResultMethods.tap | tap} fire-and-forget caveat applies here
934
1038
  * too — a failable effect belongs in
935
1039
  * {@link AsyncResultMethods.flatTapErrCases | flatTapErrCases}.
@@ -939,9 +1043,10 @@ type AsyncResultMethods<out T, out E> = {
939
1043
  * Asynchronous {@link ResultMethods.flatTapErrCases | flatTapErrCases} — the
940
1044
  * error-channel mirror of `flatTap`. `f` may return a `Result` **or** an
941
1045
  * `AsyncResult`; its `Ok` value is discarded, an `Err`/`Defect` from `f`
942
- * threads through, and if `f` throws, the result is a `Defect` whose cause is
943
- * an `AggregateError` of `[thrown, original failure]` — observing a failure
944
- * never destroys it.
1046
+ * threads through, and if `f` throws — or a branch returns the injected
1047
+ * `defect(cause)` marker, the expression-position form of a throw — the result
1048
+ * is a `Defect` whose cause is an `AggregateError` of `[thrown, original
1049
+ * failure]` — observing a failure never destroys it.
945
1050
  */
946
1051
  flatTapErrCases<E2>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<Result$1<unknown, E2> | AsyncResult$1<unknown, E2>>): AsyncResult$1<T, E | E2>;
947
1052
  /**
@@ -1317,7 +1422,7 @@ declare class GetError<E = unknown> extends Error {
1317
1422
  *
1318
1423
  * @example
1319
1424
  * ```ts
1320
- * import { isResult, Ok } from "unthrown";
1425
+ * import { isResult, Ok, P } from "unthrown";
1321
1426
  *
1322
1427
  * isResult(Ok(1)); // => true
1323
1428
  * isResult({ tag: "Ok" }); // => false (look-alike, wrong prototype)
@@ -1325,6 +1430,9 @@ declare class GetError<E = unknown> extends Error {
1325
1430
  *
1326
1431
  * const x: unknown = Ok(1);
1327
1432
  * if (isResult(x))
1433
+ * // `E` is `unknown` here — an untyped boundary has no cases to enumerate,
1434
+ * // so the `P._` escape hatch is the only arm that can terminate the match:
1435
+ * // oxlint-disable-next-line unthrown/no-catch-all-pattern -- untyped boundary: `E` is `unknown`
1328
1436
  * x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
1329
1437
  * ```
1330
1438
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/matcher.ts","../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":";;;;;;;;;cAgCM;cAEQ;cACA;;;;;;;;;KAUF,eAAe;YACf,iBAAiB;YACjB,WAAW;;;;;;;;;;;KAYX,mBAAmB;YACnB;;;;;;;;;KAUA,UAAU,MACpB,WAAW,qBAAqB,KAC5B,IACA,uBACK,WAAW,KAAK,UAAU,GAAG,SAChC;;;;;;;;KASI,cAAc;WACf,qFAAqF;;;;;;;;;;;;;KAcpF,QAAQ,GAAG,WAAW;;;;;;;;;EAShC,KAAK,IAAI,SAAS,kBAAkB,UAAU,OAAO,cAAc,KAAK,QAAQ,UAAU,IAAI;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AC3C,sBAAsB,MACrB,cAAY,MAAM,OAAO,WAAW,KAAK,UAAU,GAAG,SAAQ,WAAW;;;;;;;;;;;;;;;;;;;;;;iBAyC5D,iBAAiB,UAAU,mBACzC,SAAS,IACR,iBAAe,WAAW,IAAI,UAAU,EAAE,QAAO,WAAW,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC3d1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCD,OAAO,GAAG,KAAK,SAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8B5B;;;;;;;;;;;;;;;;;;;;;;KAyBD,YAAY,GAAG,KAAK,cAAgB,GAAG;;;KCpI9C,QAAQ;;;;;;;;;;KAWD,oBAAoB,oBAAoB,UAAU,SAAS,QACrE,SAAS,KAAK;WAA+C,MAAM;;;;;;;;;;;;;;;;;;;;;;KAsBzD,uBAAuB;OAC5B,UAAU,YACb,YAAY,yBAER;aAAe;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/matcher.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;;;;;;;;;;;;cCcL;cAEQ;cACA;;;;;;;;;KAUF,eAAe;YACf,iBAAiB;YACjB,WAAW;;;;;;;;;;;KAYX,mBAAmB;YACnB;;;;;;;;;KAUA,UAAU,MACpB,WAAW,qBAAqB,KAC5B,IACA,uBACK,WAAW,KAAK,UAAU,GAAG,SAChC;;;;;;;;KASI,cAAc;WACf,qFAAqF;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