@duplojs/utils 1.4.37 → 1.4.38
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type EitherRight } from "./create";
|
|
2
2
|
import { type EitherLeft } from "../left";
|
|
3
3
|
import { type MaybeFutureEither } from "../future/maybeFutureEither";
|
|
4
|
-
import { type Future } from "../future";
|
|
4
|
+
import { type EitherFutureError, type Future } from "../future";
|
|
5
5
|
import { type EitherSuccess } from "./success";
|
|
6
6
|
import { type AnyValue, type Unwrap } from "../../common";
|
|
7
7
|
type Either = EitherRight | EitherLeft;
|
|
8
8
|
export type EitherRightAsyncPipeFunction<GenericInput extends AnyValue = AnyValue, GenericOutput extends MaybeFutureEither<AnyValue> = MaybeFutureEither<AnyValue>> = (input: Awaited<GenericInput> extends infer InferredInput ? InferredInput extends Either ? Unwrap<Exclude<InferredInput, EitherLeft>> : InferredInput : never) => GenericOutput;
|
|
9
|
-
export type EitherRightAsyncPipeResult<GenericPipeOutputs extends AnyValue, GenericLastPipeOutput extends AnyValue> = Extract<Awaited<GenericPipeOutputs>, EitherLeft> | (Awaited<GenericLastPipeOutput> extends infer InferredLastResult ? Exclude<InferredLastResult extends Either ? InferredLastResult : EitherSuccess<InferredLastResult>, EitherLeft> : never);
|
|
9
|
+
export type EitherRightAsyncPipeResult<GenericPipeOutputs extends AnyValue, GenericLastPipeOutput extends AnyValue> = (Extract<Awaited<GenericPipeOutputs>, EitherLeft> | (Awaited<GenericLastPipeOutput> extends infer InferredLastResult ? Exclude<InferredLastResult extends Either ? InferredLastResult : EitherSuccess<InferredLastResult>, EitherLeft> : never) | (Promise<any> extends Exclude<GenericPipeOutputs, Future<any>> ? EitherFutureError : never));
|
|
10
10
|
/**
|
|
11
11
|
* Asynchronous version of rightPipe. Automatically handles promises, Future, and Either, and short-circuits on the first Left.
|
|
12
12
|
*
|