@nlozgachev/pipelined 0.32.0 → 0.34.0

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/core.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { M as Maybe, W as WithValue, c as WithLog, D as Deferred, R as Result, d as WithKind, e as WithError, f as RetryOptions, g as TimeoutOptions, h as WithTimeout, i as WithMinInterval, j as WithCooldown, k as WithConcurrency, l as WithSize, m as WithMs, n as WithN, T as Task, o as WithErrors, p as WithFirst, q as WithSecond } from './Task-CJZfcOkO.mjs';
2
- export { E as Equality, a as Error, N as None, O as Ok, b as Ordering, S as Some } from './Task-CJZfcOkO.mjs';
3
- import { N as NonEmptyList } from './NonEmptyList-BlGFjor5.mjs';
1
+ import { M as Maybe, W as WithValue, c as WithLog, D as Deferred, R as Result, d as WithKind, e as WithError, f as RetryOptions, g as TimeoutOptions, h as WithTimeout, i as WithMinInterval, j as WithCooldown, k as WithConcurrency, l as WithSize, m as WithDuration, n as WithN, T as Task, o as WithErrors, p as WithFirst, q as WithSecond } from './Task-DXsuurnc.mjs';
2
+ export { E as Equality, a as Err, N as None, O as Ok, b as Ordering, S as Some } from './Task-DXsuurnc.mjs';
3
+ import { Duration, NonEmptyList } from './types.mjs';
4
4
 
5
5
  /**
6
6
  * A type that can combine two values of type `A` into one, with a neutral starting value.
@@ -588,12 +588,12 @@ type AllInterpretOptions<I, E> = ({
588
588
  strategy: "debounced";
589
589
  retry?: RetryOptions<E>;
590
590
  leading?: true;
591
- maxWait?: number;
592
- } & WithMs & WithTimeout<E>) | ({
591
+ maxWait?: Duration;
592
+ } & WithDuration & WithTimeout<E>) | ({
593
593
  strategy: "throttled";
594
594
  retry?: RetryOptions<E>;
595
595
  trailing?: true;
596
- } & WithMs & WithTimeout<E>) | ({
596
+ } & WithDuration & WithTimeout<E>) | ({
597
597
  strategy: "concurrent";
598
598
  retry?: RetryOptions<E>;
599
599
  overflow?: "queue" | "drop";
@@ -671,7 +671,7 @@ type InterpretResult<I, E, A, O> = [O] extends [{
671
671
  * manager.subscribe(state => {
672
672
  * if (Op.isPending(state)) showSpinner();
673
673
  * if (Op.isOk(state)) render(state.value);
674
- * if (Op.isError(state)) showError(state.error);
674
+ * if (Op.isErr(state)) showError(state.error);
675
675
  * if (Op.isNil(state)) resetUI();
676
676
  * });
677
677
  * manager.run(userId);
@@ -696,11 +696,11 @@ declare namespace Op {
696
696
  * over a call that was already running; `"evicted"` — a newer `run()` took over
697
697
  * a call that was waiting and had not yet started.
698
698
  */
699
- type Outcome<E, A> = Ok<A> | Error<E> | Nil;
699
+ type Outcome<E, A> = Ok<A> | Err<E> | Nil;
700
700
  /** A successful outcome with a value. */
701
701
  type Ok<A> = WithKind<"OpOk"> & WithValue<A>;
702
702
  /** A failed outcome with a typed error. */
703
- type Error<E> = WithKind<"OpError"> & WithError<E>;
703
+ type Err<E> = WithKind<"OpErr"> & WithError<E>;
704
704
  /**
705
705
  * An outcome that produced nothing. `reason` identifies why:
706
706
  * - `"aborted"` — `abort()` was called explicitly.
@@ -759,7 +759,7 @@ declare namespace Op {
759
759
  * manager.subscribe(state => {
760
760
  * if (Op.isPending(state)) lockForm();
761
761
  * if (Op.isOk(state)) toast("Saved");
762
- * if (Op.isError(state)) toast(`Error: ${state.error.message}`);
762
+ * if (Op.isErr(state)) toast(`Error: ${state.error.message}`);
763
763
  * });
764
764
  *
765
765
  * // Fire and subscribe (subscriber pattern)
@@ -797,7 +797,7 @@ declare namespace Op {
797
797
  * Returns a stop handle — call it to cancel future runs.
798
798
  */
799
799
  poll: (input: I, options: {
800
- interval: number;
800
+ interval: Duration;
801
801
  }) => () => void;
802
802
  };
803
803
  /**
@@ -848,65 +848,65 @@ declare namespace Op {
848
848
  * Returns a stop handle — call it to cancel future runs.
849
849
  */
850
850
  poll: (input: I, options: {
851
- interval: number;
851
+ interval: Duration;
852
852
  }) => () => void;
853
853
  };
854
854
  /** States reachable by a `once` manager (no retry). */
855
- type OnceState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | DroppedNil;
855
+ type OnceState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | DroppedNil;
856
856
  /** States reachable by a `once` manager with retry configured. */
857
- type RetryableOnceState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil;
857
+ type RetryableOnceState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil;
858
858
  /** States reachable by a `restartable` manager (no retry). */
859
- type RestartableState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | ReplacedNil;
859
+ type RestartableState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | ReplacedNil;
860
860
  /** States reachable by a `restartable` manager with retry configured. */
861
- type RetryableRestartableState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | ReplacedNil;
861
+ type RetryableRestartableState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | ReplacedNil;
862
862
  /** States reachable by an `exclusive` manager (no retry). */
863
- type ExclusiveState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | DroppedNil;
863
+ type ExclusiveState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | DroppedNil;
864
864
  /** States reachable by an `exclusive` manager with retry configured. */
865
- type RetryableExclusiveState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil;
865
+ type RetryableExclusiveState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil;
866
866
  /** States reachable by a `queue` manager (no retry, no overflow, no dedupe). */
867
- type QueueState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil;
867
+ type QueueState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil;
868
868
  /** States reachable by a `queue` manager with retry (no overflow, no dedupe). */
869
- type RetryableQueueState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil;
869
+ type RetryableQueueState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil;
870
870
  /** States reachable by a `queue` manager with `overflow:"drop"` or `dedupe` (no retry). */
871
- type QueueDropState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil | DroppedNil;
871
+ type QueueDropState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil | DroppedNil;
872
872
  /** States reachable by a `queue` manager with `overflow:"drop"` or `dedupe`, with retry. */
873
- type RetryableQueueDropState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil;
873
+ type RetryableQueueDropState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil;
874
874
  /** States reachable by a `queue` manager with `overflow:"replace-last"` and no `dedupe` (no retry). */
875
- type QueueReplaceState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil | EvictedNil;
875
+ type QueueReplaceState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil | EvictedNil;
876
876
  /** States reachable by a `queue` manager with `overflow:"replace-last"` and no `dedupe`, with retry. */
877
- type RetryableQueueReplaceState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil | EvictedNil;
877
+ type RetryableQueueReplaceState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil | EvictedNil;
878
878
  /** States reachable by a `queue` manager with `overflow:"replace-last"` AND `dedupe` (no retry). */
879
- type QueueDropAndReplaceState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil | DroppedNil | EvictedNil;
879
+ type QueueDropAndReplaceState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil | DroppedNil | EvictedNil;
880
880
  /** States reachable by a `queue` manager with `overflow:"replace-last"` AND `dedupe`, with retry. */
881
- type RetryableQueueDropAndReplaceState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil | EvictedNil;
881
+ type RetryableQueueDropAndReplaceState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil | EvictedNil;
882
882
  /** States reachable by a `buffered` manager (no retry). */
883
- type BufferedState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil | EvictedNil;
883
+ type BufferedState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil | EvictedNil;
884
884
  /** States reachable by a `buffered` manager with retry configured. */
885
- type RetryableBufferedState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil | EvictedNil;
885
+ type RetryableBufferedState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil | EvictedNil;
886
886
  /** States reachable by a `debounced` manager (no retry). */
887
- type DebouncedState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | EvictedNil;
887
+ type DebouncedState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | EvictedNil;
888
888
  /** States reachable by a `debounced` manager with retry configured. */
889
- type RetryableDebouncedState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | EvictedNil;
889
+ type RetryableDebouncedState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | EvictedNil;
890
890
  /** States reachable by a `throttled` manager (leading-only, no retry). */
891
- type ThrottledState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | DroppedNil;
891
+ type ThrottledState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | DroppedNil;
892
892
  /** States reachable by a `throttled` manager (leading-only, with retry). */
893
- type RetryableThrottledState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil;
893
+ type RetryableThrottledState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil;
894
894
  /** States reachable by a `throttled` manager with `trailing: true` (no retry). */
895
- type ThrottledTrailingState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | EvictedNil;
895
+ type ThrottledTrailingState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | EvictedNil;
896
896
  /** States reachable by a `throttled` manager with `trailing: true` and retry. */
897
- type RetryableThrottledTrailingState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | EvictedNil;
897
+ type RetryableThrottledTrailingState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | EvictedNil;
898
898
  /** States reachable by a `concurrent` manager with `overflow: "queue"` (no retry). */
899
- type ConcurrentQueueState<E, A> = Idle | Pending | Queued | Ok<A> | Error<E> | AbortedNil;
899
+ type ConcurrentQueueState<E, A> = Idle | Pending | Queued | Ok<A> | Err<E> | AbortedNil;
900
900
  /** States reachable by a `concurrent` manager with `overflow: "queue"` and retry. */
901
- type RetryableConcurrentQueueState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Error<E> | AbortedNil;
901
+ type RetryableConcurrentQueueState<E, A> = Idle | Pending | Queued | Retrying<E> | Ok<A> | Err<E> | AbortedNil;
902
902
  /** States reachable by a `concurrent` manager with `overflow: "drop"` (no retry). */
903
- type ConcurrentDropState<E, A> = Idle | Pending | Ok<A> | Error<E> | AbortedNil | DroppedNil;
903
+ type ConcurrentDropState<E, A> = Idle | Pending | Ok<A> | Err<E> | AbortedNil | DroppedNil;
904
904
  /** States reachable by a `concurrent` manager with `overflow: "drop"` and retry. */
905
- type RetryableConcurrentDropState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Error<E> | AbortedNil | DroppedNil;
905
+ type RetryableConcurrentDropState<E, A> = Idle | Pending | Retrying<E> | Ok<A> | Err<E> | AbortedNil | DroppedNil;
906
906
  /** Per-key state union for a `keyed` manager with `perKey: "exclusive"`. */
907
- type KeyedExclusivePerKey<E, A> = Pending | Ok<A> | Error<E> | AbortedNil | DroppedNil;
907
+ type KeyedExclusivePerKey<E, A> = Pending | Ok<A> | Err<E> | AbortedNil | DroppedNil;
908
908
  /** Per-key state union for a `keyed` manager with `perKey: "restartable"`. */
909
- type KeyedRestartablePerKey<E, A> = Pending | Ok<A> | Error<E> | AbortedNil | ReplacedNil;
909
+ type KeyedRestartablePerKey<E, A> = Pending | Ok<A> | Err<E> | AbortedNil | ReplacedNil;
910
910
  type RetryOptions<E> = RetryOptions<E>;
911
911
  type TimeoutOptions<E> = TimeoutOptions<E>;
912
912
  /**
@@ -991,10 +991,10 @@ declare namespace Op {
991
991
  *
992
992
  * @example
993
993
  * ```ts
994
- * Op.error(new ApiError("not found")); // { kind: "OpError", error: ApiError }
994
+ * Op.err(new ApiError("not found")); // { kind: "OpErr", error: ApiError }
995
995
  * ```
996
996
  */
997
- const error: <E>(error: E) => Error<E>;
997
+ const err: <E>(error: E) => Err<E>;
998
998
  /**
999
999
  * Returns `true` if the state is `Idle`.
1000
1000
  *
@@ -1051,16 +1051,16 @@ declare namespace Op {
1051
1051
  */
1052
1052
  const isOk: <E, A>(state: State<E, A>) => state is Ok<A>;
1053
1053
  /**
1054
- * Returns `true` if the state is `Error` (the operation failed with a typed error).
1054
+ * Returns `true` if the state is `Err` (the operation failed with a typed error).
1055
1055
  *
1056
1056
  * @example
1057
1057
  * ```ts
1058
1058
  * manager.subscribe(state => {
1059
- * if (Op.isError(state)) showError(state.error);
1059
+ * if (Op.isErr(state)) showError(state.error);
1060
1060
  * });
1061
1061
  * ```
1062
1062
  */
1063
- const isError: <E, A>(state: State<E, A>) => state is Error<E>;
1063
+ const isErr: <E, A>(state: State<E, A>) => state is Err<E>;
1064
1064
  /**
1065
1065
  * Returns `true` if the state is `Nil` (the operation completed without a value or error).
1066
1066
  *
@@ -1079,19 +1079,19 @@ declare namespace Op {
1079
1079
  * ```ts
1080
1080
  * Op.match({
1081
1081
  * ok: (user) => render(user),
1082
- * error: (e) => showError(e.message),
1082
+ * err: (e) => showError(e.message),
1083
1083
  * nil: () => resetUI(),
1084
1084
  * })(outcome);
1085
1085
  * ```
1086
1086
  */
1087
1087
  const match: <E, A, B>(cases: {
1088
1088
  ok: (a: A) => B;
1089
- error: (e: E) => B;
1089
+ err: (e: E) => B;
1090
1090
  nil: () => B;
1091
1091
  }) => (outcome: Outcome<E, A>) => B;
1092
1092
  /**
1093
1093
  * Eliminates an Outcome with positional handlers.
1094
- * Order: `onError`, `onOk`, `onNil` — mirrors `Result.fold` for the first two.
1094
+ * Order: `onErr`, `onOk`, `onNil` — mirrors `Result.fold` for the first two.
1095
1095
  *
1096
1096
  * @example
1097
1097
  * ```ts
@@ -1102,7 +1102,7 @@ declare namespace Op {
1102
1102
  * )(outcome);
1103
1103
  * ```
1104
1104
  */
1105
- const fold: <E, A, B>(onError: (e: E) => B, onOk: (a: A) => B, onNil: () => B) => (outcome: Outcome<E, A>) => B;
1105
+ const fold: <E, A, B>(onErr: (e: E) => B, onOk: (a: A) => B, onNil: () => B) => (outcome: Outcome<E, A>) => B;
1106
1106
  /**
1107
1107
  * Returns the success value, or the result of `defaultValue()` for `Err` or `Nil`.
1108
1108
  *
@@ -1137,7 +1137,7 @@ declare namespace Op {
1137
1137
  * ```ts
1138
1138
  * pipe(
1139
1139
  * outcome,
1140
- * Op.chain(user => user.active ? Op.ok(user) : Op.error(new Error("inactive"))),
1140
+ * Op.chain(user => user.active ? Op.ok(user) : Op.err(new Error("inactive"))),
1141
1141
  * );
1142
1142
  * ```
1143
1143
  */
@@ -1158,7 +1158,7 @@ declare namespace Op {
1158
1158
  * ```ts
1159
1159
  * pipe(
1160
1160
  * outcome,
1161
- * Op.recover(e => e.isRetryable ? Op.ok(cachedValue) : Op.error(e)),
1161
+ * Op.recover(e => e.isRetryable ? Op.ok(cachedValue) : Op.err(e)),
1162
1162
  * );
1163
1163
  * ```
1164
1164
  */
@@ -1369,7 +1369,7 @@ declare namespace Refinement {
1369
1369
  * Converts a `Refinement<A, B>` into a function `(a: A) => Maybe<B>`.
1370
1370
  *
1371
1371
  * Returns `Some(a)` when the refinement holds, `None` otherwise. Useful for
1372
- * integrating runtime validation into an `Maybe`-based pipeline.
1372
+ * integrating runtime validation into a `Maybe`-based pipeline.
1373
1373
  *
1374
1374
  * @example
1375
1375
  * ```ts
@@ -1905,7 +1905,7 @@ declare namespace RemoteData {
1905
1905
  */
1906
1906
  const recover: <E, A, B>(fallback: (e: E) => RemoteData<E, B>) => (data: RemoteData<E, A>) => RemoteData<E, A | B>;
1907
1907
  /**
1908
- * Converts a RemoteData to an Maybe.
1908
+ * Converts a RemoteData to a Maybe.
1909
1909
  * Success becomes Some, all other states become None.
1910
1910
  */
1911
1911
  const toMaybe: <E, A>(data: RemoteData<E, A>) => Maybe<A>;
@@ -1984,6 +1984,25 @@ declare namespace TaskResult {
1984
1984
  * Creates a failed TaskResult with the given error.
1985
1985
  */
1986
1986
  const err: <E, A>(error: E) => TaskResult<E, A>;
1987
+ /**
1988
+ * Creates a TaskResult from a nullable value.
1989
+ * Returns Ok if the value is not null or undefined, err from onNull otherwise.
1990
+ */
1991
+ const fromNullable: <E>(onNull: () => E) => <A>(value: A | null | undefined) => TaskResult<E, A>;
1992
+ /**
1993
+ * Creates a TaskResult from a Maybe.
1994
+ * Some becomes Ok, None becomes err from onNone.
1995
+ */
1996
+ const fromMaybe: <E>(onNone: () => E) => <A>(maybe: Maybe<A>) => TaskResult<E, A>;
1997
+ /**
1998
+ * Lifts a Result into a TaskResult.
1999
+ */
2000
+ const fromResult: <E, A>(result: Result<E, A>) => TaskResult<E, A>;
2001
+ /**
2002
+ * Wraps a Promise-returning function of any arguments, returning a new function
2003
+ * that catches rejections and returns a TaskResult.
2004
+ */
2005
+ const fromThrowable: <Args extends readonly unknown[], A, E>(f: (...args: Args) => Promise<A>, onError: (e: unknown) => E) => (...args: Args) => TaskResult<E, A>;
1987
2006
  /**
1988
2007
  * Creates a TaskResult from a function that may throw.
1989
2008
  * Catches any errors and transforms them using the onError function.
@@ -2392,6 +2411,16 @@ declare namespace TaskMaybe {
2392
2411
  * Lifts an Option into a TaskMaybe.
2393
2412
  */
2394
2413
  const fromMaybe: <A>(option: Maybe<A>) => TaskMaybe<A>;
2414
+ /**
2415
+ * Creates a TaskMaybe from a nullable value.
2416
+ * Returns Some if the value is not null or undefined, None otherwise.
2417
+ */
2418
+ const fromNullable: <A>(value: A | null | undefined) => TaskMaybe<A>;
2419
+ /**
2420
+ * Creates a TaskMaybe from a Result.
2421
+ * Ok becomes Some, Error becomes None (the error value is discarded).
2422
+ */
2423
+ const fromResult: <E, A>(result: Result<E, A>) => TaskMaybe<A>;
2395
2424
  /**
2396
2425
  * Lifts a Task into a TaskMaybe by wrapping its result in Some.
2397
2426
  */
@@ -2481,11 +2510,11 @@ declare namespace TaskMaybe {
2481
2510
  const toTaskResult: <E>(onNone: () => E) => <A>(data: TaskMaybe<A>) => TaskResult<E, A>;
2482
2511
  }
2483
2512
 
2484
- type Valid<A> = WithKind<"Valid"> & WithValue<A>;
2485
- type Invalid<E> = WithKind<"Invalid"> & WithErrors<E>;
2513
+ type Passed<A> = WithKind<"Passed"> & WithValue<A>;
2514
+ type Failed<E> = WithKind<"Failed"> & WithErrors<E>;
2486
2515
  /**
2487
- * Validation represents a value that is either valid with a success value,
2488
- * or invalid with accumulated errors.
2516
+ * Validation represents a value that is either passed with a success value,
2517
+ * or failed with accumulated errors.
2489
2518
  * Unlike Result, Validation can accumulate multiple errors instead of short-circuiting.
2490
2519
  *
2491
2520
  * Use Validation when you need to collect all errors (e.g., form validation).
@@ -2494,60 +2523,60 @@ type Invalid<E> = WithKind<"Invalid"> & WithErrors<E>;
2494
2523
  * @example
2495
2524
  * ```ts
2496
2525
  * const validateName = (name: string): Validation<string, string> =>
2497
- * name.length > 0 ? Validation.valid(name) : Validation.invalid("Name is required");
2526
+ * name.length > 0 ? Validation.passed(name) : Validation.failed("Name is required");
2498
2527
  *
2499
2528
  * const validateAge = (age: number): Validation<string, number> =>
2500
- * age >= 0 ? Validation.valid(age) : Validation.invalid("Age must be positive");
2529
+ * age >= 0 ? Validation.passed(age) : Validation.failed("Age must be positive");
2501
2530
  *
2502
2531
  * // Accumulates all errors using ap
2503
2532
  * pipe(
2504
- * Validation.valid((name: string) => (age: number) => ({ name, age })),
2533
+ * Validation.passed((name: string) => (age: number) => ({ name, age })),
2505
2534
  * Validation.ap(validateName("")),
2506
2535
  * Validation.ap(validateAge(-1))
2507
2536
  * );
2508
- * // Invalid(["Name is required", "Age must be positive"])
2537
+ * // Failed(["Name is required", "Age must be positive"])
2509
2538
  * ```
2510
2539
  */
2511
- type Validation<E, A> = Valid<A> | Invalid<E>;
2540
+ type Validation<E, A> = Passed<A> | Failed<E>;
2512
2541
  declare namespace Validation {
2513
2542
  /**
2514
- * Wraps a value in a valid Validation.
2543
+ * Wraps a value in a passed Validation.
2515
2544
  *
2516
2545
  * @example
2517
2546
  * ```ts
2518
- * Validation.valid(42); // Valid(42)
2547
+ * Validation.passed(42); // Passed(42)
2519
2548
  * ```
2520
2549
  */
2521
- const valid: <E, A>(value: A) => Validation<E, A>;
2550
+ const passed: <E, A>(value: A) => Validation<E, A>;
2522
2551
  /**
2523
- * Creates an invalid Validation from a single error.
2552
+ * Creates a failed Validation from a single error.
2524
2553
  *
2525
2554
  * @example
2526
2555
  * ```ts
2527
- * Validation.invalid("Invalid input");
2556
+ * Validation.failed("Invalid input");
2528
2557
  * ```
2529
2558
  */
2530
- const invalid: <E>(error: E) => Invalid<E>;
2559
+ const failed: <E>(error: E) => Failed<E>;
2531
2560
  /**
2532
- * Creates an invalid Validation from multiple errors.
2561
+ * Creates a failed Validation from multiple errors.
2533
2562
  *
2534
2563
  * @example
2535
2564
  * ```ts
2536
- * Validation.invalidAll(["Invalid input"]);
2565
+ * Validation.failedAll(["Invalid input"]);
2537
2566
  * ```
2538
2567
  */
2539
- const invalidAll: <E>(errors: NonEmptyList<E>) => Invalid<E>;
2568
+ const failedAll: <E>(errors: NonEmptyList<E>) => Failed<E>;
2540
2569
  /**
2541
- * Type guard that checks if a Validation is valid.
2570
+ * Type guard that checks if a Validation is passed.
2542
2571
  */
2543
- const isValid: <E, A>(data: Validation<E, A>) => data is Valid<A>;
2572
+ const isPassed: <E, A>(data: Validation<E, A>) => data is Passed<A>;
2544
2573
  /**
2545
- * Type guard that checks if a Validation is invalid.
2574
+ * Type guard that checks if a Validation is failed.
2546
2575
  */
2547
- const isInvalid: <E, A>(data: Validation<E, A>) => data is Invalid<E>;
2576
+ const isFailed: <E, A>(data: Validation<E, A>) => data is Failed<E>;
2548
2577
  /**
2549
2578
  * Creates a Validation from a predicate applied to a value.
2550
- * Returns Valid if the predicate passes, Invalid from `onFalse` otherwise.
2579
+ * Returns Passed if the predicate passes, Failed from `onFalse` otherwise.
2551
2580
  *
2552
2581
  * @example
2553
2582
  * ```ts
@@ -2556,21 +2585,54 @@ declare namespace Validation {
2556
2585
  * () => "Name is required"
2557
2586
  * );
2558
2587
  *
2559
- * validateName("Alice"); // Valid("Alice")
2560
- * validateName(""); // Invalid(["Name is required"])
2588
+ * validateName("Alice"); // Passed("Alice")
2589
+ * validateName(""); // Failed(["Name is required"])
2561
2590
  * ```
2562
2591
  */
2563
2592
  const fromPredicate: <E, A>(pred: (a: A) => boolean, onFalse: (a: A) => E) => (a: A) => Validation<E, A>;
2593
+ /**
2594
+ * Creates a Validation from a nullable value.
2595
+ * If the value is null or undefined, returns Failed with the error from onNull.
2596
+ * Otherwise, returns Passed.
2597
+ *
2598
+ * @example
2599
+ * ```ts
2600
+ * pipe(null, Validation.fromNullable(() => "is null")); // Failed(["is null"])
2601
+ * pipe(42, Validation.fromNullable(() => "is null")); // Passed(42)
2602
+ * ```
2603
+ */
2604
+ const fromNullable: <E>(onNull: () => E) => <A>(value: A | null | undefined) => Validation<E, A>;
2605
+ /**
2606
+ * Creates a Validation from a Maybe.
2607
+ * If the Maybe is None, returns Failed with the error from onNone.
2608
+ * Otherwise, returns Passed.
2609
+ *
2610
+ * @example
2611
+ * ```ts
2612
+ * pipe(Maybe.none(), Validation.fromMaybe(() => "is none")); // Failed(["is none"])
2613
+ * pipe(Maybe.some(42), Validation.fromMaybe(() => "is none")); // Passed(42)
2614
+ * ```
2615
+ */
2616
+ const fromMaybe: <E>(onNone: () => E) => <A>(maybe: Maybe<A>) => Validation<E, A>;
2564
2617
  /**
2565
2618
  * Transforms the success value inside a Validation.
2566
2619
  *
2567
2620
  * @example
2568
2621
  * ```ts
2569
- * pipe(Validation.valid(5), Validation.map(n => n * 2)); // Valid(10)
2570
- * pipe(Validation.invalid("oops"), Validation.map(n => n * 2)); // Invalid(["oops"])
2622
+ * pipe(Validation.passed(5), Validation.map(n => n * 2)); // Passed(10)
2623
+ * pipe(Validation.failed("oops"), Validation.map(n => n * 2)); // Failed(["oops"])
2571
2624
  * ```
2572
2625
  */
2573
2626
  const map: <A, B>(f: (a: A) => B) => <E>(data: Validation<E, A>) => Validation<E, B>;
2627
+ /**
2628
+ * Transforms the error list inside a Validation.
2629
+ *
2630
+ * @example
2631
+ * ```ts
2632
+ * pipe(Validation.failed("oops"), Validation.mapError(e => e.toUpperCase())); // Failed(["OOPS"])
2633
+ * ```
2634
+ */
2635
+ const mapError: <E, F, A>(f: (e: E) => F) => (data: Validation<E, A>) => Validation<F, A>;
2574
2636
  /**
2575
2637
  * Applies a function wrapped in a Validation to a value wrapped in a Validation.
2576
2638
  * Accumulates errors from both sides.
@@ -2579,16 +2641,16 @@ declare namespace Validation {
2579
2641
  * ```ts
2580
2642
  * const add = (a: number) => (b: number) => a + b;
2581
2643
  * pipe(
2582
- * Validation.valid(add),
2583
- * Validation.ap(Validation.valid(5)),
2584
- * Validation.ap(Validation.valid(3))
2585
- * ); // Valid(8)
2644
+ * Validation.passed(add),
2645
+ * Validation.ap(Validation.passed(5)),
2646
+ * Validation.ap(Validation.passed(3))
2647
+ * ); // Passed(8)
2586
2648
  *
2587
2649
  * pipe(
2588
- * Validation.valid(add),
2589
- * Validation.ap(Validation.invalid<string, number>("bad a")),
2590
- * Validation.ap(Validation.invalid<string, number>("bad b"))
2591
- * ); // Invalid(["bad a", "bad b"])
2650
+ * Validation.passed(add),
2651
+ * Validation.ap(Validation.failed<string, number>("bad a")),
2652
+ * Validation.ap(Validation.failed<string, number>("bad b"))
2653
+ * ); // Failed(["bad a", "bad b"])
2592
2654
  * ```
2593
2655
  */
2594
2656
  const ap: <E, A>(arg: Validation<E, A>) => <B>(data: Validation<E, (a: A) => B>) => Validation<E, B>;
@@ -2598,7 +2660,7 @@ declare namespace Validation {
2598
2660
  * @example
2599
2661
  * ```ts
2600
2662
  * pipe(
2601
- * Validation.valid(42),
2663
+ * Validation.passed(42),
2602
2664
  * Validation.fold(
2603
2665
  * errors => `Errors: ${errors.join(", ")}`,
2604
2666
  * value => `Value: ${value}`
@@ -2606,7 +2668,7 @@ declare namespace Validation {
2606
2668
  * );
2607
2669
  * ```
2608
2670
  */
2609
- const fold: <E, A, B>(onInvalid: (errors: NonEmptyList<E>) => B, onValid: (a: A) => B) => (data: Validation<E, A>) => B;
2671
+ const fold: <E, A, B>(onFailed: (errors: NonEmptyList<E>) => B, onPassed: (a: A) => B) => (data: Validation<E, A>) => B;
2610
2672
  /**
2611
2673
  * Pattern matches on a Validation, returning the result of the matching case.
2612
2674
  *
@@ -2615,25 +2677,25 @@ declare namespace Validation {
2615
2677
  * pipe(
2616
2678
  * validation,
2617
2679
  * Validation.match({
2618
- * valid: value => `Got ${value}`,
2619
- * invalid: errors => `Failed: ${errors.join(", ")}`
2680
+ * passed: value => `Got ${value}`,
2681
+ * failed: errors => `Failed: ${errors.join(", ")}`
2620
2682
  * })
2621
2683
  * );
2622
2684
  * ```
2623
2685
  */
2624
2686
  const match: <E, A, B>(cases: {
2625
- valid: (a: A) => B;
2626
- invalid: (errors: NonEmptyList<E>) => B;
2687
+ passed: (a: A) => B;
2688
+ failed: (errors: NonEmptyList<E>) => B;
2627
2689
  }) => (data: Validation<E, A>) => B;
2628
2690
  /**
2629
- * Returns the success value or a default value if the Validation is invalid.
2691
+ * Returns the success value or a default value if the Validation is failed.
2630
2692
  * The default can be a different type, widening the result to `A | B`.
2631
2693
  *
2632
2694
  * @example
2633
2695
  * ```ts
2634
- * pipe(Validation.valid(5), Validation.getOrElse(() => 0)); // 5
2635
- * pipe(Validation.invalid("oops"), Validation.getOrElse(() => 0)); // 0
2636
- * pipe(Validation.invalid("oops"), Validation.getOrElse(() => null)); // null — typed as number | null
2696
+ * pipe(Validation.passed(5), Validation.getOrElse(() => 0)); // 5
2697
+ * pipe(Validation.failed("oops"), Validation.getOrElse(() => 0)); // 0
2698
+ * pipe(Validation.failed("oops"), Validation.getOrElse(() => null)); // null — typed as number | null
2637
2699
  * ```
2638
2700
  */
2639
2701
  const getOrElse: <E, A, B>(defaultValue: () => B) => (data: Validation<E, A>) => A | B;
@@ -2643,7 +2705,7 @@ declare namespace Validation {
2643
2705
  * @example
2644
2706
  * ```ts
2645
2707
  * pipe(
2646
- * Validation.valid(5),
2708
+ * Validation.passed(5),
2647
2709
  * Validation.tap(n => console.log("Value:", n)),
2648
2710
  * Validation.map(n => n * 2)
2649
2711
  * );
@@ -2657,7 +2719,7 @@ declare namespace Validation {
2657
2719
  * @example
2658
2720
  * ```ts
2659
2721
  * pipe(
2660
- * Validation.invalid("Name required"),
2722
+ * Validation.failed("Name required"),
2661
2723
  * Validation.tapError(errors => console.error("validation failed:", errors)),
2662
2724
  * Validation.map(toUser)
2663
2725
  * );
@@ -2665,82 +2727,82 @@ declare namespace Validation {
2665
2727
  */
2666
2728
  const tapError: <E, A>(f: (errors: NonEmptyList<E>) => void) => (data: Validation<E, A>) => Validation<E, A>;
2667
2729
  /**
2668
- * Recovers from an Invalid state by providing a fallback Validation.
2730
+ * Recovers from a Failed state by providing a fallback Validation.
2669
2731
  * The fallback receives the accumulated error list so callers can inspect which errors occurred.
2670
2732
  * The fallback can produce a different success type, widening the result to `Validation<E, A | B>`.
2671
2733
  */
2672
2734
  const recover: <E, A, B>(fallback: (errors: NonEmptyList<E>) => Validation<E, B>) => (data: Validation<E, A>) => Validation<E, A | B>;
2673
2735
  /**
2674
- * Recovers from an Invalid state unless `isBlocked` returns true for any of the accumulated errors.
2736
+ * Recovers from a Failed state unless `isBlocked` returns true for any of the accumulated errors.
2675
2737
  * The fallback can produce a different success type, widening the result to `Validation<E, A | B>`.
2676
2738
  *
2677
2739
  * @example
2678
2740
  * ```ts
2679
2741
  * pipe(
2680
- * Validation.invalid("field-error"),
2681
- * Validation.recoverUnless(e => e === "fatal", () => Validation.valid(0))
2682
- * ); // Valid(0)
2742
+ * Validation.failed("field-error"),
2743
+ * Validation.recoverUnless(e => e === "fatal", () => Validation.passed(0))
2744
+ * ); // Passed(0)
2683
2745
  * ```
2684
2746
  */
2685
2747
  const recoverUnless: <E, A, B>(isBlocked: (e: E) => boolean, fallback: () => Validation<E, B>) => (data: Validation<E, A>) => Validation<E, A | B>;
2686
2748
  /**
2687
2749
  * Converts a Validation to a Result.
2688
- * Valid becomes Ok, Invalid becomes Err with the accumulated error list.
2750
+ * Passed becomes Ok, Failed becomes Err with the accumulated error list.
2689
2751
  *
2690
2752
  * @example
2691
2753
  * ```ts
2692
- * Validation.toResult(Validation.valid(42)); // Ok(42)
2693
- * Validation.toResult(Validation.invalid("oops")); // Err(["oops"])
2754
+ * Validation.toResult(Validation.passed(42)); // Ok(42)
2755
+ * Validation.toResult(Validation.failed("oops")); // Err(["oops"])
2694
2756
  * ```
2695
2757
  */
2696
2758
  const toResult: <E, A>(data: Validation<E, A>) => Result<NonEmptyList<E>, A>;
2697
2759
  /**
2698
- * Converts a Validation to a Maybe. `Valid` becomes `Some`; `Invalid` becomes `None`
2760
+ * Converts a Validation to a Maybe. `Passed` becomes `Some`; `Failed` becomes `None`
2699
2761
  * (errors are discarded).
2700
2762
  *
2701
2763
  * @example
2702
2764
  * ```ts
2703
- * Validation.toMaybe(Validation.valid(42)); // Some(42)
2704
- * Validation.toMaybe(Validation.invalid("bad")); // None
2765
+ * Validation.toMaybe(Validation.passed(42)); // Some(42)
2766
+ * Validation.toMaybe(Validation.failed("bad")); // None
2705
2767
  * ```
2706
2768
  */
2707
2769
  const toMaybe: <E, A>(data: Validation<E, A>) => Maybe<A>;
2708
2770
  /**
2709
- * Converts a `Result` to a `Validation`. `Ok` becomes `Valid`; `Err(e)` becomes `Invalid([e])`.
2771
+ * Converts a `Result` to a `Validation`. `Ok` becomes `Passed`; `Err(e)` becomes `Failed([e])`.
2710
2772
  *
2711
2773
  * Useful when bridging from error-short-circuiting `Result` pipelines into
2712
2774
  * error-accumulating `Validation` pipelines.
2713
2775
  *
2714
2776
  * @example
2715
2777
  * ```ts
2716
- * Validation.fromResult(Result.ok(42)); // Valid(42)
2717
- * Validation.fromResult(Result.error("bad")); // Invalid(["bad"])
2778
+ * Validation.fromResult(Result.ok(42)); // Passed(42)
2779
+ * Validation.fromResult(Result.err("bad")); // Failed(["bad"])
2718
2780
  * ```
2719
2781
  */
2720
2782
  const fromResult: <E, A>(data: Result<E, A>) => Validation<E, A>;
2721
2783
  /**
2722
2784
  * Combines two independent Validation instances into a tuple.
2723
- * If both are Valid, returns Valid with both values as a tuple.
2724
- * If either is Invalid, accumulates errors from both sides.
2785
+ * If both are Passed, returns Passed with both values as a tuple.
2786
+ * If either is Failed, accumulates errors from both sides.
2725
2787
  *
2726
2788
  * @example
2727
2789
  * ```ts
2728
2790
  * Validation.product(
2729
- * Validation.valid("alice"),
2730
- * Validation.valid(30)
2731
- * ); // Valid(["alice", 30])
2791
+ * Validation.passed("alice"),
2792
+ * Validation.passed(30)
2793
+ * ); // Passed(["alice", 30])
2732
2794
  *
2733
2795
  * Validation.product(
2734
- * Validation.invalid("Name required"),
2735
- * Validation.invalid("Age must be >= 0")
2736
- * ); // Invalid(["Name required", "Age must be >= 0"])
2796
+ * Validation.failed("Name required"),
2797
+ * Validation.failed("Age must be >= 0")
2798
+ * ); // Failed(["Name required", "Age must be >= 0"])
2737
2799
  * ```
2738
2800
  */
2739
2801
  const product: <E, A, B>(first: Validation<E, A>, second: Validation<E, B>) => Validation<E, readonly [A, B]>;
2740
2802
  /**
2741
2803
  * Combines a non-empty list of Validation instances, accumulating all errors.
2742
- * If all are Valid, returns Valid with all values collected into an array.
2743
- * If any are Invalid, returns Invalid with all accumulated errors.
2804
+ * If all are Passed, returns Passed with all values collected into an array.
2805
+ * If any are Failed, returns Failed with all accumulated errors.
2744
2806
  *
2745
2807
  * @example
2746
2808
  * ```ts
@@ -2749,7 +2811,7 @@ declare namespace Validation {
2749
2811
  * validateEmail(email),
2750
2812
  * validateAge(age)
2751
2813
  * ]);
2752
- * // Valid([name, email, age]) or Invalid([...all errors])
2814
+ * // Passed([name, email, age]) or Failed([...all errors])
2753
2815
  * ```
2754
2816
  */
2755
2817
  const productAll: <E, A>(data: NonEmptyList<Validation<E, A>>) => Validation<E, readonly A[]>;
@@ -2764,36 +2826,52 @@ declare namespace Validation {
2764
2826
  * ```ts
2765
2827
  * const validateName = (name: string): TaskValidation<string, string> =>
2766
2828
  * name.length > 0
2767
- * ? TaskValidation.valid(name)
2768
- * : TaskValidation.invalid("Name is required");
2829
+ * ? TaskValidation.passed(name)
2830
+ * : TaskValidation.failed("Name is required");
2769
2831
  *
2770
2832
  * // Accumulate errors from multiple async validations using ap
2771
2833
  * pipe(
2772
- * TaskValidation.valid((name: string) => (age: number) => ({ name, age })),
2834
+ * TaskValidation.passed((name: string) => (age: number) => ({ name, age })),
2773
2835
  * TaskValidation.ap(validateName("")),
2774
2836
  * TaskValidation.ap(validateAge(-1))
2775
2837
  * )();
2776
- * // Invalid(["Name is required", "Age must be positive"])
2838
+ * // Failed(["Name is required", "Age must be positive"])
2777
2839
  * ```
2778
2840
  */
2779
2841
  type TaskValidation<E, A> = Task<Validation<E, A>>;
2780
2842
  declare namespace TaskValidation {
2781
2843
  /**
2782
- * Wraps a value in a valid TaskValidation.
2844
+ * Wraps a value in a passed TaskValidation.
2783
2845
  */
2784
- const valid: <E, A>(value: A) => TaskValidation<E, A>;
2846
+ const passed: <E, A>(value: A) => TaskValidation<E, A>;
2785
2847
  /**
2786
2848
  * Creates a failed TaskValidation with a single error.
2787
2849
  */
2788
- const invalid: <E, A>(error: E) => TaskValidation<E, A>;
2850
+ const failed: <E, A>(error: E) => TaskValidation<E, A>;
2789
2851
  /**
2790
- * Creates an invalid TaskValidation from multiple errors.
2852
+ * Creates a failed TaskValidation from multiple errors.
2791
2853
  */
2792
- const invalidAll: <E, A>(errors: NonEmptyList<E>) => TaskValidation<E, A>;
2854
+ const failedAll: <E, A>(errors: NonEmptyList<E>) => TaskValidation<E, A>;
2793
2855
  /**
2794
2856
  * Lifts a Validation into a TaskValidation.
2795
2857
  */
2796
2858
  const fromValidation: <E, A>(validation: Validation<E, A>) => TaskValidation<E, A>;
2859
+ /**
2860
+ * Creates a TaskValidation from a nullable value.
2861
+ * If the value is null or undefined, returns Failed with the error from onNull.
2862
+ * Otherwise, returns Passed.
2863
+ */
2864
+ const fromNullable: <E>(onNull: () => E) => <A>(value: A | null | undefined) => TaskValidation<E, A>;
2865
+ /**
2866
+ * Creates a TaskValidation from a Maybe.
2867
+ * Some becomes Passed, None becomes Failed with the error from onNone.
2868
+ */
2869
+ const fromMaybe: <E>(onNone: () => E) => <A>(maybe: Maybe<A>) => TaskValidation<E, A>;
2870
+ /**
2871
+ * Creates a TaskValidation from a Result.
2872
+ * Ok becomes Passed, Err(e) becomes Failed([e]).
2873
+ */
2874
+ const fromResult: <E, A>(result: Result<E, A>) => TaskValidation<E, A>;
2797
2875
  /**
2798
2876
  * Creates a TaskValidation from a Promise-returning function.
2799
2877
  * Catches any errors and transforms them using the onError function.
@@ -2821,7 +2899,7 @@ declare namespace TaskValidation {
2821
2899
  * @example
2822
2900
  * ```ts
2823
2901
  * pipe(
2824
- * TaskValidation.valid((name: string) => (age: number) => ({ name, age })),
2902
+ * TaskValidation.passed((name: string) => (age: number) => ({ name, age })),
2825
2903
  * TaskValidation.ap(validateName(name)),
2826
2904
  * TaskValidation.ap(validateAge(age))
2827
2905
  * )();
@@ -2831,7 +2909,7 @@ declare namespace TaskValidation {
2831
2909
  /**
2832
2910
  * Extracts a value from a TaskValidation by providing handlers for both cases.
2833
2911
  */
2834
- const fold: <E, A, B>(onInvalid: (errors: NonEmptyList<E>) => B, onValid: (a: A) => B) => (data: TaskValidation<E, A>) => Task<B>;
2912
+ const fold: <E, A, B>(onFailed: (errors: NonEmptyList<E>) => B, onPassed: (a: A) => B) => (data: TaskValidation<E, A>) => Task<B>;
2835
2913
  /**
2836
2914
  * Pattern matches on a TaskValidation, returning a Task of the result.
2837
2915
  *
@@ -2840,18 +2918,18 @@ declare namespace TaskValidation {
2840
2918
  * pipe(
2841
2919
  * validateForm(input),
2842
2920
  * TaskValidation.match({
2843
- * valid: data => save(data),
2844
- * invalid: errors => showErrors(errors)
2921
+ * passed: data => save(data),
2922
+ * failed: errors => showErrors(errors)
2845
2923
  * })
2846
2924
  * )();
2847
2925
  * ```
2848
2926
  */
2849
2927
  const match: <E, A, B>(cases: {
2850
- valid: (a: A) => B;
2851
- invalid: (errors: NonEmptyList<E>) => B;
2928
+ passed: (a: A) => B;
2929
+ failed: (errors: NonEmptyList<E>) => B;
2852
2930
  }) => (data: TaskValidation<E, A>) => Task<B>;
2853
2931
  /**
2854
- * Returns the success value or a default value if the TaskValidation is invalid.
2932
+ * Returns the success value or a default value if the TaskValidation is failed.
2855
2933
  * The default can be a different type, widening the result to `Task<A | B>`.
2856
2934
  */
2857
2935
  const getOrElse: <E, A, B>(defaultValue: () => B) => (data: TaskValidation<E, A>) => Task<A | B>;
@@ -2861,14 +2939,14 @@ declare namespace TaskValidation {
2861
2939
  */
2862
2940
  const tap: <E, A>(f: (a: A) => void) => (data: TaskValidation<E, A>) => TaskValidation<E, A>;
2863
2941
  /**
2864
- * Recovers from an Invalid state by providing a fallback TaskValidation.
2942
+ * Recovers from a Failed state by providing a fallback TaskValidation.
2865
2943
  * The fallback receives the accumulated error list so callers can inspect which errors occurred.
2866
2944
  * The fallback can produce a different success type, widening the result to `TaskValidation<E, A | B>`.
2867
2945
  */
2868
2946
  const recover: <E, A, B>(fallback: (errors: NonEmptyList<E>) => TaskValidation<E, B>) => (data: TaskValidation<E, A>) => TaskValidation<E, A | B>;
2869
2947
  /**
2870
2948
  * Runs two TaskValidations concurrently and combines their results into a tuple.
2871
- * If both are Valid, returns Valid with both values. If either fails, accumulates
2949
+ * If both are Passed, returns Passed with both values. If either fails, accumulates
2872
2950
  * errors from both sides.
2873
2951
  *
2874
2952
  * @example
@@ -2876,14 +2954,14 @@ declare namespace TaskValidation {
2876
2954
  * await TaskValidation.product(
2877
2955
  * validateName(form.name),
2878
2956
  * validateAge(form.age),
2879
- * )(); // Valid(["Alice", 30]) or Invalid([...errors])
2957
+ * )(); // Passed(["Alice", 30]) or Failed([...errors])
2880
2958
  * ```
2881
2959
  */
2882
2960
  const product: <E, A, B>(first: TaskValidation<E, A>, second: TaskValidation<E, B>) => TaskValidation<E, readonly [A, B]>;
2883
2961
  /**
2884
2962
  * Runs all TaskValidations concurrently and collects results.
2885
- * If all are Valid, returns Valid with all values as an array.
2886
- * If any fail, returns Invalid with all accumulated errors.
2963
+ * If all are Passed, returns Passed with all values as an array.
2964
+ * If any fail, returns Failed with all accumulated errors.
2887
2965
  *
2888
2966
  * @example
2889
2967
  * ```ts
@@ -2891,7 +2969,7 @@ declare namespace TaskValidation {
2891
2969
  * validateName(form.name),
2892
2970
  * validateEmail(form.email),
2893
2971
  * validateAge(form.age),
2894
- * ])(); // Valid([name, email, age]) or Invalid([...all errors])
2972
+ * ])(); // Passed([name, email, age]) or Failed([...all errors])
2895
2973
  * ```
2896
2974
  */
2897
2975
  const productAll: <E, A>(data: NonEmptyList<TaskValidation<E, A>>) => TaskValidation<E, readonly A[]>;
@@ -2951,7 +3029,7 @@ declare namespace These {
2951
3029
  * These.both(42, "Deprecated API used"); // { kind: "Both", first: 42, second: "Deprecated API used" }
2952
3030
  * ```
2953
3031
  */
2954
- const both: <A, B>(first: A, second: B) => TheseBoth<A, B>;
3032
+ const both: <A, B>(f: A, s: B) => TheseBoth<A, B>;
2955
3033
  /**
2956
3034
  * Type guard — checks if a These holds only a first value.
2957
3035
  */
@@ -3250,4 +3328,4 @@ declare namespace Tuple {
3250
3328
  const tap: <A, B>(f: (a: A, b: B) => void) => (tuple: Tuple<A, B>) => Tuple<A, B>;
3251
3329
  }
3252
3330
 
3253
- export { Combinable, Deferred, type Failure, type Invalid, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, type Success, Task, TaskMaybe, TaskResult, TaskValidation, These, type TheseBoth, type TheseFirst, type TheseSecond, Tuple, type Valid, Validation };
3331
+ export { Combinable, Deferred, type Failed, type Failure, Lazy, Lens, type Loading, Logged, Maybe, type NotAsked, Op, Optional, type Passed, Predicate, Reader, Refinement, RemoteData, Resource, Result, State, type Success, Task, TaskMaybe, TaskResult, TaskValidation, These, type TheseBoth, type TheseFirst, type TheseSecond, Tuple, Validation };