|
5 | 5 | type IfGeneratorAsync, |
6 | 6 | type InferGeneratorError, |
7 | 7 | type InferGeneratorReturn, |
8 | | - Result as ResultBase, |
| 8 | + type Result as ResultBase, |
| 9 | + ResultFactory, |
9 | 10 | } from "./result.js"; |
10 | 11 |
|
11 | 12 | export { AsyncResult } from "./result.js"; |
@@ -36,38 +37,4 @@ export type Result<Value, Err> = |
36 | 37 | | ([Value] extends [never] ? never : Result.Ok<Value>) |
37 | 38 | | ([Err] extends [never] ? never : Result.Error<Err>); |
38 | 39 |
|
39 | | -export const Result: { |
40 | | - ok: typeof ResultBase.ok; |
41 | | - error: typeof ResultBase.error; |
42 | | - assertOk: typeof ResultBase.assertOk; |
43 | | - assertError: typeof ResultBase.assertError; |
44 | | - isResult: typeof ResultBase.isResult; |
45 | | - isAsyncResult: typeof ResultBase.isAsyncResult; |
46 | | - all: typeof ResultBase.all; |
47 | | - allCatching: typeof ResultBase.allCatching; |
48 | | - wrap: typeof ResultBase.wrap; |
49 | | - try: typeof ResultBase.try; |
50 | | - fromAsync: typeof ResultBase.fromAsync; |
51 | | - fromAsyncCatching: typeof ResultBase.fromAsyncCatching; |
52 | | - gen: typeof ResultBase.gen; |
53 | | - genCatching: typeof ResultBase.genCatching; |
54 | | - [Symbol.hasInstance]: (instance: unknown) => boolean; |
55 | | -} = { |
56 | | - ok: ResultBase.ok, |
57 | | - error: ResultBase.error, |
58 | | - isResult: ResultBase.isResult, |
59 | | - isAsyncResult: ResultBase.isAsyncResult, |
60 | | - all: ResultBase.all, |
61 | | - allCatching: ResultBase.allCatching, |
62 | | - wrap: ResultBase.wrap, |
63 | | - try: ResultBase.try, |
64 | | - fromAsync: ResultBase.fromAsync, |
65 | | - fromAsyncCatching: ResultBase.fromAsyncCatching, |
66 | | - gen: ResultBase.gen, |
67 | | - genCatching: ResultBase.genCatching, |
68 | | - assertOk: ResultBase.assertOk, |
69 | | - assertError: ResultBase.assertError, |
70 | | - [Symbol.hasInstance](instance: unknown) { |
71 | | - return instance instanceof ResultBase; |
72 | | - }, |
73 | | -}; |
| 40 | +export const Result: typeof ResultFactory = ResultFactory; |
0 commit comments