unthrown 5.0.0-beta.6 → 5.0.0-beta.7
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/dist/index.cjs +26 -9
- package/dist/index.d.cts +118 -39
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +118 -39
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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);
|
|
@@ -334,7 +341,8 @@ var Res = class {
|
|
|
334
341
|
tapErrCases(f) {
|
|
335
342
|
if (this.tag !== "Err") return this;
|
|
336
343
|
try {
|
|
337
|
-
runMatch(f, this.error);
|
|
344
|
+
const out = runMatch(f, this.error);
|
|
345
|
+
if (isDefectMarker(out)) return observerThrowToDefect(out.cause, this.error);
|
|
338
346
|
return this;
|
|
339
347
|
} catch (cause) {
|
|
340
348
|
return observerThrowToDefect(cause, this.error);
|
|
@@ -344,6 +352,7 @@ var Res = class {
|
|
|
344
352
|
if (this.tag !== "Err") return this;
|
|
345
353
|
try {
|
|
346
354
|
const r = runMatch(f, this.error);
|
|
355
|
+
if (isDefectMarker(r)) return observerThrowToDefect(r.cause, this.error);
|
|
347
356
|
if (!isResult(r)) return nonResultCallbackDefect();
|
|
348
357
|
return r.tag === "Ok" ? this : passThrough(r);
|
|
349
358
|
} catch (cause) {
|
|
@@ -559,16 +568,21 @@ function runMatch(f, error) {
|
|
|
559
568
|
return f(match(error), defect).run();
|
|
560
569
|
}
|
|
561
570
|
/**
|
|
562
|
-
* A throw inside a *failure observer* (`tapErrCases` / `tapDefect` /
|
|
563
|
-
* must not destroy the failure being observed
|
|
564
|
-
* failing error-logger) where losing the
|
|
565
|
-
* resulting Defect aggregates both:
|
|
566
|
-
* `errors[1]` the original failure.
|
|
571
|
+
* A throw inside a *failure observer* (`tapErrCases` / `tapDefect` /
|
|
572
|
+
* `tapFailure` / `flatTapErrCases`) must not destroy the failure being observed
|
|
573
|
+
* — that is the exact place (e.g. a failing error-logger) where losing the
|
|
574
|
+
* underlying failure hurts most. The resulting Defect aggregates both:
|
|
575
|
+
* `errors[0]` is the observer's own failure, `errors[1]` the original failure.
|
|
576
|
+
*
|
|
577
|
+
* An observer branch returning the injected `defect(cause)` marker
|
|
578
|
+
* (`tapErrCases` / `flatTapErrCases`) takes the same route: it is the
|
|
579
|
+
* lint-clean, expression-position form of a `throw` (Thesis #5), so it must not
|
|
580
|
+
* behave differently from one.
|
|
567
581
|
*
|
|
568
582
|
* @internal
|
|
569
583
|
*/
|
|
570
584
|
function observerThrowToDefect(thrown, original) {
|
|
571
|
-
return defectRes(new AggregateError([thrown, original], "unthrown: a failure-observer callback
|
|
585
|
+
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
586
|
}
|
|
573
587
|
/**
|
|
574
588
|
* Validate that a `bind`/`let` scope is a real (non-null) object before merging a
|
|
@@ -738,7 +752,8 @@ var AsyncRes = class AsyncRes {
|
|
|
738
752
|
return new AsyncRes(this.#promise.then((r) => {
|
|
739
753
|
if (r.tag !== "Err") return r;
|
|
740
754
|
try {
|
|
741
|
-
runMatch(f, r.error);
|
|
755
|
+
const out = runMatch(f, r.error);
|
|
756
|
+
if (isDefectMarker(out)) return observerThrowToDefect(out.cause, r.error);
|
|
742
757
|
return r;
|
|
743
758
|
} catch (cause) {
|
|
744
759
|
return observerThrowToDefect(cause, r.error);
|
|
@@ -749,7 +764,9 @@ var AsyncRes = class AsyncRes {
|
|
|
749
764
|
return new AsyncRes(this.#promise.then(async (r) => {
|
|
750
765
|
if (r.tag !== "Err") return passThrough(r);
|
|
751
766
|
try {
|
|
752
|
-
const
|
|
767
|
+
const out = runMatch(f, r.error);
|
|
768
|
+
if (isDefectMarker(out)) return observerThrowToDefect(out.cause, r.error);
|
|
769
|
+
const inner = await out;
|
|
753
770
|
if (!isResult(inner)) return nonResultCallbackDefect();
|
|
754
771
|
return inner.tag === "Ok" ? passThrough(r) : passThrough(inner);
|
|
755
772
|
} 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,7 +125,7 @@ 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
130
|
* The catch-all arm: `.with(P._, handler)` / `.with(P.any, handler)`. A
|
|
69
131
|
* **state transition**, not a computation — it returns `Matcher<E, never, …>`
|
|
@@ -72,7 +134,7 @@ type Matcher<E, Remaining, O> = {
|
|
|
72
134
|
* `Exclude<E, unknown>` would not resolve there). This is what lets a
|
|
73
135
|
* boundary helper generic in `E` terminate with the catch-all (issue #145).
|
|
74
136
|
*/
|
|
75
|
-
with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => O2): Matcher<E, never, O | O2>;
|
|
137
|
+
with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => BranchReturn<Declared, O2>): Matcher<E, never, O | O2, Declared>;
|
|
76
138
|
/**
|
|
77
139
|
* Add an arm: one or more patterns sharing a single handler (grouped
|
|
78
140
|
* patterns — `matcher.with(tag("A"), tag("B"), handler)`). The handler
|
|
@@ -80,20 +142,48 @@ type Matcher<E, Remaining, O> = {
|
|
|
80
142
|
* `Remaining`, so cases already handled by earlier arms are excluded); the
|
|
81
143
|
* matched cases are subtracted from `Remaining`.
|
|
82
144
|
*/
|
|
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>;
|
|
145
|
+
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>;
|
|
146
|
+
/**
|
|
147
|
+
* Declare the match's output type up front: every subsequent branch handler
|
|
148
|
+
* is checked against `R`, and the match evaluates to `R` instead of the
|
|
149
|
+
* union of whatever the branches happened to return.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Reach for it when the output is **decided by a signature rather than by
|
|
153
|
+
* the branches** — most sharply in code generic in `E`, where the fold's type
|
|
154
|
+
* has to be declared. It also stops a drifting branch from silently widening
|
|
155
|
+
* the outgoing type, reports the mismatch **on the offending branch**, and
|
|
156
|
+
* gives branch returns a contextual type (so object literals need no
|
|
157
|
+
* annotation).
|
|
158
|
+
*
|
|
159
|
+
* A branch may still return the injected `defect` helper's marker; the defect
|
|
160
|
+
* channel is not part of the declared output.
|
|
161
|
+
*
|
|
162
|
+
* Callable **before any arm has produced an output**, and only once
|
|
163
|
+
* (mirroring ts-pattern's up-front pin): once there is an inferred output for
|
|
164
|
+
* the pin to contradict — or the builder is already pinned — this is typed as
|
|
165
|
+
* a non-callable diagnostic. In practice that means calling it directly after
|
|
166
|
+
* `match(…)`; the gate is about output rather than position, so an earlier arm
|
|
167
|
+
* whose handler returns `never` (it always throws) contributes nothing and
|
|
168
|
+
* does not close it — sound, since a `never` branch can contradict no declared
|
|
169
|
+
* type. A no-op at runtime.
|
|
170
|
+
*
|
|
171
|
+
* @typeParam R - the declared output type of every branch.
|
|
172
|
+
*/
|
|
173
|
+
returnType: [O] extends [never] ? [Declared] extends [Unset] ? <R>() => Matcher<E, Remaining, never, R> : PinTooLate : PinTooLate;
|
|
84
174
|
/**
|
|
85
175
|
* Terminate the match. Typed callable only when every case is covered
|
|
86
176
|
* (`Remaining` is `never`); otherwise it is a branded diagnostic object
|
|
87
177
|
* naming the remaining cases, and the builder fails the `ExhaustiveMatch`
|
|
88
178
|
* constraint at the combinator call site.
|
|
89
179
|
*/
|
|
90
|
-
exhaustive: [Remaining] extends [never] ? () => O : NonExhaustive<Remaining>;
|
|
180
|
+
exhaustive: [Remaining] extends [never] ? () => PinnedOut<Declared, O> : NonExhaustive<Remaining>;
|
|
91
181
|
/**
|
|
92
182
|
* Execute the match (the combinators call this; it runs `.exhaustive()`).
|
|
93
183
|
* A value with no matching arm throws {@link NonExhaustiveError} —
|
|
94
184
|
* unreachable for well-typed callers.
|
|
95
185
|
*/
|
|
96
|
-
run(): O
|
|
186
|
+
run(): PinnedOut<Declared, O>;
|
|
97
187
|
};
|
|
98
188
|
/**
|
|
99
189
|
* Thrown by `.run()` / `.exhaustive()` when no arm matched the value. For
|
|
@@ -149,27 +239,6 @@ declare const P: Readonly<{
|
|
|
149
239
|
number: PatternMatcher<number>;
|
|
150
240
|
}>;
|
|
151
241
|
//#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
242
|
//#region src/types.d.ts
|
|
174
243
|
/**
|
|
175
244
|
* Flatten an intersection into a single object literal so accumulated `bind` /
|
|
@@ -478,11 +547,15 @@ type ResultMethods<out T, out E> = {
|
|
|
478
547
|
* failure]` — observing a failure never destroys it. An **async branch is
|
|
479
548
|
* rejected at compile time** ({@link NotThenable} on the builder output):
|
|
480
549
|
* because the branch results are discarded, a returned `Promise` would float
|
|
481
|
-
* unobserved and its rejection would vanish.
|
|
550
|
+
* unobserved and its rejection would vanish. The one branch return that is
|
|
551
|
+
* **not** discarded is the injected `defect(cause)` marker: it is the
|
|
552
|
+
* lint-clean, expression-position form of a `throw`, so it follows the throw
|
|
553
|
+
* rule above (an `AggregateError` of `[the branch's cause, original
|
|
554
|
+
* failure]`), never a silent no-op. A failable
|
|
482
555
|
* `Result`-returning effect belongs in
|
|
483
556
|
* {@link ResultMethods.flatTapErrCases | flatTapErrCases}.
|
|
484
557
|
*
|
|
485
|
-
* @param f - builds the match; branch returns are ignored
|
|
558
|
+
* @param f - builds the match; branch returns are ignored, bar `defect(cause)`.
|
|
486
559
|
*/
|
|
487
560
|
tapErrCases<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): Result$1<T, E>;
|
|
488
561
|
/**
|
|
@@ -495,10 +568,13 @@ type ResultMethods<out T, out E> = {
|
|
|
495
568
|
* branch returns a `Result` whose **success value is discarded** — on the
|
|
496
569
|
* effect's `Ok` the original `Err` flows through, while an `Err`/`Defect` from a
|
|
497
570
|
* branch short-circuits and threads its error. Note the asymmetry with a
|
|
498
|
-
* *throw*: a branch that **returns** a
|
|
499
|
-
* (Defect-dominance, the short-circuit rule — it is not
|
|
500
|
-
* branch that **throws** produces a `Defect`
|
|
501
|
-
* failure]` (observing a failure by throwing
|
|
571
|
+
* *throw*: a branch that **returns** a Defect-state `Result` **replaces** the
|
|
572
|
+
* original `Err` (Defect-dominance, the short-circuit rule — it is not
|
|
573
|
+
* aggregated), whereas a branch that **throws** produces a `Defect`
|
|
574
|
+
* aggregating `[thrown, original failure]` (observing a failure by throwing
|
|
575
|
+
* never destroys it). A branch returning the injected `defect(cause)` marker —
|
|
576
|
+
* reachable under a `returnType` pin — follows the *throw* rule, since it is
|
|
577
|
+
* the lint-clean, expression-position form of one.
|
|
502
578
|
*
|
|
503
579
|
* @typeParam M - the exhaustive builder the callback returns.
|
|
504
580
|
* @param f - builds the match; each branch is a failable effect (its `Ok` is ignored).
|
|
@@ -925,11 +1001,13 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
925
1001
|
recoverErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | MatchErrOut<M>, never>;
|
|
926
1002
|
/**
|
|
927
1003
|
* Asynchronous {@link ResultMethods.tapErrCases | tapErrCases}. `f` is synchronous; if it
|
|
928
|
-
* throws
|
|
929
|
-
*
|
|
1004
|
+
* throws — or a branch returns the injected `defect(cause)` marker, the
|
|
1005
|
+
* expression-position form of a throw — the result is a `Defect` whose cause
|
|
1006
|
+
* is an `AggregateError` of `[thrown, original failure]` — observing a failure
|
|
1007
|
+
* never destroys it. An
|
|
930
1008
|
* async branch is rejected at compile time ({@link NotThenable} on the
|
|
931
|
-
* builder output) — branch results are discarded, so a rejected
|
|
932
|
-
* would float unobserved. The
|
|
1009
|
+
* builder output) — other branch results are discarded, so a rejected
|
|
1010
|
+
* `Promise` would float unobserved. The
|
|
933
1011
|
* {@link AsyncResultMethods.tap | tap} fire-and-forget caveat applies here
|
|
934
1012
|
* too — a failable effect belongs in
|
|
935
1013
|
* {@link AsyncResultMethods.flatTapErrCases | flatTapErrCases}.
|
|
@@ -939,9 +1017,10 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
939
1017
|
* Asynchronous {@link ResultMethods.flatTapErrCases | flatTapErrCases} — the
|
|
940
1018
|
* error-channel mirror of `flatTap`. `f` may return a `Result` **or** an
|
|
941
1019
|
* `AsyncResult`; its `Ok` value is discarded, an `Err`/`Defect` from `f`
|
|
942
|
-
* threads through, and if `f` throws
|
|
943
|
-
*
|
|
944
|
-
*
|
|
1020
|
+
* threads through, and if `f` throws — or a branch returns the injected
|
|
1021
|
+
* `defect(cause)` marker, the expression-position form of a throw — the result
|
|
1022
|
+
* is a `Defect` whose cause is an `AggregateError` of `[thrown, original
|
|
1023
|
+
* failure]` — observing a failure never destroys it.
|
|
945
1024
|
*/
|
|
946
1025
|
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
1026
|
/**
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/
|
|
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;;;;;;;;;cAUlF;;KAGT,eAAe;;;;;;;;;;;;;;KAef,aAAa,UAAU,OAAO,mBAAmB,SAAS,KAAK,WAAW;;;;;;;KAQ1E,UAAU,UAAU,MAAM,mBAAmB,SAAS,IAAI;;;;;;;;KAS1D;WACM;;;;;;;;;;;;;KAcC,QAAQ,GAAG,WAAW,GAAG,WAAW;;;;;;;;;EAS9C,KAAK,I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,KAAK,GAAG,SAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;iBA2B7C,YAAY,UAAU,cACpC,SAAS,IACR,YAAU,WAAW,IAAI,KAAK,EAAE,QAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;iBA2BxC,SAAS,oBAAoB,mCAC3C,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"}
|
package/dist/index.d.mts
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,7 +125,7 @@ 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
130
|
* The catch-all arm: `.with(P._, handler)` / `.with(P.any, handler)`. A
|
|
69
131
|
* **state transition**, not a computation — it returns `Matcher<E, never, …>`
|
|
@@ -72,7 +134,7 @@ type Matcher<E, Remaining, O> = {
|
|
|
72
134
|
* `Exclude<E, unknown>` would not resolve there). This is what lets a
|
|
73
135
|
* boundary helper generic in `E` terminate with the catch-all (issue #145).
|
|
74
136
|
*/
|
|
75
|
-
with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => O2): Matcher<E, never, O | O2>;
|
|
137
|
+
with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => BranchReturn<Declared, O2>): Matcher<E, never, O | O2, Declared>;
|
|
76
138
|
/**
|
|
77
139
|
* Add an arm: one or more patterns sharing a single handler (grouped
|
|
78
140
|
* patterns — `matcher.with(tag("A"), tag("B"), handler)`). The handler
|
|
@@ -80,20 +142,48 @@ type Matcher<E, Remaining, O> = {
|
|
|
80
142
|
* `Remaining`, so cases already handled by earlier arms are excluded); the
|
|
81
143
|
* matched cases are subtracted from `Remaining`.
|
|
82
144
|
*/
|
|
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>;
|
|
145
|
+
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>;
|
|
146
|
+
/**
|
|
147
|
+
* Declare the match's output type up front: every subsequent branch handler
|
|
148
|
+
* is checked against `R`, and the match evaluates to `R` instead of the
|
|
149
|
+
* union of whatever the branches happened to return.
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* Reach for it when the output is **decided by a signature rather than by
|
|
153
|
+
* the branches** — most sharply in code generic in `E`, where the fold's type
|
|
154
|
+
* has to be declared. It also stops a drifting branch from silently widening
|
|
155
|
+
* the outgoing type, reports the mismatch **on the offending branch**, and
|
|
156
|
+
* gives branch returns a contextual type (so object literals need no
|
|
157
|
+
* annotation).
|
|
158
|
+
*
|
|
159
|
+
* A branch may still return the injected `defect` helper's marker; the defect
|
|
160
|
+
* channel is not part of the declared output.
|
|
161
|
+
*
|
|
162
|
+
* Callable **before any arm has produced an output**, and only once
|
|
163
|
+
* (mirroring ts-pattern's up-front pin): once there is an inferred output for
|
|
164
|
+
* the pin to contradict — or the builder is already pinned — this is typed as
|
|
165
|
+
* a non-callable diagnostic. In practice that means calling it directly after
|
|
166
|
+
* `match(…)`; the gate is about output rather than position, so an earlier arm
|
|
167
|
+
* whose handler returns `never` (it always throws) contributes nothing and
|
|
168
|
+
* does not close it — sound, since a `never` branch can contradict no declared
|
|
169
|
+
* type. A no-op at runtime.
|
|
170
|
+
*
|
|
171
|
+
* @typeParam R - the declared output type of every branch.
|
|
172
|
+
*/
|
|
173
|
+
returnType: [O] extends [never] ? [Declared] extends [Unset] ? <R>() => Matcher<E, Remaining, never, R> : PinTooLate : PinTooLate;
|
|
84
174
|
/**
|
|
85
175
|
* Terminate the match. Typed callable only when every case is covered
|
|
86
176
|
* (`Remaining` is `never`); otherwise it is a branded diagnostic object
|
|
87
177
|
* naming the remaining cases, and the builder fails the `ExhaustiveMatch`
|
|
88
178
|
* constraint at the combinator call site.
|
|
89
179
|
*/
|
|
90
|
-
exhaustive: [Remaining] extends [never] ? () => O : NonExhaustive<Remaining>;
|
|
180
|
+
exhaustive: [Remaining] extends [never] ? () => PinnedOut<Declared, O> : NonExhaustive<Remaining>;
|
|
91
181
|
/**
|
|
92
182
|
* Execute the match (the combinators call this; it runs `.exhaustive()`).
|
|
93
183
|
* A value with no matching arm throws {@link NonExhaustiveError} —
|
|
94
184
|
* unreachable for well-typed callers.
|
|
95
185
|
*/
|
|
96
|
-
run(): O
|
|
186
|
+
run(): PinnedOut<Declared, O>;
|
|
97
187
|
};
|
|
98
188
|
/**
|
|
99
189
|
* Thrown by `.run()` / `.exhaustive()` when no arm matched the value. For
|
|
@@ -149,27 +239,6 @@ declare const P: Readonly<{
|
|
|
149
239
|
number: PatternMatcher<number>;
|
|
150
240
|
}>;
|
|
151
241
|
//#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
242
|
//#region src/types.d.ts
|
|
174
243
|
/**
|
|
175
244
|
* Flatten an intersection into a single object literal so accumulated `bind` /
|
|
@@ -478,11 +547,15 @@ type ResultMethods<out T, out E> = {
|
|
|
478
547
|
* failure]` — observing a failure never destroys it. An **async branch is
|
|
479
548
|
* rejected at compile time** ({@link NotThenable} on the builder output):
|
|
480
549
|
* because the branch results are discarded, a returned `Promise` would float
|
|
481
|
-
* unobserved and its rejection would vanish.
|
|
550
|
+
* unobserved and its rejection would vanish. The one branch return that is
|
|
551
|
+
* **not** discarded is the injected `defect(cause)` marker: it is the
|
|
552
|
+
* lint-clean, expression-position form of a `throw`, so it follows the throw
|
|
553
|
+
* rule above (an `AggregateError` of `[the branch's cause, original
|
|
554
|
+
* failure]`), never a silent no-op. A failable
|
|
482
555
|
* `Result`-returning effect belongs in
|
|
483
556
|
* {@link ResultMethods.flatTapErrCases | flatTapErrCases}.
|
|
484
557
|
*
|
|
485
|
-
* @param f - builds the match; branch returns are ignored
|
|
558
|
+
* @param f - builds the match; branch returns are ignored, bar `defect(cause)`.
|
|
486
559
|
*/
|
|
487
560
|
tapErrCases<R>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => ExhaustiveMatch<R & NotThenable<R>>): Result$1<T, E>;
|
|
488
561
|
/**
|
|
@@ -495,10 +568,13 @@ type ResultMethods<out T, out E> = {
|
|
|
495
568
|
* branch returns a `Result` whose **success value is discarded** — on the
|
|
496
569
|
* effect's `Ok` the original `Err` flows through, while an `Err`/`Defect` from a
|
|
497
570
|
* branch short-circuits and threads its error. Note the asymmetry with a
|
|
498
|
-
* *throw*: a branch that **returns** a
|
|
499
|
-
* (Defect-dominance, the short-circuit rule — it is not
|
|
500
|
-
* branch that **throws** produces a `Defect`
|
|
501
|
-
* failure]` (observing a failure by throwing
|
|
571
|
+
* *throw*: a branch that **returns** a Defect-state `Result` **replaces** the
|
|
572
|
+
* original `Err` (Defect-dominance, the short-circuit rule — it is not
|
|
573
|
+
* aggregated), whereas a branch that **throws** produces a `Defect`
|
|
574
|
+
* aggregating `[thrown, original failure]` (observing a failure by throwing
|
|
575
|
+
* never destroys it). A branch returning the injected `defect(cause)` marker —
|
|
576
|
+
* reachable under a `returnType` pin — follows the *throw* rule, since it is
|
|
577
|
+
* the lint-clean, expression-position form of one.
|
|
502
578
|
*
|
|
503
579
|
* @typeParam M - the exhaustive builder the callback returns.
|
|
504
580
|
* @param f - builds the match; each branch is a failable effect (its `Ok` is ignored).
|
|
@@ -925,11 +1001,13 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
925
1001
|
recoverErrCases<M extends ExhaustiveMatch<unknown>>(f: (matcher: ErrMatcher<E>, defect: (cause: unknown) => Defect) => M): AsyncResult$1<T | MatchErrOut<M>, never>;
|
|
926
1002
|
/**
|
|
927
1003
|
* Asynchronous {@link ResultMethods.tapErrCases | tapErrCases}. `f` is synchronous; if it
|
|
928
|
-
* throws
|
|
929
|
-
*
|
|
1004
|
+
* throws — or a branch returns the injected `defect(cause)` marker, the
|
|
1005
|
+
* expression-position form of a throw — the result is a `Defect` whose cause
|
|
1006
|
+
* is an `AggregateError` of `[thrown, original failure]` — observing a failure
|
|
1007
|
+
* never destroys it. An
|
|
930
1008
|
* async branch is rejected at compile time ({@link NotThenable} on the
|
|
931
|
-
* builder output) — branch results are discarded, so a rejected
|
|
932
|
-
* would float unobserved. The
|
|
1009
|
+
* builder output) — other branch results are discarded, so a rejected
|
|
1010
|
+
* `Promise` would float unobserved. The
|
|
933
1011
|
* {@link AsyncResultMethods.tap | tap} fire-and-forget caveat applies here
|
|
934
1012
|
* too — a failable effect belongs in
|
|
935
1013
|
* {@link AsyncResultMethods.flatTapErrCases | flatTapErrCases}.
|
|
@@ -939,9 +1017,10 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
939
1017
|
* Asynchronous {@link ResultMethods.flatTapErrCases | flatTapErrCases} — the
|
|
940
1018
|
* error-channel mirror of `flatTap`. `f` may return a `Result` **or** an
|
|
941
1019
|
* `AsyncResult`; its `Ok` value is discarded, an `Err`/`Defect` from `f`
|
|
942
|
-
* threads through, and if `f` throws
|
|
943
|
-
*
|
|
944
|
-
*
|
|
1020
|
+
* threads through, and if `f` throws — or a branch returns the injected
|
|
1021
|
+
* `defect(cause)` marker, the expression-position form of a throw — the result
|
|
1022
|
+
* is a `Defect` whose cause is an `AggregateError` of `[thrown, original
|
|
1023
|
+
* failure]` — observing a failure never destroys it.
|
|
945
1024
|
*/
|
|
946
1025
|
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
1026
|
/**
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/defect.ts","../src/matcher.ts","../src/types.ts","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