@nlozgachev/pipelined 0.46.0 → 0.48.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,7 +1,8 @@
1
- import { M as Maybe, R as Result, T as Task } from './Validation-v38R0qH-.mjs';
2
- export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, c as TaskMaybe, d as TaskResult, e as TaskValidation, V as Validation } from './Validation-v38R0qH-.mjs';
3
- import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-CLE7qlOc.mjs';
4
- import { Duration } from './types.mjs';
1
+ import { M as Maybe, R as Result, T as Task } from './Validation-D-aARYlP.mjs';
2
+ export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, c as TaskMaybe, d as TaskResult, e as TaskValidation, V as Validation } from './Validation-D-aARYlP.mjs';
3
+ import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-CDiDBAY4.mjs';
4
+ import { D as Duration } from './Duration-B8joKzro.mjs';
5
+ import './types.mjs';
5
6
 
6
7
  /**
7
8
  * A type that can combine two values of type `A` into one, with a neutral starting value.
@@ -96,6 +97,18 @@ declare namespace Combinable {
96
97
  * ```
97
98
  */
98
99
  const fold: <A>(c: Combinable<A>) => (data: readonly A[]) => A;
100
+ /**
101
+ * Derives a `Combinable` for a record of fields from field-level `Combinable` instances.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const StatsCombinable = Combinable.struct({
106
+ * count: Combinable.sum,
107
+ * tags: Combinable.array<string>(),
108
+ * });
109
+ * ```
110
+ */
111
+ const struct: <R extends Record<string, unknown>>(fields: { [K in keyof R]: Combinable<R[K]>; }) => Combinable<R>;
99
112
  }
100
113
 
101
114
  /**
@@ -432,6 +445,17 @@ declare namespace Logged {
432
445
  * ```
433
446
  */
434
447
  const bind: <K extends string, W, A, B>(key: K, f: (a: A) => Logged<W, B>) => (data: Logged<W, A>) => Logged<W, A & { [P in K]: B; }>;
448
+ /**
449
+ * Focuses a Logged computation's value transformation using a Lens.
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const nameLens = Lens.from.property<{ name: string }>()("name");
454
+ * const logged = Logged.from.value<string, { name: string }>({ name: "alice" });
455
+ * pipe(logged, Logged.focus(nameLens)(s => s.toUpperCase()));
456
+ * ```
457
+ */
458
+ const focus: <S, A>(lens: Lens<S, A>) => <W>(f: (a: A) => A) => (data: Logged<W, S>) => Logged<W, S>;
435
459
  }
436
460
 
437
461
  type MaybeRetry<E, O> = O extends {
@@ -1465,6 +1489,23 @@ declare namespace Predicate {
1465
1489
  */
1466
1490
  const Refinement: <A, B extends A>(r: Refinement<A, B>) => Predicate<A>;
1467
1491
  }
1492
+ /**
1493
+ * Performs declarative conditional branching over `[predicate, handler]` pairs,
1494
+ * returning the handler result of the first matching predicate or evaluating the fallback.
1495
+ *
1496
+ * @example
1497
+ * ```ts
1498
+ * const classifyNumber = Predicate.match(
1499
+ * [
1500
+ * [(n: number) => n < 0, () => "negative"],
1501
+ * [(n: number) => n === 0, () => "zero"],
1502
+ * ],
1503
+ * () => "positive",
1504
+ * );
1505
+ * classifyNumber(-5); // "negative"
1506
+ * ```
1507
+ */
1508
+ const match: <A, B>(branches: ReadonlyArray<readonly [Predicate<A>, (a: A) => B]>, fallback: (a: A) => B) => (a: A) => B;
1468
1509
  }
1469
1510
 
1470
1511
  /**
@@ -1813,36 +1854,88 @@ declare namespace RemoteData {
1813
1854
  namespace make {
1814
1855
  /**
1815
1856
  * Creates a NotAsked RemoteData.
1857
+ *
1858
+ * @example
1859
+ * ```ts
1860
+ * RemoteData.make.notAsked(); // NotAsked
1861
+ * ```
1816
1862
  */
1817
1863
  const notAsked: () => NotAsked;
1818
1864
  /**
1819
1865
  * Creates a Loading RemoteData.
1866
+ *
1867
+ * @example
1868
+ * ```ts
1869
+ * RemoteData.make.loading(); // Loading
1870
+ * ```
1820
1871
  */
1821
1872
  const loading: () => Loading;
1822
1873
  /**
1823
1874
  * Creates a Failure RemoteData with the given error.
1875
+ *
1876
+ * @example
1877
+ * ```ts
1878
+ * RemoteData.make.failure("Network error"); // Failure("Network error")
1879
+ * ```
1824
1880
  */
1825
1881
  const failure: <E>(error: E) => Failure<E>;
1826
1882
  /**
1827
1883
  * Creates a Success RemoteData with the given value.
1884
+ *
1885
+ * @example
1886
+ * ```ts
1887
+ * RemoteData.make.success(42); // Success(42)
1888
+ * ```
1828
1889
  */
1829
1890
  const success: <A>(value: A) => Success<A>;
1830
1891
  }
1831
1892
  namespace is {
1832
1893
  /**
1833
1894
  * Type guard that checks if a RemoteData is NotAsked.
1895
+ *
1896
+ * @example
1897
+ * ```ts
1898
+ * const data = RemoteData.make.notAsked();
1899
+ * if (RemoteData.is.notAsked(data)) {
1900
+ * console.log("Data fetch not initiated");
1901
+ * }
1902
+ * ```
1834
1903
  */
1835
1904
  const notAsked: <E, A>(data: RemoteData<E, A>) => data is NotAsked;
1836
1905
  /**
1837
1906
  * Type guard that checks if a RemoteData is Loading.
1907
+ *
1908
+ * @example
1909
+ * ```ts
1910
+ * const data = RemoteData.make.loading();
1911
+ * if (RemoteData.is.loading(data)) {
1912
+ * console.log("Data is loading");
1913
+ * }
1914
+ * ```
1838
1915
  */
1839
1916
  const loading: <E, A>(data: RemoteData<E, A>) => data is Loading;
1840
1917
  /**
1841
1918
  * Type guard that checks if a RemoteData is Failure.
1919
+ *
1920
+ * @example
1921
+ * ```ts
1922
+ * const data = RemoteData.make.failure("Failed");
1923
+ * if (RemoteData.is.failure(data)) {
1924
+ * console.log(data.error); // "Failed"
1925
+ * }
1926
+ * ```
1842
1927
  */
1843
1928
  const failure: <E, A>(data: RemoteData<E, A>) => data is Failure<E>;
1844
1929
  /**
1845
1930
  * Type guard that checks if a RemoteData is Success.
1931
+ *
1932
+ * @example
1933
+ * ```ts
1934
+ * const data = RemoteData.make.success(42);
1935
+ * if (RemoteData.is.success(data)) {
1936
+ * console.log(data.value); // 42
1937
+ * }
1938
+ * ```
1846
1939
  */
1847
1940
  const success: <E, A>(data: RemoteData<E, A>) => data is Success<A>;
1848
1941
  }
@@ -1877,7 +1970,7 @@ declare namespace RemoteData {
1877
1970
  * );
1878
1971
  * ```
1879
1972
  */
1880
- const chain: <E, A, B>(f: (a: A) => RemoteData<E, B>) => (data: RemoteData<E, A>) => RemoteData<E, B>;
1973
+ const chain: <E1, E2, A, B>(f: (a: A) => RemoteData<E2, B>) => (data: RemoteData<E1, A>) => RemoteData<E1 | E2, B>;
1881
1974
  /**
1882
1975
  * Applies a function wrapped in a RemoteData to a value wrapped in a RemoteData.
1883
1976
  *
@@ -2003,7 +2096,7 @@ declare namespace RemoteData {
2003
2096
  *
2004
2097
  * @example
2005
2098
  * ```ts
2006
- * const result = await Task.Result.tryCatch(fetchUser, String)();
2099
+ * const result = await Task.Result.tryCatch(fetchUser, { onError: String })();
2007
2100
  * setState(RemoteData.from.Result(result)); // Success(user) or Failure(msg)
2008
2101
  * ```
2009
2102
  */
@@ -2053,7 +2146,7 @@ declare namespace RemoteData {
2053
2146
  * @example
2054
2147
  * ```ts
2055
2148
  * const dbResource = Resource.from.handlers(
2056
- * Task.Result.tryCatch(() => openConnection(config), (e) => new DbError(e)),
2149
+ * Task.Result.tryCatch(() => openConnection(config), { onError: (e) => new DbError(e) }),
2057
2150
  * (conn) => Task.from.Promise(() => conn.close())
2058
2151
  * );
2059
2152
  *
@@ -2076,7 +2169,7 @@ declare namespace Resource {
2076
2169
  * @example
2077
2170
  * ```ts
2078
2171
  * const fileResource = Resource.from.handlers(
2079
- * Task.Result.tryCatch(() => fs.promises.open("data.csv", "r"), toFileError),
2172
+ * Task.Result.tryCatch(() => fs.promises.open("data.csv", "r"), { onError: toFileError }),
2080
2173
  * (handle) => Task.from.Promise(() => handle.close())
2081
2174
  * );
2082
2175
  * ```
@@ -2344,6 +2437,18 @@ declare namespace State {
2344
2437
  * ```
2345
2438
  */
2346
2439
  const bind: <K extends string, S, A, B>(key: K, f: (a: A) => State<S, B>) => (data: State<S, A>) => State<S, A & { [P in K]: B; }>;
2440
+ /**
2441
+ * Focuses a State computation on a sub-state using a Lens.
2442
+ *
2443
+ * @example
2444
+ * ```ts
2445
+ * type AppState = { count: number; name: string };
2446
+ * const countLens = Lens.from.property<AppState>()("count");
2447
+ * const increment = State.modify((c: number) => c + 1);
2448
+ * const focusedProgram = pipe(increment, State.focus(countLens));
2449
+ * ```
2450
+ */
2451
+ const focus: <S, A>(lens: Lens<S, A>) => <B>(stateOp: State<A, B>) => State<S, B>;
2347
2452
  }
2348
2453
 
2349
2454
  type TheseFirst<T> = WithKind<"First"> & WithFirst<T>;
@@ -2406,23 +2511,61 @@ declare namespace These {
2406
2511
  namespace is {
2407
2512
  /**
2408
2513
  * Type guard — checks if a These holds only a first value.
2514
+ *
2515
+ * @example
2516
+ * ```ts
2517
+ * const val = These.make.first(42);
2518
+ * if (These.is.first(val)) {
2519
+ * console.log(val.first); // 42
2520
+ * }
2521
+ * ```
2409
2522
  */
2410
2523
  const first: <A, B>(data: These<A, B>) => data is TheseFirst<A>;
2411
2524
  /**
2412
2525
  * Type guard — checks if a These holds only a second value.
2526
+ *
2527
+ * @example
2528
+ * ```ts
2529
+ * const val = These.make.second("warning");
2530
+ * if (These.is.second(val)) {
2531
+ * console.log(val.second); // "warning"
2532
+ * }
2533
+ * ```
2413
2534
  */
2414
2535
  const second: <A, B>(data: These<A, B>) => data is TheseSecond<B>;
2415
2536
  /**
2416
2537
  * Type guard — checks if a These holds both values simultaneously.
2538
+ *
2539
+ * @example
2540
+ * ```ts
2541
+ * const val = These.make.both(42, "warning");
2542
+ * if (These.is.both(val)) {
2543
+ * console.log(val.first, val.second); // 42 "warning"
2544
+ * }
2545
+ * ```
2417
2546
  */
2418
2547
  const both: <A, B>(data: These<A, B>) => data is TheseBoth<A, B>;
2419
2548
  }
2420
2549
  /**
2421
2550
  * Returns true if the These contains a first value (First or Both).
2551
+ *
2552
+ * @example
2553
+ * ```ts
2554
+ * These.hasFirst(These.make.first(42)); // true
2555
+ * These.hasFirst(These.make.both(42, "warn"));// true
2556
+ * These.hasFirst(These.make.second("warn")); // false
2557
+ * ```
2422
2558
  */
2423
2559
  const hasFirst: <A, B>(data: These<A, B>) => data is TheseFirst<A> | TheseBoth<A, B>;
2424
2560
  /**
2425
2561
  * Returns true if the These contains a second value (Second or Both).
2562
+ *
2563
+ * @example
2564
+ * ```ts
2565
+ * These.hasSecond(These.make.second("warn")); // true
2566
+ * These.hasSecond(These.make.both(42, "warn"));// true
2567
+ * These.hasSecond(These.make.first(42)); // false
2568
+ * ```
2426
2569
  */
2427
2570
  const hasSecond: <A, B>(data: These<A, B>) => data is TheseSecond<B> | TheseBoth<A, B>;
2428
2571
  /**
package/dist/core.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { M as Maybe, R as Result, T as Task } from './Validation-BMsvixWH.js';
2
- export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, c as TaskMaybe, d as TaskResult, e as TaskValidation, V as Validation } from './Validation-BMsvixWH.js';
3
- import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-Mssktd7z.js';
4
- import { Duration } from './types.js';
1
+ import { M as Maybe, R as Result, T as Task } from './Validation-1OgJJdeA.js';
2
+ export { E as Equality, a as Err, F as Failed, N as None, O as Ok, b as Ordering, P as Passed, S as Some, c as TaskMaybe, d as TaskResult, e as TaskValidation, V as Validation } from './Validation-1OgJJdeA.js';
3
+ import { o as WithValue, i as WithLog, D as Deferred, h as WithKind, e as WithError, R as RetryOptions, b as TimeoutOptions, n as WithTimeout, j as WithMinInterval, c as WithCooldown, W as WithConcurrency, m as WithSize, d as WithDuration, k as WithN, g as WithFirst, l as WithSecond } from './InternalTypes-LdhLQx3N.js';
4
+ import { D as Duration } from './Duration-B8joKzro.js';
5
+ import './types.js';
5
6
 
6
7
  /**
7
8
  * A type that can combine two values of type `A` into one, with a neutral starting value.
@@ -96,6 +97,18 @@ declare namespace Combinable {
96
97
  * ```
97
98
  */
98
99
  const fold: <A>(c: Combinable<A>) => (data: readonly A[]) => A;
100
+ /**
101
+ * Derives a `Combinable` for a record of fields from field-level `Combinable` instances.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const StatsCombinable = Combinable.struct({
106
+ * count: Combinable.sum,
107
+ * tags: Combinable.array<string>(),
108
+ * });
109
+ * ```
110
+ */
111
+ const struct: <R extends Record<string, unknown>>(fields: { [K in keyof R]: Combinable<R[K]>; }) => Combinable<R>;
99
112
  }
100
113
 
101
114
  /**
@@ -432,6 +445,17 @@ declare namespace Logged {
432
445
  * ```
433
446
  */
434
447
  const bind: <K extends string, W, A, B>(key: K, f: (a: A) => Logged<W, B>) => (data: Logged<W, A>) => Logged<W, A & { [P in K]: B; }>;
448
+ /**
449
+ * Focuses a Logged computation's value transformation using a Lens.
450
+ *
451
+ * @example
452
+ * ```ts
453
+ * const nameLens = Lens.from.property<{ name: string }>()("name");
454
+ * const logged = Logged.from.value<string, { name: string }>({ name: "alice" });
455
+ * pipe(logged, Logged.focus(nameLens)(s => s.toUpperCase()));
456
+ * ```
457
+ */
458
+ const focus: <S, A>(lens: Lens<S, A>) => <W>(f: (a: A) => A) => (data: Logged<W, S>) => Logged<W, S>;
435
459
  }
436
460
 
437
461
  type MaybeRetry<E, O> = O extends {
@@ -1465,6 +1489,23 @@ declare namespace Predicate {
1465
1489
  */
1466
1490
  const Refinement: <A, B extends A>(r: Refinement<A, B>) => Predicate<A>;
1467
1491
  }
1492
+ /**
1493
+ * Performs declarative conditional branching over `[predicate, handler]` pairs,
1494
+ * returning the handler result of the first matching predicate or evaluating the fallback.
1495
+ *
1496
+ * @example
1497
+ * ```ts
1498
+ * const classifyNumber = Predicate.match(
1499
+ * [
1500
+ * [(n: number) => n < 0, () => "negative"],
1501
+ * [(n: number) => n === 0, () => "zero"],
1502
+ * ],
1503
+ * () => "positive",
1504
+ * );
1505
+ * classifyNumber(-5); // "negative"
1506
+ * ```
1507
+ */
1508
+ const match: <A, B>(branches: ReadonlyArray<readonly [Predicate<A>, (a: A) => B]>, fallback: (a: A) => B) => (a: A) => B;
1468
1509
  }
1469
1510
 
1470
1511
  /**
@@ -1813,36 +1854,88 @@ declare namespace RemoteData {
1813
1854
  namespace make {
1814
1855
  /**
1815
1856
  * Creates a NotAsked RemoteData.
1857
+ *
1858
+ * @example
1859
+ * ```ts
1860
+ * RemoteData.make.notAsked(); // NotAsked
1861
+ * ```
1816
1862
  */
1817
1863
  const notAsked: () => NotAsked;
1818
1864
  /**
1819
1865
  * Creates a Loading RemoteData.
1866
+ *
1867
+ * @example
1868
+ * ```ts
1869
+ * RemoteData.make.loading(); // Loading
1870
+ * ```
1820
1871
  */
1821
1872
  const loading: () => Loading;
1822
1873
  /**
1823
1874
  * Creates a Failure RemoteData with the given error.
1875
+ *
1876
+ * @example
1877
+ * ```ts
1878
+ * RemoteData.make.failure("Network error"); // Failure("Network error")
1879
+ * ```
1824
1880
  */
1825
1881
  const failure: <E>(error: E) => Failure<E>;
1826
1882
  /**
1827
1883
  * Creates a Success RemoteData with the given value.
1884
+ *
1885
+ * @example
1886
+ * ```ts
1887
+ * RemoteData.make.success(42); // Success(42)
1888
+ * ```
1828
1889
  */
1829
1890
  const success: <A>(value: A) => Success<A>;
1830
1891
  }
1831
1892
  namespace is {
1832
1893
  /**
1833
1894
  * Type guard that checks if a RemoteData is NotAsked.
1895
+ *
1896
+ * @example
1897
+ * ```ts
1898
+ * const data = RemoteData.make.notAsked();
1899
+ * if (RemoteData.is.notAsked(data)) {
1900
+ * console.log("Data fetch not initiated");
1901
+ * }
1902
+ * ```
1834
1903
  */
1835
1904
  const notAsked: <E, A>(data: RemoteData<E, A>) => data is NotAsked;
1836
1905
  /**
1837
1906
  * Type guard that checks if a RemoteData is Loading.
1907
+ *
1908
+ * @example
1909
+ * ```ts
1910
+ * const data = RemoteData.make.loading();
1911
+ * if (RemoteData.is.loading(data)) {
1912
+ * console.log("Data is loading");
1913
+ * }
1914
+ * ```
1838
1915
  */
1839
1916
  const loading: <E, A>(data: RemoteData<E, A>) => data is Loading;
1840
1917
  /**
1841
1918
  * Type guard that checks if a RemoteData is Failure.
1919
+ *
1920
+ * @example
1921
+ * ```ts
1922
+ * const data = RemoteData.make.failure("Failed");
1923
+ * if (RemoteData.is.failure(data)) {
1924
+ * console.log(data.error); // "Failed"
1925
+ * }
1926
+ * ```
1842
1927
  */
1843
1928
  const failure: <E, A>(data: RemoteData<E, A>) => data is Failure<E>;
1844
1929
  /**
1845
1930
  * Type guard that checks if a RemoteData is Success.
1931
+ *
1932
+ * @example
1933
+ * ```ts
1934
+ * const data = RemoteData.make.success(42);
1935
+ * if (RemoteData.is.success(data)) {
1936
+ * console.log(data.value); // 42
1937
+ * }
1938
+ * ```
1846
1939
  */
1847
1940
  const success: <E, A>(data: RemoteData<E, A>) => data is Success<A>;
1848
1941
  }
@@ -1877,7 +1970,7 @@ declare namespace RemoteData {
1877
1970
  * );
1878
1971
  * ```
1879
1972
  */
1880
- const chain: <E, A, B>(f: (a: A) => RemoteData<E, B>) => (data: RemoteData<E, A>) => RemoteData<E, B>;
1973
+ const chain: <E1, E2, A, B>(f: (a: A) => RemoteData<E2, B>) => (data: RemoteData<E1, A>) => RemoteData<E1 | E2, B>;
1881
1974
  /**
1882
1975
  * Applies a function wrapped in a RemoteData to a value wrapped in a RemoteData.
1883
1976
  *
@@ -2003,7 +2096,7 @@ declare namespace RemoteData {
2003
2096
  *
2004
2097
  * @example
2005
2098
  * ```ts
2006
- * const result = await Task.Result.tryCatch(fetchUser, String)();
2099
+ * const result = await Task.Result.tryCatch(fetchUser, { onError: String })();
2007
2100
  * setState(RemoteData.from.Result(result)); // Success(user) or Failure(msg)
2008
2101
  * ```
2009
2102
  */
@@ -2053,7 +2146,7 @@ declare namespace RemoteData {
2053
2146
  * @example
2054
2147
  * ```ts
2055
2148
  * const dbResource = Resource.from.handlers(
2056
- * Task.Result.tryCatch(() => openConnection(config), (e) => new DbError(e)),
2149
+ * Task.Result.tryCatch(() => openConnection(config), { onError: (e) => new DbError(e) }),
2057
2150
  * (conn) => Task.from.Promise(() => conn.close())
2058
2151
  * );
2059
2152
  *
@@ -2076,7 +2169,7 @@ declare namespace Resource {
2076
2169
  * @example
2077
2170
  * ```ts
2078
2171
  * const fileResource = Resource.from.handlers(
2079
- * Task.Result.tryCatch(() => fs.promises.open("data.csv", "r"), toFileError),
2172
+ * Task.Result.tryCatch(() => fs.promises.open("data.csv", "r"), { onError: toFileError }),
2080
2173
  * (handle) => Task.from.Promise(() => handle.close())
2081
2174
  * );
2082
2175
  * ```
@@ -2344,6 +2437,18 @@ declare namespace State {
2344
2437
  * ```
2345
2438
  */
2346
2439
  const bind: <K extends string, S, A, B>(key: K, f: (a: A) => State<S, B>) => (data: State<S, A>) => State<S, A & { [P in K]: B; }>;
2440
+ /**
2441
+ * Focuses a State computation on a sub-state using a Lens.
2442
+ *
2443
+ * @example
2444
+ * ```ts
2445
+ * type AppState = { count: number; name: string };
2446
+ * const countLens = Lens.from.property<AppState>()("count");
2447
+ * const increment = State.modify((c: number) => c + 1);
2448
+ * const focusedProgram = pipe(increment, State.focus(countLens));
2449
+ * ```
2450
+ */
2451
+ const focus: <S, A>(lens: Lens<S, A>) => <B>(stateOp: State<A, B>) => State<S, B>;
2347
2452
  }
2348
2453
 
2349
2454
  type TheseFirst<T> = WithKind<"First"> & WithFirst<T>;
@@ -2406,23 +2511,61 @@ declare namespace These {
2406
2511
  namespace is {
2407
2512
  /**
2408
2513
  * Type guard — checks if a These holds only a first value.
2514
+ *
2515
+ * @example
2516
+ * ```ts
2517
+ * const val = These.make.first(42);
2518
+ * if (These.is.first(val)) {
2519
+ * console.log(val.first); // 42
2520
+ * }
2521
+ * ```
2409
2522
  */
2410
2523
  const first: <A, B>(data: These<A, B>) => data is TheseFirst<A>;
2411
2524
  /**
2412
2525
  * Type guard — checks if a These holds only a second value.
2526
+ *
2527
+ * @example
2528
+ * ```ts
2529
+ * const val = These.make.second("warning");
2530
+ * if (These.is.second(val)) {
2531
+ * console.log(val.second); // "warning"
2532
+ * }
2533
+ * ```
2413
2534
  */
2414
2535
  const second: <A, B>(data: These<A, B>) => data is TheseSecond<B>;
2415
2536
  /**
2416
2537
  * Type guard — checks if a These holds both values simultaneously.
2538
+ *
2539
+ * @example
2540
+ * ```ts
2541
+ * const val = These.make.both(42, "warning");
2542
+ * if (These.is.both(val)) {
2543
+ * console.log(val.first, val.second); // 42 "warning"
2544
+ * }
2545
+ * ```
2417
2546
  */
2418
2547
  const both: <A, B>(data: These<A, B>) => data is TheseBoth<A, B>;
2419
2548
  }
2420
2549
  /**
2421
2550
  * Returns true if the These contains a first value (First or Both).
2551
+ *
2552
+ * @example
2553
+ * ```ts
2554
+ * These.hasFirst(These.make.first(42)); // true
2555
+ * These.hasFirst(These.make.both(42, "warn"));// true
2556
+ * These.hasFirst(These.make.second("warn")); // false
2557
+ * ```
2422
2558
  */
2423
2559
  const hasFirst: <A, B>(data: These<A, B>) => data is TheseFirst<A> | TheseBoth<A, B>;
2424
2560
  /**
2425
2561
  * Returns true if the These contains a second value (Second or Both).
2562
+ *
2563
+ * @example
2564
+ * ```ts
2565
+ * These.hasSecond(These.make.second("warn")); // true
2566
+ * These.hasSecond(These.make.both(42, "warn"));// true
2567
+ * These.hasSecond(These.make.first(42)); // false
2568
+ * ```
2426
2569
  */
2427
2570
  const hasSecond: <A, B>(data: These<A, B>) => data is TheseSecond<B> | TheseBoth<A, B>;
2428
2571
  /**