unthrown 5.0.0-beta.4 → 5.0.0-beta.6
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 +10 -3
- package/dist/index.cjs +157 -17
- package/dist/index.d.cts +182 -30
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +182 -30
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +155 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
pnpm add unthrown
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
No peer dependencies — the exhaustive error matcher is built-in and exported as
|
|
14
|
+
`match` / `P` / `tag`.
|
|
15
|
+
|
|
13
16
|
```ts
|
|
14
17
|
import { fromPromise, P, TaggedError } from "unthrown";
|
|
15
18
|
|
|
@@ -22,7 +25,7 @@ const user = fromPromise(fetchUser(id), (cause, defect) =>
|
|
|
22
25
|
|
|
23
26
|
const status = await user.match({
|
|
24
27
|
ok: () => 200,
|
|
25
|
-
|
|
28
|
+
errCases: (matcher) => matcher.with(P._, () => 404), // `errCases` takes the exhaustive matcher
|
|
26
29
|
defect: () => 500,
|
|
27
30
|
});
|
|
28
31
|
```
|
|
@@ -33,12 +36,16 @@ const status = await user.match({
|
|
|
33
36
|
- **Qualification at every boundary** — `fromPromise` / `fromThrowable` force you
|
|
34
37
|
to triage each failure into a modeled error or a defect.
|
|
35
38
|
- **Tagged errors** — `TaggedError(tag)` + `tag(t)`, folded exhaustively through
|
|
36
|
-
`match`'s
|
|
37
|
-
-
|
|
39
|
+
`match`'s built-in error matcher.
|
|
40
|
+
- **Zero runtime dependencies** (the matcher is built-in), ESM-first, dual
|
|
41
|
+
CJS/ESM.
|
|
38
42
|
|
|
39
43
|
See the [full documentation](https://btravstack.github.io/unthrown/) for the guide
|
|
40
44
|
and complete API.
|
|
41
45
|
|
|
46
|
+
**Upgrading from 4.x?** See
|
|
47
|
+
[Upgrade from 4.x to 5.0](https://btravstack.github.io/unthrown/how-to/upgrade-to-v5).
|
|
48
|
+
|
|
42
49
|
## License
|
|
43
50
|
|
|
44
51
|
[MIT](https://github.com/btravstack/unthrown/blob/main/LICENSE) © Benoit TRAVERS
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,153 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
//#region src/matcher.ts
|
|
3
|
+
/**
|
|
4
|
+
* Cross-copy brand for `P.*` pattern objects: `Symbol.for` yields the same
|
|
5
|
+
* symbol in every copy of the library (dual CJS/ESM, duplicated install,
|
|
6
|
+
* another realm), so a pattern built by one copy is recognised by another —
|
|
7
|
+
* the same rationale as `isResult`'s prototype brand.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const PATTERN_BRAND = Symbol.for("unthrown.matcher.pattern");
|
|
12
|
+
/**
|
|
13
|
+
* Thrown by `.run()` / `.exhaustive()` when no arm matched the value. For
|
|
14
|
+
* well-typed callers the match is exhaustive by construction, so this is only
|
|
15
|
+
* reachable by a value that slipped past the types (a widened cast, a raw-JS
|
|
16
|
+
* caller); inside the error combinators the throw-to-defect net converts it to
|
|
17
|
+
* a `Defect`, and at the `match` edge it surfaces (a genuinely unmodeled value
|
|
18
|
+
* is a bug).
|
|
19
|
+
*
|
|
20
|
+
* @category Errors
|
|
21
|
+
*/
|
|
22
|
+
var NonExhaustiveError = class extends Error {
|
|
23
|
+
/** The value no arm matched. */
|
|
24
|
+
input;
|
|
25
|
+
constructor(input) {
|
|
26
|
+
let printed;
|
|
27
|
+
try {
|
|
28
|
+
printed = JSON.stringify(input);
|
|
29
|
+
} catch {
|
|
30
|
+
printed = String(input);
|
|
31
|
+
}
|
|
32
|
+
super(`unthrown: no pattern matched the value ${printed}`);
|
|
33
|
+
this.name = "NonExhaustiveError";
|
|
34
|
+
this.input = input;
|
|
35
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Is `x` a *plain* object (prototype `Object.prototype` or `null`) — an object
|
|
40
|
+
* literal, the only object shape that acts as a structural pattern?
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
function isPlainObject(x) {
|
|
45
|
+
const proto = Object.getPrototypeOf(x);
|
|
46
|
+
return proto === Object.prototype || proto === null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Runtime test: does `pattern` match `value`? A branded `P.*` pattern applies
|
|
50
|
+
* its predicate; a **plain-object** pattern (an object literal, e.g. the
|
|
51
|
+
* `{ _tag }` produced by `tag()`) matches when every key matches recursively
|
|
52
|
+
* (extra keys on the value are ignored — matching is structural); anything
|
|
53
|
+
* else — primitives, but also class instances, arrays, and foreign pattern
|
|
54
|
+
* objects (e.g. a real ts-pattern matcher, whose keys are symbols) — is
|
|
55
|
+
* compared with `Object.is`. Restricting structural matching to plain objects
|
|
56
|
+
* is load-bearing: a keyless non-plain object (`new Date()`, `new Error()`, a
|
|
57
|
+
* symbol-keyed foreign pattern) would otherwise vacuously match *every* object
|
|
58
|
+
* via an empty `Object.entries`.
|
|
59
|
+
*
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
function matches(pattern, value) {
|
|
63
|
+
if (typeof pattern === "object" && pattern !== null) {
|
|
64
|
+
const predicate = pattern[PATTERN_BRAND];
|
|
65
|
+
if (typeof predicate === "function") return predicate(value);
|
|
66
|
+
if (!isPlainObject(pattern) || Object.getOwnPropertySymbols(pattern).length > 0) return Object.is(pattern, value);
|
|
67
|
+
if (typeof value !== "object" || value === null) return false;
|
|
68
|
+
return Object.entries(pattern).every(([key, sub]) => matches(sub, value[key]));
|
|
69
|
+
}
|
|
70
|
+
return Object.is(pattern, value);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The runtime builder: first matching arm wins; later arms are skipped once a
|
|
74
|
+
* result is captured. `exhaustive` is a *method* at runtime (the conditional
|
|
75
|
+
* type gates its callability per instantiation).
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
var MatcherImpl = class {
|
|
80
|
+
#value;
|
|
81
|
+
#matched = false;
|
|
82
|
+
#result;
|
|
83
|
+
constructor(value) {
|
|
84
|
+
this.#value = value;
|
|
85
|
+
}
|
|
86
|
+
with(...args) {
|
|
87
|
+
if (this.#matched) return this;
|
|
88
|
+
const handler = args[args.length - 1];
|
|
89
|
+
for (let i = 0; i < args.length - 1; i++) if (matches(args[i], this.#value)) {
|
|
90
|
+
this.#matched = true;
|
|
91
|
+
this.#result = handler(this.#value);
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
return this;
|
|
95
|
+
}
|
|
96
|
+
exhaustive() {
|
|
97
|
+
if (this.#matched) return this.#result;
|
|
98
|
+
throw new NonExhaustiveError(this.#value);
|
|
99
|
+
}
|
|
100
|
+
run() {
|
|
101
|
+
return this.exhaustive();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
Object.freeze(MatcherImpl.prototype);
|
|
105
|
+
/**
|
|
106
|
+
* Begin a match over `value`. Chain `.with(pattern, …patterns, handler)` arms;
|
|
107
|
+
* terminate with `.exhaustive()` — or return the un-terminated builder to an
|
|
108
|
+
* unthrown error combinator / `match({ errCases })`, which runs it for you.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* This is unthrown's own matcher (the former ts-pattern re-export): the same
|
|
112
|
+
* 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.
|
|
115
|
+
*
|
|
116
|
+
* @category Constructors
|
|
117
|
+
*/
|
|
118
|
+
function match(value) {
|
|
119
|
+
return new MatcherImpl(value);
|
|
120
|
+
}
|
|
121
|
+
/** @internal */
|
|
122
|
+
function pattern(predicate) {
|
|
123
|
+
return Object.freeze({ [PATTERN_BRAND]: predicate });
|
|
124
|
+
}
|
|
125
|
+
const universal = pattern(() => true);
|
|
126
|
+
/**
|
|
127
|
+
* The pattern namespace (unthrown's own; the former ts-pattern `P`):
|
|
128
|
+
*
|
|
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.
|
|
132
|
+
* - `P.instanceOf(Cls)` — an `instanceof` check, narrowing to the class
|
|
133
|
+
* instance type (for union members that are not tagged, e.g. a third-party
|
|
134
|
+
* error class).
|
|
135
|
+
* - `P.when(guard)` — an arbitrary type-guard predicate.
|
|
136
|
+
* - `P.union(…patterns)` — matches when any sub-pattern matches.
|
|
137
|
+
* - `P.string` / `P.number` — primitive-type wildcards.
|
|
138
|
+
*
|
|
139
|
+
* @category Constructors
|
|
140
|
+
*/
|
|
141
|
+
const P = Object.freeze({
|
|
142
|
+
_: universal,
|
|
143
|
+
any: universal,
|
|
144
|
+
instanceOf: (cls) => pattern((value) => value instanceof cls),
|
|
145
|
+
when: (guard) => pattern(guard),
|
|
146
|
+
union: (...patterns) => pattern((value) => patterns.some((sub) => matches(sub, value))),
|
|
147
|
+
string: pattern((value) => typeof value === "string"),
|
|
148
|
+
number: pattern((value) => typeof value === "number")
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
3
151
|
//#region src/defect.ts
|
|
4
152
|
const DEFECT = Symbol("unthrown/Defect");
|
|
5
153
|
/**
|
|
@@ -232,7 +380,7 @@ var Res = class {
|
|
|
232
380
|
match(cases) {
|
|
233
381
|
switch (this.tag) {
|
|
234
382
|
case "Ok": return cases.ok(this.value);
|
|
235
|
-
case "Err": return cases.
|
|
383
|
+
case "Err": return cases.errCases(match(this.error)).run();
|
|
236
384
|
case "Defect": return cases.defect(this.cause);
|
|
237
385
|
}
|
|
238
386
|
}
|
|
@@ -357,7 +505,8 @@ function defectRes(cause) {
|
|
|
357
505
|
* isResult(Ok(1).toAsync()); // => false (an AsyncResult is not a Result)
|
|
358
506
|
*
|
|
359
507
|
* const x: unknown = Ok(1);
|
|
360
|
-
* if (isResult(x))
|
|
508
|
+
* if (isResult(x))
|
|
509
|
+
* x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
|
|
361
510
|
* ```
|
|
362
511
|
*
|
|
363
512
|
* @category Guards
|
|
@@ -407,7 +556,7 @@ function nonResultCallbackDefect() {
|
|
|
407
556
|
* @internal
|
|
408
557
|
*/
|
|
409
558
|
function runMatch(f, error) {
|
|
410
|
-
return f(
|
|
559
|
+
return f(match(error), defect).run();
|
|
411
560
|
}
|
|
412
561
|
/**
|
|
413
562
|
* A throw inside a *failure observer* (`tapErrCases` / `tapDefect` / `flatTapErrCases`)
|
|
@@ -1404,7 +1553,7 @@ function TaggedError(tag, options) {
|
|
|
1404
1553
|
return TaggedErrorBase;
|
|
1405
1554
|
}
|
|
1406
1555
|
/**
|
|
1407
|
-
* A
|
|
1556
|
+
* A matcher pattern matching any value whose `_tag` equals `value` — a
|
|
1408
1557
|
* {@link TaggedError}, or any discriminated member. Equivalent to the object
|
|
1409
1558
|
* pattern `{ _tag: value }`, but reads better inside an error-matching
|
|
1410
1559
|
* combinator and narrows to the matching variant, payload included.
|
|
@@ -1433,14 +1582,10 @@ exports.DoAsync = DoAsync;
|
|
|
1433
1582
|
exports.Err = Err;
|
|
1434
1583
|
exports.ErrAsync = ErrAsync;
|
|
1435
1584
|
exports.GetError = GetError;
|
|
1585
|
+
exports.NonExhaustiveError = NonExhaustiveError;
|
|
1436
1586
|
exports.Ok = Ok;
|
|
1437
1587
|
exports.OkAsync = OkAsync;
|
|
1438
|
-
|
|
1439
|
-
enumerable: true,
|
|
1440
|
-
get: function() {
|
|
1441
|
-
return ts_pattern.P;
|
|
1442
|
-
}
|
|
1443
|
-
});
|
|
1588
|
+
exports.P = P;
|
|
1444
1589
|
exports.Result = Result;
|
|
1445
1590
|
exports.TaggedError = TaggedError;
|
|
1446
1591
|
exports.all = all;
|
|
@@ -1456,10 +1601,5 @@ exports.isDefect = isDefect;
|
|
|
1456
1601
|
exports.isErr = isErr;
|
|
1457
1602
|
exports.isOk = isOk;
|
|
1458
1603
|
exports.isResult = isResult;
|
|
1459
|
-
|
|
1460
|
-
enumerable: true,
|
|
1461
|
-
get: function() {
|
|
1462
|
-
return ts_pattern.match;
|
|
1463
|
-
}
|
|
1464
|
-
});
|
|
1604
|
+
exports.match = match;
|
|
1465
1605
|
exports.tag = tag;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,154 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/matcher.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Cross-copy brand for `P.*` pattern objects: `Symbol.for` yields the same
|
|
4
|
+
* symbol in every copy of the library (dual CJS/ESM, duplicated install,
|
|
5
|
+
* another realm), so a pattern built by one copy is recognised by another —
|
|
6
|
+
* the same rationale as `isResult`'s prototype brand.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
declare const PATTERN_BRAND: unique symbol;
|
|
11
|
+
declare const MATCHES: unique symbol;
|
|
12
|
+
declare const UNIVERSAL: unique symbol;
|
|
13
|
+
/**
|
|
14
|
+
* A `P.*` pattern: a runtime predicate plus the phantom type `M` it matches.
|
|
15
|
+
* The phantom is declaration-only (never present at runtime); it drives the
|
|
16
|
+
* type-level narrowing (`Extract`) and exhaustiveness (`Exclude`).
|
|
17
|
+
*
|
|
18
|
+
* @typeParam M - the type this pattern matches.
|
|
19
|
+
* @category Types
|
|
20
|
+
*/
|
|
21
|
+
type PatternMatcher<M> = {
|
|
22
|
+
readonly [PATTERN_BRAND]: (value: unknown) => boolean;
|
|
23
|
+
readonly [MATCHES]?: M;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The statically-known universal pattern — the type of `P._` / `P.any` only.
|
|
27
|
+
* The phantom `UNIVERSAL` marker is *required*, so no other
|
|
28
|
+
* `PatternMatcher<unknown>` (e.g. a `P.when` guard that happens to be
|
|
29
|
+
* universal) is assignable: the catch-all `.with` overload must only fire for
|
|
30
|
+
* a pattern the type system KNOWS covers everything.
|
|
31
|
+
*
|
|
32
|
+
* @category Types
|
|
33
|
+
*/
|
|
34
|
+
type UniversalPattern = PatternMatcher<unknown> & {
|
|
35
|
+
readonly [UNIVERSAL]: true;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The type a single pattern matches: a `P.*` matcher's phantom, an object
|
|
39
|
+
* literal mapped key-by-key (so `{ _tag: "A" }` matches the `"A"`-tagged
|
|
40
|
+
* variant), or the primitive literal itself.
|
|
41
|
+
*
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
type MatchedOf<Pt> = Pt extends PatternMatcher<infer M> ? M : Pt extends object ? { [K in keyof Pt]: MatchedOf<Pt[K]>; } : Pt;
|
|
45
|
+
/**
|
|
46
|
+
* The diagnostic type of `.exhaustive` on a builder that has NOT covered every
|
|
47
|
+
* case: not callable (so it fails the `ExhaustiveMatch` constraint at the call
|
|
48
|
+
* site), and it names the remaining cases so the error reads as a to-do list.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
type NonExhaustive<Remaining> = {
|
|
53
|
+
readonly "unthrown: this match is not exhaustive — add a `.with(…)` for the remaining cases": Remaining;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* The match builder over an input union `E`. `Remaining` tracks the cases not
|
|
57
|
+
* yet covered by a `.with(…)` arm; `O` accumulates the branch output union.
|
|
58
|
+
* `.exhaustive` is callable only once `Remaining` is `never` — which is what
|
|
59
|
+
* the `ExhaustiveMatch` constraint requires — and `.run()` executes it.
|
|
60
|
+
*
|
|
61
|
+
* @typeParam E - the full input union being matched.
|
|
62
|
+
* @typeParam Remaining - the cases not yet covered.
|
|
63
|
+
* @typeParam O - the union of branch return types so far.
|
|
64
|
+
* @category Types
|
|
65
|
+
*/
|
|
66
|
+
type Matcher<E, Remaining, O> = {
|
|
67
|
+
/**
|
|
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).
|
|
74
|
+
*/
|
|
75
|
+
with<O2>(pattern: UniversalPattern, handler: (value: Remaining) => O2): Matcher<E, never, O | O2>;
|
|
76
|
+
/**
|
|
77
|
+
* Add an arm: one or more patterns sharing a single handler (grouped
|
|
78
|
+
* patterns — `matcher.with(tag("A"), tag("B"), handler)`). The handler
|
|
79
|
+
* receives the input narrowed to what the patterns match (computed against
|
|
80
|
+
* `Remaining`, so cases already handled by earlier arms are excluded); the
|
|
81
|
+
* matched cases are subtracted from `Remaining`.
|
|
82
|
+
*/
|
|
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>;
|
|
84
|
+
/**
|
|
85
|
+
* Terminate the match. Typed callable only when every case is covered
|
|
86
|
+
* (`Remaining` is `never`); otherwise it is a branded diagnostic object
|
|
87
|
+
* naming the remaining cases, and the builder fails the `ExhaustiveMatch`
|
|
88
|
+
* constraint at the combinator call site.
|
|
89
|
+
*/
|
|
90
|
+
exhaustive: [Remaining] extends [never] ? () => O : NonExhaustive<Remaining>;
|
|
91
|
+
/**
|
|
92
|
+
* Execute the match (the combinators call this; it runs `.exhaustive()`).
|
|
93
|
+
* A value with no matching arm throws {@link NonExhaustiveError} —
|
|
94
|
+
* unreachable for well-typed callers.
|
|
95
|
+
*/
|
|
96
|
+
run(): O;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Thrown by `.run()` / `.exhaustive()` when no arm matched the value. For
|
|
100
|
+
* well-typed callers the match is exhaustive by construction, so this is only
|
|
101
|
+
* reachable by a value that slipped past the types (a widened cast, a raw-JS
|
|
102
|
+
* caller); inside the error combinators the throw-to-defect net converts it to
|
|
103
|
+
* a `Defect`, and at the `match` edge it surfaces (a genuinely unmodeled value
|
|
104
|
+
* is a bug).
|
|
105
|
+
*
|
|
106
|
+
* @category Errors
|
|
107
|
+
*/
|
|
108
|
+
declare class NonExhaustiveError extends Error {
|
|
109
|
+
/** The value no arm matched. */
|
|
110
|
+
readonly input: unknown;
|
|
111
|
+
constructor(input: unknown);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Begin a match over `value`. Chain `.with(pattern, …patterns, handler)` arms;
|
|
115
|
+
* terminate with `.exhaustive()` — or return the un-terminated builder to an
|
|
116
|
+
* unthrown error combinator / `match({ errCases })`, which runs it for you.
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* This is unthrown's own matcher (the former ts-pattern re-export): the same
|
|
120
|
+
* 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.
|
|
123
|
+
*
|
|
124
|
+
* @category Constructors
|
|
125
|
+
*/
|
|
126
|
+
declare function match<const E>(value: E): Matcher<E, E, never>;
|
|
127
|
+
/**
|
|
128
|
+
* The pattern namespace (unthrown's own; the former ts-pattern `P`):
|
|
129
|
+
*
|
|
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.
|
|
133
|
+
* - `P.instanceOf(Cls)` — an `instanceof` check, narrowing to the class
|
|
134
|
+
* instance type (for union members that are not tagged, e.g. a third-party
|
|
135
|
+
* error class).
|
|
136
|
+
* - `P.when(guard)` — an arbitrary type-guard predicate.
|
|
137
|
+
* - `P.union(…patterns)` — matches when any sub-pattern matches.
|
|
138
|
+
* - `P.string` / `P.number` — primitive-type wildcards.
|
|
139
|
+
*
|
|
140
|
+
* @category Constructors
|
|
141
|
+
*/
|
|
142
|
+
declare const P: Readonly<{
|
|
143
|
+
_: UniversalPattern;
|
|
144
|
+
any: UniversalPattern;
|
|
145
|
+
instanceOf: <C extends abstract new (...args: never[]) => unknown>(cls: C) => PatternMatcher<InstanceType<C>>;
|
|
146
|
+
when: <G>(guard: (value: unknown) => value is G) => PatternMatcher<G>;
|
|
147
|
+
union: <const Pts extends readonly [unknown, ...unknown[]]>(...patterns: Pts) => PatternMatcher<MatchedOf<Pts[number]>>;
|
|
148
|
+
string: PatternMatcher<string>;
|
|
149
|
+
number: PatternMatcher<number>;
|
|
150
|
+
}>;
|
|
151
|
+
//#endregion
|
|
2
152
|
//#region src/defect.d.ts
|
|
3
153
|
declare const DEFECT: unique symbol;
|
|
4
154
|
/**
|
|
@@ -55,23 +205,23 @@ type Bound<T, K extends string, U> = Prettify<Omit<T, K> & { readonly [P in K]:
|
|
|
55
205
|
*/
|
|
56
206
|
type NotThenable<R> = [R] extends [PromiseLike<unknown>] ? "unthrown: combinator callbacks are synchronous — lift async work with fromPromise and compose with flatMap" : unknown;
|
|
57
207
|
/**
|
|
58
|
-
* The
|
|
208
|
+
* The built-in match builder over an error union `E`, as produced by
|
|
59
209
|
* `match(error)`. This is what an error combinator's callback receives — chain
|
|
60
210
|
* `.with(pattern, handler)` on it; the combinator itself calls `.exhaustive()`,
|
|
61
211
|
* so the callback returns the **un-terminated** builder.
|
|
62
212
|
*
|
|
63
213
|
* @remarks
|
|
64
|
-
* Named via `ReturnType<typeof match<E>>`
|
|
65
|
-
*
|
|
214
|
+
* Named via `ReturnType<typeof match<E>>` (i.e. `Matcher<E, E, never>`),
|
|
215
|
+
* keeping this alias stable however the builder evolves.
|
|
66
216
|
*
|
|
67
217
|
* @typeParam E - the error union being matched.
|
|
68
218
|
* @category Types
|
|
69
219
|
*/
|
|
70
|
-
type ErrMatcher<E> = ReturnType<typeof match
|
|
220
|
+
type ErrMatcher<E> = ReturnType<typeof match<E>>;
|
|
71
221
|
/**
|
|
72
222
|
* The shape an error-combinator callback must return: an **exhaustive**
|
|
73
|
-
*
|
|
74
|
-
* that hasn't covered every case
|
|
223
|
+
* match builder. `exhaustive` is required to be *callable* — on a builder
|
|
224
|
+
* that hasn't covered every case the matcher types it as a branded diagnostic
|
|
75
225
|
* (not a function), so a non-exhaustive chain fails to satisfy this and errors
|
|
76
226
|
* at the call site. `run` carries the output type.
|
|
77
227
|
*
|
|
@@ -267,7 +417,7 @@ type ResultMethods<out T, out E> = {
|
|
|
267
417
|
*/
|
|
268
418
|
ensure<E2>(predicate: (value: T) => boolean, onFail: (value: T) => E2 & NotThenable<E2>): Result$1<T, E | E2>;
|
|
269
419
|
/**
|
|
270
|
-
* Transform the modeled error by **matching it exhaustively
|
|
420
|
+
* Transform the modeled error by **matching it exhaustively**.
|
|
271
421
|
*
|
|
272
422
|
* @remarks
|
|
273
423
|
* The callback receives `match(error)` (an {@link ErrMatcher}) and the
|
|
@@ -281,7 +431,7 @@ type ResultMethods<out T, out E> = {
|
|
|
281
431
|
* pass through. A branch that throws also becomes a `Defect`.
|
|
282
432
|
*
|
|
283
433
|
* `.with(P._, …)` is the deliberate uniform/catch-all (it makes the match
|
|
284
|
-
* exhaustive). Match on anything
|
|
434
|
+
* exhaustive). Match on anything the matcher supports — `_tag`, `code`,
|
|
285
435
|
* structural shape, guards, or grouped patterns `.with(a, b, handler)`.
|
|
286
436
|
*
|
|
287
437
|
* @typeParam M - the exhaustive builder the callback returns.
|
|
@@ -411,25 +561,26 @@ type ResultMethods<out T, out E> = {
|
|
|
411
561
|
* is typically the single place a pipeline is handled at the edge — mapping
|
|
412
562
|
* `Ok`/`Err`/`Defect` to (for example) 2xx / 4xx / 5xx with no `try`/`catch`.
|
|
413
563
|
*
|
|
414
|
-
* The `
|
|
564
|
+
* The `errCases` handler does not take a single blanket callback: it receives
|
|
415
565
|
* `match(error)` (an {@link ErrMatcher}) and **matches the error exhaustively**,
|
|
416
|
-
* exactly like the error combinators
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* `
|
|
423
|
-
*
|
|
566
|
+
* exactly like the error combinators — which is why the key carries the same
|
|
567
|
+
* `…Cases` suffix. Chain `.with(pattern, handler)` and **return the
|
|
568
|
+
* 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
|
|
571
|
+
* receive **no `defect` helper** — `match` is total elimination to a value,
|
|
572
|
+
* with no `Defect` output channel; the `defect` case handles a `Result` that
|
|
573
|
+
* already carries one. (A `Result` is also a discriminated union — for richer
|
|
574
|
+
* whole-`Result` matching, `match(result).with(…)`.)
|
|
424
575
|
*
|
|
425
576
|
* @typeParam ROk - the `ok` handler return type.
|
|
426
577
|
* @typeParam RDefect - the `defect` handler return type.
|
|
427
|
-
* @typeParam M - the exhaustive builder the `
|
|
428
|
-
* @param cases - the `ok`/`defect` handlers plus the `
|
|
578
|
+
* @typeParam M - the exhaustive builder the `errCases` handler returns.
|
|
579
|
+
* @param cases - the `ok`/`defect` handlers plus the `errCases` matcher builder.
|
|
429
580
|
*/
|
|
430
581
|
match<ROk, RDefect, M extends ExhaustiveMatch<unknown>>(cases: {
|
|
431
582
|
ok: (value: T) => ROk;
|
|
432
|
-
|
|
583
|
+
errCases: (matcher: ErrMatcher<E>) => M;
|
|
433
584
|
defect: (cause: unknown) => RDefect;
|
|
434
585
|
}): ROk | RDefect | MatchOut<M>;
|
|
435
586
|
/**
|
|
@@ -515,7 +666,7 @@ type ResultMethods<out T, out E> = {
|
|
|
515
666
|
* @throws the modeled `error` on `Err`; re-throws the original `cause` on a
|
|
516
667
|
* `Defect` (a panic, like the rest of the `getOr…` family).
|
|
517
668
|
*/
|
|
518
|
-
getOrThrow(this: [E] extends [never] ? never : Result$1<T, E>): T;
|
|
669
|
+
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
670
|
/** Whether this result is `Ok` — narrows `this` to its {@link OkView} on `true`. */
|
|
520
671
|
isOk(): this is OkView<T, E>;
|
|
521
672
|
/** Whether this result is `Err` — narrows `this` to its {@link ErrView} on `true`. */
|
|
@@ -619,7 +770,7 @@ type FailureView<E, T = never> = ErrView<E, T> | DefectView<T, E>;
|
|
|
619
770
|
* never appears in `E`; it is the library's third, out-of-band channel.
|
|
620
771
|
*
|
|
621
772
|
* Because it is a real union, you can match it natively (a `switch` on `tag`, or
|
|
622
|
-
*
|
|
773
|
+
* the built-in `match(...).with({ tag: "Ok" }, …).exhaustive()`), *and* it
|
|
623
774
|
* carries the full method surface ({@link ResultMethods}) for fluent chaining.
|
|
624
775
|
* Either way, the payload (`value`/`error`/`cause`) is only reachable after you
|
|
625
776
|
* narrow — so "check before you access" still holds.
|
|
@@ -637,7 +788,7 @@ type FailureView<E, T = never> = ErrView<E, T> | DefectView<T, E>;
|
|
|
637
788
|
*
|
|
638
789
|
* const message = half(10).match({
|
|
639
790
|
* ok: (n) => `got ${n}`,
|
|
640
|
-
*
|
|
791
|
+
* errCases: (matcher) => matcher.with(P._, (e) => `failed: ${e}`),
|
|
641
792
|
* defect: (cause) => `bug: ${String(cause)}`,
|
|
642
793
|
* });
|
|
643
794
|
* ```
|
|
@@ -816,12 +967,12 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
816
967
|
tapFailure<R>(f: (failure: FailureView<E, T>) => R & NotThenable<R>): AsyncResult$1<T, E>;
|
|
817
968
|
/**
|
|
818
969
|
* Asynchronous {@link ResultMethods.match | match}. Handlers are synchronous
|
|
819
|
-
* (the `
|
|
970
|
+
* (the `errCases` handler returns an exhaustive {@link ErrMatcher} builder, no
|
|
820
971
|
* `defect` helper); resolves to a `Promise` of the folded value.
|
|
821
972
|
*/
|
|
822
973
|
match<ROk, RDefect, M extends ExhaustiveMatch<unknown>>(cases: {
|
|
823
974
|
ok: (value: T) => ROk;
|
|
824
|
-
|
|
975
|
+
errCases: (matcher: ErrMatcher<E>) => M;
|
|
825
976
|
defect: (cause: unknown) => RDefect;
|
|
826
977
|
}): Promise<ROk | RDefect | MatchOut<M>>;
|
|
827
978
|
/**
|
|
@@ -850,7 +1001,7 @@ type AsyncResultMethods<out T, out E> = {
|
|
|
850
1001
|
* on a `Defect`), rather than throwing synchronously. Gated the same way: it
|
|
851
1002
|
* compiles only when the error channel is non-empty (`E` is not `never`).
|
|
852
1003
|
*/
|
|
853
|
-
getOrThrow(this: [E] extends [never] ? never : AsyncResult$1<T, E>): Promise<T>;
|
|
1004
|
+
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
1005
|
};
|
|
855
1006
|
/**
|
|
856
1007
|
* The asynchronous counterpart of {@link Result}: an awaitable wrapper carrying
|
|
@@ -1173,7 +1324,8 @@ declare class GetError<E = unknown> extends Error {
|
|
|
1173
1324
|
* isResult(Ok(1).toAsync()); // => false (an AsyncResult is not a Result)
|
|
1174
1325
|
*
|
|
1175
1326
|
* const x: unknown = Ok(1);
|
|
1176
|
-
* if (isResult(x))
|
|
1327
|
+
* if (isResult(x))
|
|
1328
|
+
* x.match({ ok: () => 1, errCases: (m) => m.with(P._, () => 0), defect: () => -1 });
|
|
1177
1329
|
* ```
|
|
1178
1330
|
*
|
|
1179
1331
|
* @category Guards
|
|
@@ -1744,7 +1896,7 @@ declare function TaggedError<Tag extends string>(tag: Tag, options?: {
|
|
|
1744
1896
|
readonly name?: string;
|
|
1745
1897
|
}): TaggedErrorConstructor<Tag>;
|
|
1746
1898
|
/**
|
|
1747
|
-
* A
|
|
1899
|
+
* A matcher pattern matching any value whose `_tag` equals `value` — a
|
|
1748
1900
|
* {@link TaggedError}, or any discriminated member. Equivalent to the object
|
|
1749
1901
|
* pattern `{ _tag: value }`, but reads better inside an error-matching
|
|
1750
1902
|
* combinator and narrows to the matching variant, payload included.
|
|
@@ -1767,5 +1919,5 @@ declare function tag<const Tag extends string>(value: Tag): {
|
|
|
1767
1919
|
_tag: Tag;
|
|
1768
1920
|
};
|
|
1769
1921
|
//#endregion
|
|
1770
|
-
export { type AsyncErrOf, type AsyncOkOf, AsyncResult, type AsyncResultMethods, type Awaitable, type DefectView, Do, DoAsync, Err, ErrAsync, type ErrMatcher, type ErrOf, type ErrView, type FailureView, GetError, type NotThenable, Ok, OkAsync, type OkOf, type OkView, P, Result, type ResultMethods, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, all, allAsync, allFromDict, allFromDictAsync, fromNullable, fromPromise, fromSafePromise, fromSafeThrowable, fromThrowable, isDefect, isErr, isOk, isResult, match, tag };
|
|
1922
|
+
export { type AsyncErrOf, type AsyncOkOf, AsyncResult, type AsyncResultMethods, type Awaitable, type DefectView, Do, DoAsync, Err, ErrAsync, type ErrMatcher, type ErrOf, type ErrView, type FailureView, GetError, type Matcher, NonExhaustiveError, type NotThenable, Ok, OkAsync, type OkOf, type OkView, P, type PatternMatcher, Result, type ResultMethods, TaggedError, type TaggedErrorConstructor, type TaggedErrorInstance, type UniversalPattern, all, allAsync, allFromDict, allFromDictAsync, fromNullable, fromPromise, fromSafePromise, fromSafeThrowable, fromThrowable, isDefect, isErr, isOk, isResult, match, tag };
|
|
1771
1923
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -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":";;
|
|
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;;;;;;;;EAQ9F,WAAW,8CAA8C,OACpD,UAAU,UAAU,KAAK,UAAU,OAAO,QAAQ,WAAW,UAAU,kBAAkB,MAC3F,QAAQ,GAAG,QAAQ,WAAW,UAAU,eAAe,IAAI;;;;;;;EAQ9D,aAAa,mCAAmC,IAAI,cAAc;;;;;;EAOlE,OAAO;;;;;;;;;;;;cAaI,2BAA2B;;WAE7B;EACG,YAAA;;;;;;;;;;;;;;;iBA8GE,YAAY,GAAG,OAAO,IAAI,QAAQ,GAAG;;;;;;;;;;;;;;;;cA6BxC,GAAC;;;EAGC,aAAA,2BAA2B,2BAAyB,KAC1D,MACJ,eAAe,aAAa;EACxB,OAAA,GAAC,QAAU,mBAAmB,SAAS,MAAI,eAAe;EACnD,cAAA,iDAA4C,UAC3C,QACZ,eAAe,UAAU;;;;;;cCvSxB;;;;;;;;;;;;;;;KAgBM;YACA;WACD;;;;;;;;;;KCTC,SAAS,QAAQ,WAAW,IAAI,EAAE;;;;;;;;;KAUlC,MAAM,GAAG,kBA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