We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ed0ab0 commit 7dfe927Copy full SHA for 7dfe927
packages/try-catch-tuple/src/tryCatch.ts
@@ -1,6 +1,11 @@
1
type Branded<T> = T & { __tryCatchTupleResult: any };
2
-type Success<T> = Branded<[data: T, error: null]>;
3
-type Failure<E extends Error> = Branded<[data: null, error: E | Error]>;
+
+type DataErrorTuple<T, E> = Branded<
4
+ [data: T, error: E]
5
+>;
6
7
+type Success<T> = DataErrorTuple<T, null>;
8
+type Failure<E extends Error> = DataErrorTuple<null, E | Error>;
9
type Result<T, E extends Error> = Success<T> | Failure<E>;
10
11
type TryCatchResult<T, E extends Error> = T extends Promise<infer U>
0 commit comments