effect 3.12.3 → 3.12.5

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.
Files changed (54) hide show
  1. package/dist/cjs/Arbitrary.js +72 -14
  2. package/dist/cjs/Arbitrary.js.map +1 -1
  3. package/dist/cjs/DateTime.js.map +1 -1
  4. package/dist/cjs/Inspectable.js +0 -4
  5. package/dist/cjs/Inspectable.js.map +1 -1
  6. package/dist/cjs/ParseResult.js +2 -2
  7. package/dist/cjs/ParseResult.js.map +1 -1
  8. package/dist/cjs/Schema.js +154 -93
  9. package/dist/cjs/Schema.js.map +1 -1
  10. package/dist/cjs/internal/dateTime.js +32 -4
  11. package/dist/cjs/internal/dateTime.js.map +1 -1
  12. package/dist/cjs/internal/effect/circular.js +15 -2
  13. package/dist/cjs/internal/effect/circular.js.map +1 -1
  14. package/dist/cjs/internal/fiberRuntime.js.map +1 -1
  15. package/dist/cjs/internal/version.js +1 -1
  16. package/dist/dts/Arbitrary.d.ts.map +1 -1
  17. package/dist/dts/DateTime.d.ts +40 -36
  18. package/dist/dts/DateTime.d.ts.map +1 -1
  19. package/dist/dts/Inspectable.d.ts.map +1 -1
  20. package/dist/dts/Layer.d.ts +1 -1
  21. package/dist/dts/Layer.d.ts.map +1 -1
  22. package/dist/dts/MetricPolling.d.ts +1 -1
  23. package/dist/dts/MetricPolling.d.ts.map +1 -1
  24. package/dist/dts/ParseResult.d.ts +11 -0
  25. package/dist/dts/ParseResult.d.ts.map +1 -1
  26. package/dist/dts/Schema.d.ts +34 -15
  27. package/dist/dts/Schema.d.ts.map +1 -1
  28. package/dist/esm/Arbitrary.js +72 -14
  29. package/dist/esm/Arbitrary.js.map +1 -1
  30. package/dist/esm/DateTime.js.map +1 -1
  31. package/dist/esm/Inspectable.js +0 -3
  32. package/dist/esm/Inspectable.js.map +1 -1
  33. package/dist/esm/ParseResult.js +2 -2
  34. package/dist/esm/ParseResult.js.map +1 -1
  35. package/dist/esm/Schema.js +149 -86
  36. package/dist/esm/Schema.js.map +1 -1
  37. package/dist/esm/internal/dateTime.js +31 -3
  38. package/dist/esm/internal/dateTime.js.map +1 -1
  39. package/dist/esm/internal/effect/circular.js +15 -2
  40. package/dist/esm/internal/effect/circular.js.map +1 -1
  41. package/dist/esm/internal/fiberRuntime.js.map +1 -1
  42. package/dist/esm/internal/version.js +1 -1
  43. package/package.json +1 -1
  44. package/src/Arbitrary.ts +84 -14
  45. package/src/DateTime.ts +45 -56
  46. package/src/Inspectable.ts +0 -1
  47. package/src/Layer.ts +1 -1
  48. package/src/MetricPolling.ts +1 -1
  49. package/src/ParseResult.ts +15 -2
  50. package/src/Schema.ts +191 -93
  51. package/src/internal/dateTime.ts +67 -33
  52. package/src/internal/effect/circular.ts +19 -17
  53. package/src/internal/fiberRuntime.ts +2 -1
  54. package/src/internal/version.ts +1 -1
package/src/Arbitrary.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Arr from "./Array.js"
6
6
  import * as FastCheck from "./FastCheck.js"
7
+ import { globalValue } from "./GlobalValue.js"
7
8
  import * as errors_ from "./internal/schema/errors.js"
8
9
  import * as schemaId_ from "./internal/schema/schemaId.js"
9
10
  import * as util_ from "./internal/schema/util.js"
@@ -276,6 +277,11 @@ const makeArrayConfig = (options: {
276
277
 
277
278
  type Config = StringConstraints | NumberConstraints | BigIntConstraints | DateConstraints | ArrayConfig
278
279
 
280
+ const arbitraryMemoMap = globalValue(
281
+ Symbol.for("effect/Arbitrary/arbitraryMemoMap"),
282
+ () => new WeakMap<AST.AST, LazyArbitrary<any>>()
283
+ )
284
+
279
285
  const go = (
280
286
  ast: AST.AST,
281
287
  ctx: ArbitraryGenerationContext,
@@ -311,6 +317,7 @@ const go = (
311
317
  const constStringConstraints = makeStringConstraints({})
312
318
  const constNumberConstraints = makeNumberConstraints({})
313
319
  const constBigIntConstraints = makeBigIntConstraints({})
320
+ const defaultSuspendedArrayConstraints: FastCheck.ArrayConstraints = { maxLength: 2 }
314
321
 
315
322
  /** @internal */
316
323
  export const toOp = (
@@ -439,8 +446,22 @@ export const toOp = (
439
446
  const value = indexSignatures[i][1](fc)
440
447
  output = output.chain((o) => {
441
448
  const item = fc.tuple(key, value)
449
+ /*
450
+
451
+ `getSuspendedArray` is used to generate less key/value pairs in
452
+ the context of a recursive schema. Without it, the following schema
453
+ would generate an big amount of values possibly leading to a stack
454
+ overflow:
455
+
456
+ ```ts
457
+ type A = { [_: string]: A }
458
+
459
+ const schema = S.Record({ key: S.String, value: S.suspend((): S.Schema<A> => schema) })
460
+ ```
461
+
462
+ */
442
463
  const arr = ctx.depthIdentifier !== undefined ?
443
- getSuspendedArray(fc, ctx.depthIdentifier, ctx.maxDepth, item) :
464
+ getSuspendedArray(fc, ctx.depthIdentifier, ctx.maxDepth, item, defaultSuspendedArrayConstraints) :
444
465
  fc.array(item)
445
466
  return arr.map((tuples) => ({ ...Object.fromEntries(tuples), ...o }))
446
467
  })
@@ -454,16 +475,39 @@ export const toOp = (
454
475
  return new Succeed((fc) => fc.oneof(...types.map((arb) => arb(fc))))
455
476
  }
456
477
  case "Suspend": {
478
+ const memo = arbitraryMemoMap.get(ast)
479
+ if (memo) {
480
+ return new Succeed(memo)
481
+ }
457
482
  const get = util_.memoizeThunk(() => {
458
483
  return go(ast.f(), getSuspendedContext(ctx, ast), path)
459
484
  })
460
- return new Succeed((fc) => fc.constant(null).chain(() => get()(fc)))
485
+ const out: LazyArbitrary<any> = (fc) => fc.constant(null).chain(() => get()(fc))
486
+ arbitraryMemoMap.set(ast, out)
487
+ return new Succeed(out)
461
488
  }
462
489
  case "Transformation":
463
490
  return toOp(ast.to, ctx, path)
464
491
  }
465
492
  }
466
493
 
494
+ function subtractElementsLength(
495
+ constraints: FastCheck.ArrayConstraints,
496
+ elementsLength: number
497
+ ): FastCheck.ArrayConstraints {
498
+ if (elementsLength === 0 || (constraints.minLength === undefined && constraints.maxLength === undefined)) {
499
+ return constraints
500
+ }
501
+ const out = { ...constraints }
502
+ if (out.minLength !== undefined) {
503
+ out.minLength = Math.max(out.minLength - elementsLength, 0)
504
+ }
505
+ if (out.maxLength !== undefined) {
506
+ out.maxLength = Math.max(out.maxLength - elementsLength, 0)
507
+ }
508
+ return out
509
+ }
510
+
467
511
  const goTupleType = (
468
512
  ast: AST.TupleType,
469
513
  ctx: ArbitraryGenerationContext,
@@ -508,9 +552,36 @@ const goTupleType = (
508
552
  const [head, ...tail] = rest
509
553
  const item = head(fc)
510
554
  output = output.chain((as) => {
511
- return (ctx.depthIdentifier !== undefined
512
- ? getSuspendedArray(fc, ctx.depthIdentifier, ctx.maxDepth, item, constraints)
513
- : fc.array(item, constraints)).map((rest) => [...as, ...rest])
555
+ const len = as.length
556
+ // We must adjust the constraints for the rest element
557
+ // because the elements might have generated some values
558
+ const restArrayConstraints = subtractElementsLength(constraints, len)
559
+ if (restArrayConstraints.maxLength === 0) {
560
+ return fc.constant(as)
561
+ }
562
+ /*
563
+
564
+ `getSuspendedArray` is used to generate less values in
565
+ the context of a recursive schema. Without it, the following schema
566
+ would generate an big amount of values possibly leading to a stack
567
+ overflow:
568
+
569
+ ```ts
570
+ type A = ReadonlyArray<A | null>
571
+
572
+ const schema = S.Array(
573
+ S.NullOr(S.suspend((): S.Schema<A> => schema))
574
+ )
575
+ ```
576
+
577
+ */
578
+ const arr = ctx.depthIdentifier !== undefined
579
+ ? getSuspendedArray(fc, ctx.depthIdentifier, ctx.maxDepth, item, restArrayConstraints)
580
+ : fc.array(item, restArrayConstraints)
581
+ if (len === 0) {
582
+ return arr
583
+ }
584
+ return arr.map((rest) => [...as, ...rest])
514
585
  })
515
586
  // ---------------------------------------------
516
587
  // handle post rest elements
@@ -660,20 +731,19 @@ const getSuspendedArray = (
660
731
  depthIdentifier: string,
661
732
  maxDepth: number,
662
733
  item: FastCheck.Arbitrary<any>,
663
- constraints?: FastCheck.ArrayConstraints
734
+ constraints: FastCheck.ArrayConstraints
664
735
  ) => {
665
- let minLength = 1
666
- let maxLength = 2
667
- if (constraints && constraints.minLength !== undefined && constraints.minLength > minLength) {
668
- minLength = constraints.minLength
669
- if (minLength > maxLength) {
670
- maxLength = minLength
671
- }
736
+ // In the context of a recursive schema, we don't want a `maxLength` greater than 2.
737
+ // The only exception is when `minLength` is also set, in which case we set
738
+ // `maxLength` to the minimum value, which is `minLength`.
739
+ const maxLengthLimit = Math.max(2, constraints.minLength ?? 0)
740
+ if (constraints.maxLength !== undefined && constraints.maxLength > maxLengthLimit) {
741
+ constraints = { ...constraints, maxLength: maxLengthLimit }
672
742
  }
673
743
  return fc.oneof(
674
744
  { maxDepth, depthIdentifier },
675
745
  fc.constant([]),
676
- fc.array(item, { minLength, maxLength })
746
+ fc.array(item, constraints)
677
747
  )
678
748
  }
679
749
 
package/src/DateTime.ts CHANGED
@@ -43,8 +43,7 @@ export type DateTime = Utc | Zoned
43
43
  export interface Utc extends DateTime.Proto {
44
44
  readonly _tag: "Utc"
45
45
  readonly epochMillis: number
46
- /** @internal */
47
- partsUtc: DateTime.PartsWithWeekday
46
+ partsUtc: DateTime.PartsWithWeekday | undefined
48
47
  }
49
48
 
50
49
  /**
@@ -55,12 +54,9 @@ export interface Zoned extends DateTime.Proto {
55
54
  readonly _tag: "Zoned"
56
55
  readonly epochMillis: number
57
56
  readonly zone: TimeZone
58
- /** @internal */
59
- adjustedEpochMillis?: number
60
- /** @internal */
61
- partsAdjusted?: DateTime.PartsWithWeekday
62
- /** @internal */
63
- partsUtc?: DateTime.PartsWithWeekday
57
+ adjustedEpochMillis: number | undefined
58
+ partsAdjusted: DateTime.PartsWithWeekday | undefined
59
+ partsUtc: DateTime.PartsWithWeekday | undefined
64
60
  }
65
61
 
66
62
  /**
@@ -282,11 +278,16 @@ export const clamp: {
282
278
  /**
283
279
  * @since 3.6.0
284
280
  */
285
- (options: { minimum: DateTime; maximum: DateTime }): (self: DateTime) => DateTime
281
+ <Min extends DateTime, Max extends DateTime>(
282
+ options: { readonly minimum: Min; readonly maximum: Max }
283
+ ): <A extends DateTime>(self: A) => A | Min | Max
286
284
  /**
287
285
  * @since 3.6.0
288
286
  */
289
- (self: DateTime, options: { minimum: DateTime; maximum: DateTime }): DateTime
287
+ <A extends DateTime, Min extends DateTime, Max extends DateTime>(
288
+ self: A,
289
+ options: { readonly minimum: Min; readonly maximum: Max }
290
+ ): A | Min | Max
290
291
  } = Internal.clamp
291
292
 
292
293
  // =============================================================================
@@ -1032,12 +1033,12 @@ export const min: {
1032
1033
  * @since 3.6.0
1033
1034
  * @category comparisons
1034
1035
  */
1035
- (that: DateTime): (self: DateTime) => DateTime
1036
+ <That extends DateTime>(that: That): <Self extends DateTime>(self: Self) => Self | That
1036
1037
  /**
1037
1038
  * @since 3.6.0
1038
1039
  * @category comparisons
1039
1040
  */
1040
- (self: DateTime, that: DateTime): DateTime
1041
+ <Self extends DateTime, That extends DateTime>(self: Self, that: That): Self | That
1041
1042
  } = Internal.min
1042
1043
 
1043
1044
  /**
@@ -1049,12 +1050,12 @@ export const max: {
1049
1050
  * @since 3.6.0
1050
1051
  * @category comparisons
1051
1052
  */
1052
- (that: DateTime): (self: DateTime) => DateTime
1053
+ <That extends DateTime>(that: That): <Self extends DateTime>(self: Self) => Self | That
1053
1054
  /**
1054
1055
  * @since 3.6.0
1055
1056
  * @category comparisons
1056
1057
  */
1057
- (self: DateTime, that: DateTime): DateTime
1058
+ <Self extends DateTime, That extends DateTime>(self: Self, that: That): Self | That
1058
1059
  } = Internal.max
1059
1060
 
1060
1061
  /**
@@ -1381,7 +1382,7 @@ export const setParts: {
1381
1382
  * @since 3.6.0
1382
1383
  * @category parts
1383
1384
  */
1384
- (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1385
+ (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A
1385
1386
  /**
1386
1387
  * Set the different parts of a `DateTime` as an object.
1387
1388
  *
@@ -1390,7 +1391,7 @@ export const setParts: {
1390
1391
  * @since 3.6.0
1391
1392
  * @category parts
1392
1393
  */
1393
- <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): DateTime.PreserveZone<A>
1394
+ <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A
1394
1395
  } = Internal.setParts
1395
1396
 
1396
1397
  /**
@@ -1406,14 +1407,14 @@ export const setPartsUtc: {
1406
1407
  * @since 3.6.0
1407
1408
  * @category parts
1408
1409
  */
1409
- (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1410
+ (parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A
1410
1411
  /**
1411
1412
  * Set the different parts of a `DateTime` as an object.
1412
1413
  *
1413
1414
  * @since 3.6.0
1414
1415
  * @category parts
1415
1416
  */
1416
- <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): DateTime.PreserveZone<A>
1417
+ <A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A
1417
1418
  } = Internal.setPartsUtc
1418
1419
 
1419
1420
  // =============================================================================
@@ -1698,7 +1699,7 @@ export const mutate: {
1698
1699
  * @since 3.6.0
1699
1700
  * @category mapping
1700
1701
  */
1701
- (f: (date: Date) => void): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1702
+ (f: (date: Date) => void): <A extends DateTime>(self: A) => A
1702
1703
  // =============================================================================
1703
1704
  // mapping
1704
1705
  // =============================================================================
@@ -1712,7 +1713,7 @@ export const mutate: {
1712
1713
  * @since 3.6.0
1713
1714
  * @category mapping
1714
1715
  */
1715
- <A extends DateTime>(self: A, f: (date: Date) => void): DateTime.PreserveZone<A>
1716
+ <A extends DateTime>(self: A, f: (date: Date) => void): A
1716
1717
  } = Internal.mutate
1717
1718
 
1718
1719
  /**
@@ -1728,14 +1729,14 @@ export const mutateUtc: {
1728
1729
  * @since 3.6.0
1729
1730
  * @category mapping
1730
1731
  */
1731
- (f: (date: Date) => void): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1732
+ (f: (date: Date) => void): <A extends DateTime>(self: A) => A
1732
1733
  /**
1733
1734
  * Modify a `DateTime` by applying a function to a cloned UTC `Date` instance.
1734
1735
  *
1735
1736
  * @since 3.6.0
1736
1737
  * @category mapping
1737
1738
  */
1738
- <A extends DateTime>(self: A, f: (date: Date) => void): DateTime.PreserveZone<A>
1739
+ <A extends DateTime>(self: A, f: (date: Date) => void): A
1739
1740
  } = Internal.mutateUtc
1740
1741
 
1741
1742
  /**
@@ -1771,7 +1772,7 @@ export const mapEpochMillis: {
1771
1772
  * )
1772
1773
  * ```
1773
1774
  */
1774
- (f: (millis: number) => number): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1775
+ (f: (millis: number) => number): <A extends DateTime>(self: A) => A
1775
1776
  /**
1776
1777
  * Transform a `DateTime` by applying a function to the number of milliseconds
1777
1778
  * since the Unix epoch.
@@ -1788,7 +1789,7 @@ export const mapEpochMillis: {
1788
1789
  * )
1789
1790
  * ```
1790
1791
  */
1791
- <A extends DateTime>(self: A, f: (millis: number) => number): DateTime.PreserveZone<A>
1792
+ <A extends DateTime>(self: A, f: (millis: number) => number): A
1792
1793
  } = Internal.mapEpochMillis
1793
1794
 
1794
1795
  /**
@@ -1964,7 +1965,7 @@ export const addDuration: {
1964
1965
  * )
1965
1966
  * ```
1966
1967
  */
1967
- (duration: Duration.DurationInput): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
1968
+ (duration: Duration.DurationInput): <A extends DateTime>(self: A) => A
1968
1969
  // =============================================================================
1969
1970
  // math
1970
1971
  // =============================================================================
@@ -1984,7 +1985,7 @@ export const addDuration: {
1984
1985
  * )
1985
1986
  * ```
1986
1987
  */
1987
- <A extends DateTime>(self: A, duration: Duration.DurationInput): DateTime.PreserveZone<A>
1988
+ <A extends DateTime>(self: A, duration: Duration.DurationInput): A
1988
1989
  } = Internal.addDuration
1989
1990
 
1990
1991
  /**
@@ -2018,7 +2019,7 @@ export const subtractDuration: {
2018
2019
  * )
2019
2020
  * ```
2020
2021
  */
2021
- (duration: Duration.DurationInput): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2022
+ (duration: Duration.DurationInput): <A extends DateTime>(self: A) => A
2022
2023
  /**
2023
2024
  * Subtract the given `Duration` from a `DateTime`.
2024
2025
  *
@@ -2034,7 +2035,7 @@ export const subtractDuration: {
2034
2035
  * )
2035
2036
  * ```
2036
2037
  */
2037
- <A extends DateTime>(self: A, duration: Duration.DurationInput): DateTime.PreserveZone<A>
2038
+ <A extends DateTime>(self: A, duration: Duration.DurationInput): A
2038
2039
  } = Internal.subtractDuration
2039
2040
 
2040
2041
  /**
@@ -2074,7 +2075,7 @@ export const add: {
2074
2075
  * )
2075
2076
  * ```
2076
2077
  */
2077
- (parts: Partial<DateTime.PartsForMath>): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2078
+ (parts: Partial<DateTime.PartsForMath>): <A extends DateTime>(self: A) => A
2078
2079
  /**
2079
2080
  * Add the given `amount` of `unit`'s to a `DateTime`.
2080
2081
  *
@@ -2093,7 +2094,7 @@ export const add: {
2093
2094
  * )
2094
2095
  * ```
2095
2096
  */
2096
- <A extends DateTime>(self: A, parts: Partial<DateTime.PartsForMath>): DateTime.PreserveZone<A>
2097
+ <A extends DateTime>(self: A, parts: Partial<DateTime.PartsForMath>): A
2097
2098
  } = Internal.add
2098
2099
 
2099
2100
  /**
@@ -2127,7 +2128,7 @@ export const subtract: {
2127
2128
  * )
2128
2129
  * ```
2129
2130
  */
2130
- (parts: Partial<DateTime.PartsForMath>): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2131
+ (parts: Partial<DateTime.PartsForMath>): <A extends DateTime>(self: A) => A
2131
2132
  /**
2132
2133
  * Subtract the given `amount` of `unit`'s from a `DateTime`.
2133
2134
  *
@@ -2143,7 +2144,7 @@ export const subtract: {
2143
2144
  * )
2144
2145
  * ```
2145
2146
  */
2146
- <A extends DateTime>(self: A, parts: Partial<DateTime.PartsForMath>): DateTime.PreserveZone<A>
2147
+ <A extends DateTime>(self: A, parts: Partial<DateTime.PartsForMath>): A
2147
2148
  } = Internal.subtract
2148
2149
 
2149
2150
  /**
@@ -2187,10 +2188,8 @@ export const startOf: {
2187
2188
  */
2188
2189
  (
2189
2190
  part: DateTime.UnitSingular,
2190
- options?: {
2191
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2192
- }
2193
- ): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2191
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2192
+ ): <A extends DateTime>(self: A) => A
2194
2193
  /**
2195
2194
  * Converts a `DateTime` to the start of the given `part`.
2196
2195
  *
@@ -2213,10 +2212,8 @@ export const startOf: {
2213
2212
  <A extends DateTime>(
2214
2213
  self: A,
2215
2214
  part: DateTime.UnitSingular,
2216
- options?: {
2217
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2218
- }
2219
- ): DateTime.PreserveZone<A>
2215
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2216
+ ): A
2220
2217
  } = Internal.startOf
2221
2218
 
2222
2219
  /**
@@ -2260,10 +2257,8 @@ export const endOf: {
2260
2257
  */
2261
2258
  (
2262
2259
  part: DateTime.UnitSingular,
2263
- options?: {
2264
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2265
- }
2266
- ): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2260
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2261
+ ): <A extends DateTime>(self: A) => A
2267
2262
  /**
2268
2263
  * Converts a `DateTime` to the end of the given `part`.
2269
2264
  *
@@ -2286,10 +2281,8 @@ export const endOf: {
2286
2281
  <A extends DateTime>(
2287
2282
  self: A,
2288
2283
  part: DateTime.UnitSingular,
2289
- options?: {
2290
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2291
- }
2292
- ): DateTime.PreserveZone<A>
2284
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2285
+ ): A
2293
2286
  } = Internal.endOf
2294
2287
 
2295
2288
  /**
@@ -2333,10 +2326,8 @@ export const nearest: {
2333
2326
  */
2334
2327
  (
2335
2328
  part: DateTime.UnitSingular,
2336
- options?: {
2337
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2338
- }
2339
- ): <A extends DateTime>(self: A) => DateTime.PreserveZone<A>
2329
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2330
+ ): <A extends DateTime>(self: A) => A
2340
2331
  /**
2341
2332
  * Converts a `DateTime` to the nearest given `part`.
2342
2333
  *
@@ -2359,10 +2350,8 @@ export const nearest: {
2359
2350
  <A extends DateTime>(
2360
2351
  self: A,
2361
2352
  part: DateTime.UnitSingular,
2362
- options?: {
2363
- readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined
2364
- }
2365
- ): DateTime.PreserveZone<A>
2353
+ options?: { readonly weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined }
2354
+ ): A
2366
2355
  } = Internal.nearest
2367
2356
 
2368
2357
  // =============================================================================
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * @since 2.0.0
3
3
  */
4
-
5
4
  import type * as FiberRefs from "./FiberRefs.js"
6
5
  import { globalValue } from "./GlobalValue.js"
7
6
  import { hasProperty, isFunction } from "./Predicate.js"
package/src/Layer.ts CHANGED
@@ -865,7 +865,7 @@ export const retry: {
865
865
  * @category retrying
866
866
  */
867
867
  <X, E, RIn2>(
868
- schedule: Schedule.Schedule<X, E, RIn2>
868
+ schedule: Schedule.Schedule<X, NoInfer<E>, RIn2>
869
869
  ): <ROut, RIn>(self: Layer<ROut, E, RIn>) => Layer<ROut, E, RIn2 | RIn>
870
870
  /**
871
871
  * Retries constructing this layer according to the specified schedule.
@@ -128,7 +128,7 @@ export const retry: {
128
128
  * @category constructors
129
129
  */
130
130
  <X, E, R2>(
131
- policy: Schedule.Schedule<X, E, R2>
131
+ policy: Schedule.Schedule<X, NoInfer<E>, R2>
132
132
  ): <Type, In, R, Out>(self: MetricPolling<Type, In, R, E, Out>) => MetricPolling<Type, In, R2 | R, E, Out>
133
133
  /**
134
134
  * Returns a new polling metric whose poll function will be retried with the
@@ -809,11 +809,11 @@ interface Parser {
809
809
  }
810
810
 
811
811
  const decodeMemoMap = globalValue(
812
- Symbol.for("effect/Schema/Parser/decodeMemoMap"),
812
+ Symbol.for("effect/ParseResult/decodeMemoMap"),
813
813
  () => new WeakMap<AST.AST, Parser>()
814
814
  )
815
815
  const encodeMemoMap = globalValue(
816
- Symbol.for("effect/Schema/Parser/encodeMemoMap"),
816
+ Symbol.for("effect/ParseResult/encodeMemoMap"),
817
817
  () => new WeakMap<AST.AST, Parser>()
818
818
  )
819
819
 
@@ -1983,12 +1983,25 @@ const formatTree = (
1983
1983
  }
1984
1984
 
1985
1985
  /**
1986
+ * Represents an issue returned by the {@link ArrayFormatter} formatter.
1987
+ *
1986
1988
  * @category model
1987
1989
  * @since 3.10.0
1988
1990
  */
1989
1991
  export interface ArrayFormatterIssue {
1992
+ /**
1993
+ * The tag identifying the type of parse issue.
1994
+ */
1990
1995
  readonly _tag: ParseIssue["_tag"]
1996
+
1997
+ /**
1998
+ * The path to the property where the issue occurred.
1999
+ */
1991
2000
  readonly path: ReadonlyArray<PropertyKey>
2001
+
2002
+ /**
2003
+ * A descriptive message explaining the issue.
2004
+ */
1992
2005
  readonly message: string
1993
2006
  }
1994
2007