effect 4.0.0-beta.83 → 4.0.0-beta.84

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 (195) hide show
  1. package/dist/Array.d.ts +64 -64
  2. package/dist/Array.js +26 -26
  3. package/dist/Cache.d.ts +1 -1
  4. package/dist/Cache.js +1 -1
  5. package/dist/Cause.d.ts +68 -68
  6. package/dist/Cause.js +47 -47
  7. package/dist/Channel.d.ts +5 -5
  8. package/dist/Channel.js +3 -3
  9. package/dist/Clock.d.ts +1 -1
  10. package/dist/Clock.js +1 -1
  11. package/dist/Combiner.d.ts +9 -9
  12. package/dist/Combiner.js +8 -8
  13. package/dist/Config.d.ts +15 -94
  14. package/dist/Config.d.ts.map +1 -1
  15. package/dist/Config.js +22 -70
  16. package/dist/Config.js.map +1 -1
  17. package/dist/ConfigProvider.d.ts +58 -74
  18. package/dist/ConfigProvider.d.ts.map +1 -1
  19. package/dist/ConfigProvider.js +66 -41
  20. package/dist/ConfigProvider.js.map +1 -1
  21. package/dist/Console.d.ts +1 -1
  22. package/dist/Console.js +1 -1
  23. package/dist/Data.d.ts +15 -15
  24. package/dist/Data.js +3 -3
  25. package/dist/DateTime.d.ts +6 -6
  26. package/dist/DateTime.js +2 -2
  27. package/dist/Duration.d.ts +3 -3
  28. package/dist/Duration.js +3 -3
  29. package/dist/Effect.d.ts +84 -45
  30. package/dist/Effect.d.ts.map +1 -1
  31. package/dist/Effect.js +72 -33
  32. package/dist/Effect.js.map +1 -1
  33. package/dist/Equal.d.ts +7 -7
  34. package/dist/Equal.js +5 -5
  35. package/dist/Equivalence.d.ts +17 -17
  36. package/dist/Equivalence.js +13 -13
  37. package/dist/Exit.d.ts +3 -3
  38. package/dist/Exit.js +3 -3
  39. package/dist/Formatter.d.ts +5 -5
  40. package/dist/Formatter.js +4 -4
  41. package/dist/Function.d.ts +10 -10
  42. package/dist/Function.js +3 -3
  43. package/dist/HashMap.d.ts +3 -3
  44. package/dist/HashMap.js +1 -1
  45. package/dist/Iterable.d.ts +6 -6
  46. package/dist/Iterable.js +2 -2
  47. package/dist/JsonPatch.d.ts +2 -2
  48. package/dist/Layer.d.ts +1 -1
  49. package/dist/Layer.js +1 -1
  50. package/dist/Logger.d.ts +1 -1
  51. package/dist/Logger.js +1 -1
  52. package/dist/Match.d.ts +8 -8
  53. package/dist/Match.js +8 -8
  54. package/dist/Metric.d.ts +3 -3
  55. package/dist/Metric.js +3 -3
  56. package/dist/Optic.d.ts +30 -30
  57. package/dist/Optic.js +12 -12
  58. package/dist/Option.d.ts +7 -7
  59. package/dist/Option.js +7 -7
  60. package/dist/Order.d.ts +23 -23
  61. package/dist/Order.js +20 -20
  62. package/dist/Pool.d.ts +1 -1
  63. package/dist/Pool.js +1 -1
  64. package/dist/Predicate.d.ts +88 -88
  65. package/dist/Predicate.js +47 -47
  66. package/dist/PubSub.d.ts +3 -3
  67. package/dist/PubSub.js +3 -3
  68. package/dist/Reducer.d.ts +1 -1
  69. package/dist/Reducer.js +1 -1
  70. package/dist/Result.d.ts +18 -18
  71. package/dist/Result.js +8 -8
  72. package/dist/Runtime.d.ts +1 -1
  73. package/dist/Runtime.js +1 -1
  74. package/dist/Schema.d.ts +265 -120
  75. package/dist/Schema.d.ts.map +1 -1
  76. package/dist/Schema.js +285 -116
  77. package/dist/Schema.js.map +1 -1
  78. package/dist/SchemaAST.d.ts +1 -1
  79. package/dist/SchemaAST.d.ts.map +1 -1
  80. package/dist/SchemaAST.js +13 -9
  81. package/dist/SchemaAST.js.map +1 -1
  82. package/dist/SchemaGetter.d.ts +48 -48
  83. package/dist/SchemaGetter.js +44 -44
  84. package/dist/SchemaIssue.d.ts +3 -3
  85. package/dist/SchemaIssue.js +3 -3
  86. package/dist/SchemaParser.d.ts +122 -22
  87. package/dist/SchemaParser.d.ts.map +1 -1
  88. package/dist/SchemaParser.js +186 -50
  89. package/dist/SchemaParser.js.map +1 -1
  90. package/dist/SchemaRepresentation.d.ts +1 -1
  91. package/dist/SchemaRepresentation.d.ts.map +1 -1
  92. package/dist/SchemaRepresentation.js +96 -2
  93. package/dist/SchemaRepresentation.js.map +1 -1
  94. package/dist/SchemaTransformation.d.ts +20 -20
  95. package/dist/SchemaTransformation.js +18 -18
  96. package/dist/Stream.d.ts +3 -3
  97. package/dist/Stream.js +2 -2
  98. package/dist/Stream.js.map +1 -1
  99. package/dist/String.d.ts +1 -1
  100. package/dist/String.js +1 -1
  101. package/dist/Struct.d.ts +1 -1
  102. package/dist/Struct.js +1 -1
  103. package/dist/Types.d.ts +13 -13
  104. package/dist/internal/effect.js +23 -10
  105. package/dist/internal/effect.js.map +1 -1
  106. package/dist/internal/schema/cause.d.ts +2 -0
  107. package/dist/internal/schema/cause.d.ts.map +1 -0
  108. package/dist/internal/schema/cause.js +24 -0
  109. package/dist/internal/schema/cause.js.map +1 -0
  110. package/dist/internal/schema/schema.d.ts +8 -4
  111. package/dist/internal/schema/schema.d.ts.map +1 -1
  112. package/dist/internal/schema/schema.js +21 -8
  113. package/dist/internal/schema/schema.js.map +1 -1
  114. package/dist/testing/TestSchema.d.ts +3 -3
  115. package/dist/testing/TestSchema.js +1 -1
  116. package/dist/unstable/ai/AiError.d.ts +1 -1
  117. package/dist/unstable/ai/AiError.js +1 -1
  118. package/dist/unstable/ai/Chat.d.ts +1 -1
  119. package/dist/unstable/ai/Chat.js +1 -1
  120. package/dist/unstable/cli/Prompt.js +2 -2
  121. package/dist/unstable/cli/Prompt.js.map +1 -1
  122. package/dist/unstable/httpapi/HttpApiScalar.d.ts +2 -2
  123. package/dist/unstable/rpc/Rpc.d.ts +1 -1
  124. package/dist/unstable/rpc/Rpc.js +1 -1
  125. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  126. package/dist/unstable/rpc/RpcGroup.js +3 -4
  127. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  128. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  129. package/dist/unstable/sql/SqlResolver.js +15 -2
  130. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  131. package/dist/unstable/workflow/Activity.d.ts +1 -0
  132. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  133. package/dist/unstable/workflow/Activity.js +1 -0
  134. package/dist/unstable/workflow/Activity.js.map +1 -1
  135. package/dist/unstable/workflow/WorkflowEngine.js +1 -1
  136. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  137. package/package.json +1 -1
  138. package/src/Array.ts +65 -65
  139. package/src/Cache.ts +1 -1
  140. package/src/Cause.ts +68 -68
  141. package/src/Channel.ts +5 -5
  142. package/src/Clock.ts +1 -1
  143. package/src/Combiner.ts +9 -9
  144. package/src/Config.ts +40 -108
  145. package/src/ConfigProvider.ts +139 -100
  146. package/src/Console.ts +1 -1
  147. package/src/Data.ts +15 -15
  148. package/src/DateTime.ts +6 -6
  149. package/src/Duration.ts +3 -3
  150. package/src/Effect.ts +89 -45
  151. package/src/Equal.ts +7 -7
  152. package/src/Equivalence.ts +17 -17
  153. package/src/Exit.ts +3 -3
  154. package/src/Formatter.ts +5 -5
  155. package/src/Function.ts +10 -10
  156. package/src/HashMap.ts +3 -3
  157. package/src/Iterable.ts +6 -6
  158. package/src/JsonPatch.ts +2 -2
  159. package/src/Layer.ts +1 -1
  160. package/src/Logger.ts +1 -1
  161. package/src/Match.ts +8 -8
  162. package/src/Metric.ts +3 -3
  163. package/src/Optic.ts +30 -30
  164. package/src/Option.ts +7 -7
  165. package/src/Order.ts +23 -23
  166. package/src/Pool.ts +1 -1
  167. package/src/Predicate.ts +88 -88
  168. package/src/PubSub.ts +3 -3
  169. package/src/Reducer.ts +1 -1
  170. package/src/Result.ts +20 -20
  171. package/src/Runtime.ts +1 -1
  172. package/src/Schema.ts +314 -131
  173. package/src/SchemaAST.ts +20 -11
  174. package/src/SchemaGetter.ts +48 -48
  175. package/src/SchemaIssue.ts +3 -3
  176. package/src/SchemaParser.ts +197 -58
  177. package/src/SchemaRepresentation.ts +73 -3
  178. package/src/SchemaTransformation.ts +20 -20
  179. package/src/Stream.ts +4 -4
  180. package/src/String.ts +1 -1
  181. package/src/Struct.ts +1 -1
  182. package/src/Types.ts +13 -13
  183. package/src/internal/effect.ts +29 -10
  184. package/src/internal/schema/cause.ts +26 -0
  185. package/src/internal/schema/schema.ts +36 -10
  186. package/src/testing/TestSchema.ts +3 -3
  187. package/src/unstable/ai/AiError.ts +1 -1
  188. package/src/unstable/ai/Chat.ts +1 -1
  189. package/src/unstable/cli/Prompt.ts +1 -1
  190. package/src/unstable/httpapi/HttpApiScalar.ts +2 -2
  191. package/src/unstable/rpc/Rpc.ts +1 -1
  192. package/src/unstable/rpc/RpcGroup.ts +3 -4
  193. package/src/unstable/sql/SqlResolver.ts +15 -2
  194. package/src/unstable/workflow/Activity.ts +2 -0
  195. package/src/unstable/workflow/WorkflowEngine.ts +1 -1
package/dist/Schema.d.ts CHANGED
@@ -157,6 +157,8 @@ export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.
157
157
  *
158
158
  * Throws an `Error` with the schema issue in its `cause` when validation
159
159
  * fails.
160
+ * Causes that contain defects, interruptions, or other non-schema reasons
161
+ * throw with the underlying `Cause` attached instead.
160
162
  *
161
163
  * @see {@link Bottom.makeOption} — construct synchronously and discard validation details
162
164
  * @see {@link Bottom.makeEffect} — construct through `Effect` when validation failure should stay in the error channel
@@ -176,6 +178,12 @@ export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.
176
178
  * Applies constructor defaults and type-side validation according to
177
179
  * `MakeOptions`.
178
180
  *
181
+ * **Gotchas**
182
+ *
183
+ * Only causes made entirely of schema issues are converted to `None`. Causes
184
+ * that contain defects, interruptions, or other non-schema reasons throw
185
+ * instead.
186
+ *
179
187
  * @see {@link Bottom.make} — construct synchronously when validation failure should throw
180
188
  * @see {@link Bottom.makeEffect} — construct through `Effect` when validation details should stay in the error channel
181
189
  */
@@ -276,7 +284,7 @@ export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [
276
284
  * Use when you are defining a schema for an opaque type with no type parameters
277
285
  * and validation can be expressed as a type guard.
278
286
  *
279
- * **Example** (Schema for a custom `UserId` branded type)
287
+ * **Example** (Defining a schema for a custom `UserId` branded type)
280
288
  *
281
289
  * ```ts
282
290
  * import { Schema } from "effect"
@@ -400,7 +408,7 @@ export declare function annotateEncoded<S extends Top>(annotations: Annotations.
400
408
  * as well as standard documentation fields such as `title`, `description`,
401
409
  * and `examples`.
402
410
  *
403
- * **Example** (Custom missing-key message for a required field)
411
+ * **Example** (Customizing the missing-key message for a required field)
404
412
  *
405
413
  * ```ts
406
414
  * import { Schema } from "effect"
@@ -477,7 +485,7 @@ export declare namespace Schema {
477
485
  * constructors in this module (e.g. {@link Struct}, {@link String}, {@link Number}).
478
486
  * When you also need the encoded type or service requirements, use {@link Codec}.
479
487
  *
480
- * **Example** (Function that accepts any schema decoding to `string`)
488
+ * **Example** (Accepting any schema decoding to `string`)
481
489
  *
482
490
  * ```ts
483
491
  * import { Schema } from "effect"
@@ -628,7 +636,7 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
628
636
  * constraining or depending on the encoded representation (`Encoded` is
629
637
  * `unknown`) or encoding services.
630
638
  *
631
- * **Example** (Function that only needs to decode)
639
+ * **Example** (Accepting schemas that only need to decode)
632
640
  *
633
641
  * ```ts
634
642
  * import { Schema } from "effect"
@@ -654,7 +662,7 @@ export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, un
654
662
  * constraining or depending on the decoded `Type` (`Type` is `unknown`) or
655
663
  * decoding services.
656
664
  *
657
- * **Example** (Function that only needs to encode)
665
+ * **Example** (Accepting schemas that only need to encode)
658
666
  *
659
667
  * ```ts
660
668
  * import { Schema } from "effect"
@@ -733,7 +741,7 @@ SchemaError };
733
741
  /**
734
742
  * Returns `true` if `u` is a {@link SchemaError}.
735
743
  *
736
- * **Example** (Type guard in a catch block)
744
+ * **Example** (Narrowing Schema errors in a catch block)
737
745
  *
738
746
  * ```ts
739
747
  * import { Schema } from "effect"
@@ -837,10 +845,16 @@ export declare function toStandardJSONSchemaV1<S extends Top>(self: S): Standard
837
845
  * **Details**
838
846
  *
839
847
  * This function returns a predicate that performs a type-safe check, narrowing
840
- * the type of the input value if the check passes. It's particularly useful for
841
- * runtime type validation and TypeScript type narrowing.
848
+ * the type of the input value if the check passes. The predicate returns `false`
849
+ * for schema mismatches.
850
+ *
851
+ * **Gotchas**
842
852
  *
843
- * **Example** (Basic Type Guard)
853
+ * Only causes made entirely of schema issues are converted to `false`. Causes
854
+ * that contain defects, interruptions, or other non-schema reasons throw
855
+ * instead.
856
+ *
857
+ * **Example** (Defining a basic type guard)
844
858
  *
845
859
  * ```ts
846
860
  * import { Schema } from "effect"
@@ -863,7 +877,7 @@ export declare function toStandardJSONSchemaV1<S extends Top>(self: S): Standard
863
877
  */
864
878
  export declare const is: typeof SchemaParser.is;
865
879
  /**
866
- * Creates an assertion function that throws an error if the input doesn't match
880
+ * Creates an assertion function that throws an error if the input does not match
867
881
  * the schema.
868
882
  *
869
883
  * **When to use**
@@ -873,10 +887,16 @@ export declare const is: typeof SchemaParser.is;
873
887
  *
874
888
  * **Details**
875
889
  *
876
- * The input is narrowed if the assertion succeeds. If validation fails, the
877
- * assertion throws.
890
+ * The input is narrowed if the assertion succeeds. If schema validation fails,
891
+ * the assertion throws an `Error` whose cause is `SchemaIssue.Issue`.
892
+ *
893
+ * **Gotchas**
894
+ *
895
+ * Causes that contain defects, interruptions, or other non-schema reasons throw
896
+ * with the underlying `Cause` attached instead of being converted to schema
897
+ * validation errors.
878
898
  *
879
- * **Example** (Basic Usage)
899
+ * **Example** (Asserting and narrowing an input)
880
900
  *
881
901
  * ```ts
882
902
  * import { Schema } from "effect"
@@ -946,13 +966,12 @@ export declare function decodeUnknownEffect<S extends Top>(schema: S, options?:
946
966
  export declare const decodeEffect: <S extends Top>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
947
967
  /**
948
968
  * Decodes an `unknown` input against a schema synchronously, returning an
949
- * `Exit` that is either a `Success` with the decoded value or a `Failure` with
950
- * a {@link SchemaError}.
969
+ * `Exit` that is either a `Success` with the decoded value or a `Failure`.
951
970
  *
952
971
  * **When to use**
953
972
  *
954
- * Use when you need to decode unknown input into an `Exit` whose failure
955
- * contains `SchemaError`.
973
+ * Use when you need to decode unknown input into an `Exit` and capture schema
974
+ * mismatches as `SchemaError`.
956
975
  *
957
976
  * **Details**
958
977
  *
@@ -961,6 +980,14 @@ export declare const decodeEffect: <S extends Top>(schema: S, options?: SchemaAS
961
980
  * type.
962
981
  * Options may be provided either when creating the decoder or when applying it;
963
982
  * application options override creation options.
983
+ * Schema mismatches are represented by a `Failure` cause containing
984
+ * `SchemaError`.
985
+ *
986
+ * **Gotchas**
987
+ *
988
+ * Schema issue fail reasons are wrapped as `SchemaError`. Defects,
989
+ * interruptions, and other non-schema reasons remain in the returned `Cause`,
990
+ * including when they are mixed with schema issues.
964
991
  *
965
992
  * @see {@link SchemaParser.decodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
966
993
  *
@@ -970,13 +997,13 @@ export declare const decodeEffect: <S extends Top>(schema: S, options?: SchemaAS
970
997
  export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
971
998
  /**
972
999
  * Decodes a typed input (the schema's `Encoded` type) against a schema
973
- * synchronously, returning an `Exit` that is either a `Success` with the
974
- * decoded value or a `Failure` with a {@link SchemaError}.
1000
+ * synchronously, returning an `Exit` that is either a `Success` with the decoded
1001
+ * value or a `Failure`.
975
1002
  *
976
1003
  * **When to use**
977
1004
  *
978
- * Use when you need to decode already typed `Encoded` input into an `Exit`
979
- * whose failure contains `SchemaError`.
1005
+ * Use when you need to decode already typed `Encoded` input into an `Exit` and
1006
+ * capture schema mismatches as `SchemaError`.
980
1007
  *
981
1008
  * **Details**
982
1009
  *
@@ -984,6 +1011,14 @@ export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S,
984
1011
  * `unknown` input use {@link decodeUnknownExit}.
985
1012
  * Options may be provided either when creating the decoder or when applying it;
986
1013
  * application options override creation options.
1014
+ * Schema mismatches are represented by a `Failure` cause containing
1015
+ * `SchemaError`.
1016
+ *
1017
+ * **Gotchas**
1018
+ *
1019
+ * Schema issue fail reasons are wrapped as `SchemaError`. Defects,
1020
+ * interruptions, and other non-schema reasons remain in the returned `Cause`,
1021
+ * including when they are mixed with schema issues.
987
1022
  *
988
1023
  * @see {@link SchemaParser.decodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
989
1024
  *
@@ -993,7 +1028,7 @@ export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S,
993
1028
  export declare const decodeExit: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
994
1029
  /**
995
1030
  * Decodes an `unknown` input against a schema, returning an `Option` that is
996
- * `Some` with the decoded value on success or `None` on failure.
1031
+ * `Some` with the decoded value on success or `None` for schema mismatches.
997
1032
  *
998
1033
  * **When to use**
999
1034
  *
@@ -1008,6 +1043,12 @@ export declare const decodeExit: <S extends Decoder<unknown>>(schema: S, options
1008
1043
  * Options may be provided either when creating the decoder or when applying it;
1009
1044
  * application options override creation options.
1010
1045
  *
1046
+ * **Gotchas**
1047
+ *
1048
+ * Only causes made entirely of schema issues are converted to `None`. Causes
1049
+ * that contain defects, interruptions, or other non-schema reasons throw
1050
+ * instead.
1051
+ *
1011
1052
  * @category decoding
1012
1053
  * @since 3.10.0
1013
1054
  */
@@ -1015,7 +1056,7 @@ export declare const decodeUnknownOption: <S extends Decoder<unknown>>(schema: S
1015
1056
  /**
1016
1057
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1017
1058
  * returning an `Option` that is `Some` with the decoded value on success or
1018
- * `None` on failure.
1059
+ * `None` for schema mismatches.
1019
1060
  *
1020
1061
  * **When to use**
1021
1062
  *
@@ -1028,18 +1069,25 @@ export declare const decodeUnknownOption: <S extends Decoder<unknown>>(schema: S
1028
1069
  * Options may be provided either when creating the decoder or when applying it;
1029
1070
  * application options override creation options.
1030
1071
  *
1072
+ * **Gotchas**
1073
+ *
1074
+ * Only causes made entirely of schema issues are converted to `None`. Causes
1075
+ * that contain defects, interruptions, or other non-schema reasons throw
1076
+ * instead.
1077
+ *
1031
1078
  * @category decoding
1032
1079
  * @since 3.10.0
1033
1080
  */
1034
1081
  export declare const decodeOption: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
1035
1082
  /**
1036
1083
  * Decodes an `unknown` input against a schema, returning a `Result` that
1037
- * succeeds with the decoded value or fails with a {@link SchemaError}.
1084
+ * succeeds with the decoded value or fails with a {@link SchemaError} for schema
1085
+ * mismatches.
1038
1086
  *
1039
1087
  * **When to use**
1040
1088
  *
1041
- * Use when you do not know the input type statically and want decoding to
1042
- * return a `Result` with `SchemaError` failure data.
1089
+ * Use when you do not know the input type statically and want schema mismatches
1090
+ * returned as `Result.fail` with `SchemaError`.
1043
1091
  *
1044
1092
  * **Details**
1045
1093
  *
@@ -1047,6 +1095,13 @@ export declare const decodeOption: <S extends Decoder<unknown>>(schema: S, optio
1047
1095
  * {@link decodeResult}.
1048
1096
  * Options may be provided either when creating the decoder or when applying it;
1049
1097
  * application options override creation options.
1098
+ * Schema mismatches are returned as `Result.fail` with `SchemaError`.
1099
+ *
1100
+ * **Gotchas**
1101
+ *
1102
+ * Only causes made entirely of schema issues are returned as `Result.fail`.
1103
+ * Causes that contain defects, interruptions, or other non-schema reasons throw
1104
+ * instead.
1050
1105
  *
1051
1106
  * @see {@link SchemaParser.decodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
1052
1107
  *
@@ -1057,18 +1112,25 @@ export declare function decodeUnknownResult<S extends Decoder<unknown>>(schema:
1057
1112
  /**
1058
1113
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1059
1114
  * returning a `Result` that succeeds with the decoded value or fails with a
1060
- * {@link SchemaError}.
1115
+ * {@link SchemaError} for schema mismatches.
1061
1116
  *
1062
1117
  * **When to use**
1063
1118
  *
1064
- * Use when you already have input typed as the schema's `Encoded` type and
1065
- * want decoding to return a `Result` with `SchemaError` failure data.
1119
+ * Use when you already have input typed as the schema's `Encoded` type and want
1120
+ * schema mismatches returned as `Result.fail` with `SchemaError`.
1066
1121
  *
1067
1122
  * **Details**
1068
1123
  *
1069
1124
  * For `unknown` input use {@link decodeUnknownResult}.
1070
1125
  * Options may be provided either when creating the decoder or when applying it;
1071
1126
  * application options override creation options.
1127
+ * Schema mismatches are returned as `Result.fail` with `SchemaError`.
1128
+ *
1129
+ * **Gotchas**
1130
+ *
1131
+ * Only causes made entirely of schema issues are returned as `Result.fail`.
1132
+ * Causes that contain defects, interruptions, or other non-schema reasons throw
1133
+ * instead.
1072
1134
  *
1073
1135
  * @see {@link SchemaParser.decodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
1074
1136
  *
@@ -1078,12 +1140,13 @@ export declare function decodeUnknownResult<S extends Decoder<unknown>>(schema:
1078
1140
  export declare const decodeResult: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
1079
1141
  /**
1080
1142
  * Decodes an `unknown` input against a schema, returning a `Promise` that
1081
- * resolves with the decoded value or rejects with a {@link SchemaError}.
1143
+ * resolves with the decoded value or rejects with a {@link SchemaError} for
1144
+ * schema mismatches.
1082
1145
  *
1083
1146
  * **When to use**
1084
1147
  *
1085
1148
  * Use when you need decoding of unknown input to return a JavaScript `Promise`
1086
- * that rejects with `SchemaError`.
1149
+ * that rejects with `SchemaError` for schema mismatches.
1087
1150
  *
1088
1151
  * **Details**
1089
1152
  *
@@ -1092,7 +1155,12 @@ export declare const decodeResult: <S extends Decoder<unknown>>(schema: S, optio
1092
1155
  * Options may be provided either when creating the decoder or when applying it;
1093
1156
  * application options override creation options.
1094
1157
  *
1095
- * @see {@link SchemaParser.decodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1158
+ * **Gotchas**
1159
+ *
1160
+ * Non-schema failures may reject with a runtime failure instead of
1161
+ * `SchemaError`.
1162
+ *
1163
+ * @see {@link SchemaParser.decodeUnknownPromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`
1096
1164
  *
1097
1165
  * @category decoding
1098
1166
  * @since 3.10.0
@@ -1101,13 +1169,13 @@ export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema:
1101
1169
  /**
1102
1170
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1103
1171
  * returning a `Promise` that resolves with the decoded value or rejects with a
1104
- * {@link SchemaError}.
1172
+ * {@link SchemaError} for schema mismatches.
1105
1173
  *
1106
1174
  * **When to use**
1107
1175
  *
1108
1176
  * Use when you already have input typed as the schema's `Encoded` type and
1109
1177
  * need decoding to return a JavaScript `Promise` that rejects with
1110
- * `SchemaError`.
1178
+ * `SchemaError` for schema mismatches.
1111
1179
  *
1112
1180
  * **Details**
1113
1181
  *
@@ -1115,7 +1183,12 @@ export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema:
1115
1183
  * Options may be provided either when creating the decoder or when applying it;
1116
1184
  * application options override creation options.
1117
1185
  *
1118
- * @see {@link SchemaParser.decodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1186
+ * **Gotchas**
1187
+ *
1188
+ * Non-schema failures may reject with a runtime failure instead of
1189
+ * `SchemaError`.
1190
+ *
1191
+ * @see {@link SchemaParser.decodePromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`
1119
1192
  *
1120
1193
  * @category decoding
1121
1194
  * @since 3.10.0
@@ -1123,7 +1196,7 @@ export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema:
1123
1196
  export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
1124
1197
  /**
1125
1198
  * Decodes an `unknown` input against a schema synchronously, returning the
1126
- * decoded value or throwing a {@link SchemaError}.
1199
+ * decoded value or throwing a {@link SchemaError} for schema mismatches.
1127
1200
  *
1128
1201
  * **When to use**
1129
1202
  *
@@ -1133,10 +1206,15 @@ export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, opti
1133
1206
  * **Details**
1134
1207
  *
1135
1208
  * For input already typed as the schema's `Encoded` type use `decodeSync`.
1136
- * Only service-free schemas can be decoded synchronously. For non-throwing
1137
- * alternatives see `decodeUnknownOption`, `decodeUnknownExit`, or
1138
- * `decodeUnknownEffect`. Options may be provided either when creating the
1139
- * decoder or when applying it; application options override creation options.
1209
+ * Only service-free schemas can be decoded synchronously. For alternatives that
1210
+ * do not throw on schema mismatches, see `decodeUnknownOption`,
1211
+ * `decodeUnknownExit`, or `decodeUnknownEffect`. Options may be provided either
1212
+ * when creating the decoder or when applying it; application options override
1213
+ * creation options.
1214
+ *
1215
+ * **Gotchas**
1216
+ *
1217
+ * Non-schema failures may throw a runtime failure instead of `SchemaError`.
1140
1218
  *
1141
1219
  * **Example** (Decoding with a transformation schema)
1142
1220
  *
@@ -1163,7 +1241,8 @@ export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, opti
1163
1241
  export declare function decodeUnknownSync<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"];
1164
1242
  /**
1165
1243
  * Decodes a typed input (the schema's `Encoded` type) against a schema
1166
- * synchronously, returning the decoded value or throwing a {@link SchemaError}.
1244
+ * synchronously, returning the decoded value or throwing a {@link SchemaError}
1245
+ * for schema mismatches.
1167
1246
  *
1168
1247
  * **When to use**
1169
1248
  *
@@ -1177,6 +1256,10 @@ export declare function decodeUnknownSync<S extends Decoder<unknown>>(schema: S,
1177
1256
  * provided either when creating the decoder or when applying it; application
1178
1257
  * options override creation options.
1179
1258
  *
1259
+ * **Gotchas**
1260
+ *
1261
+ * Non-schema failures may throw a runtime failure instead of `SchemaError`.
1262
+ *
1180
1263
  * @see {@link SchemaParser.decodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1181
1264
  *
1182
1265
  * @category decoding
@@ -1240,13 +1323,12 @@ export declare function encodeUnknownEffect<S extends Top>(schema: S, options?:
1240
1323
  export declare const encodeEffect: <S extends Top>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
1241
1324
  /**
1242
1325
  * Encodes an `unknown` input against a schema synchronously, returning an
1243
- * `Exit` that is either a `Success` with the encoded value or a `Failure` with
1244
- * a {@link SchemaError}.
1326
+ * `Exit` that is either a `Success` with the encoded value or a `Failure`.
1245
1327
  *
1246
1328
  * **When to use**
1247
1329
  *
1248
- * Use when you need to encode unknown input into an `Exit` whose failure
1249
- * contains `SchemaError`.
1330
+ * Use when you need to encode unknown input into an `Exit` and capture schema
1331
+ * mismatches as `SchemaError`.
1250
1332
  *
1251
1333
  * **Details**
1252
1334
  *
@@ -1254,6 +1336,14 @@ export declare const encodeEffect: <S extends Top>(schema: S, options?: SchemaAS
1254
1336
  * {@link encodeExit} when the value is already typed as the schema's `Type`.
1255
1337
  * Options may be provided either when creating the encoder or when applying it;
1256
1338
  * application options override creation options.
1339
+ * Schema mismatches are represented by a `Failure` cause containing
1340
+ * `SchemaError`.
1341
+ *
1342
+ * **Gotchas**
1343
+ *
1344
+ * Schema issue fail reasons are wrapped as `SchemaError`. Defects,
1345
+ * interruptions, and other non-schema reasons remain in the returned `Cause`,
1346
+ * including when they are mixed with schema issues.
1257
1347
  *
1258
1348
  * @see {@link SchemaParser.encodeUnknownExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1259
1349
  *
@@ -1264,12 +1354,12 @@ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S,
1264
1354
  /**
1265
1355
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1266
1356
  * returning an `Exit` that is either a `Success` with the encoded value or a
1267
- * `Failure` with a {@link SchemaError}.
1357
+ * `Failure`.
1268
1358
  *
1269
1359
  * **When to use**
1270
1360
  *
1271
- * Use when you need to encode already typed schema values into an `Exit` whose
1272
- * failure contains `SchemaError`.
1361
+ * Use when you need to encode already typed schema values into an `Exit` and
1362
+ * capture schema mismatches as `SchemaError`.
1273
1363
  *
1274
1364
  * **Details**
1275
1365
  *
@@ -1277,6 +1367,14 @@ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S,
1277
1367
  * `unknown` input use {@link encodeUnknownExit}.
1278
1368
  * Options may be provided either when creating the encoder or when applying it;
1279
1369
  * application options override creation options.
1370
+ * Schema mismatches are represented by a `Failure` cause containing
1371
+ * `SchemaError`.
1372
+ *
1373
+ * **Gotchas**
1374
+ *
1375
+ * Schema issue fail reasons are wrapped as `SchemaError`. Defects,
1376
+ * interruptions, and other non-schema reasons remain in the returned `Cause`,
1377
+ * including when they are mixed with schema issues.
1280
1378
  *
1281
1379
  * @see {@link SchemaParser.encodeExit} for the adapter whose failure contains `SchemaIssue.Issue` directly
1282
1380
  *
@@ -1286,7 +1384,7 @@ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S,
1286
1384
  export declare const encodeExit: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1287
1385
  /**
1288
1386
  * Encodes an `unknown` input against a schema, returning an `Option` that is
1289
- * `Some` with the encoded value on success or `None` on failure.
1387
+ * `Some` with the encoded value on success or `None` for schema mismatches.
1290
1388
  *
1291
1389
  * **When to use**
1292
1390
  *
@@ -1301,14 +1399,20 @@ export declare const encodeExit: <S extends Encoder<unknown>>(schema: S, options
1301
1399
  * Options may be provided either when creating the encoder or when applying it;
1302
1400
  * application options override creation options.
1303
1401
  *
1402
+ * **Gotchas**
1403
+ *
1404
+ * Only causes made entirely of schema issues are converted to `None`. Causes
1405
+ * that contain defects, interruptions, or other non-schema reasons throw
1406
+ * instead.
1407
+ *
1304
1408
  * @category encoding
1305
1409
  * @since 3.10.0
1306
1410
  */
1307
1411
  export declare const encodeUnknownOption: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1308
1412
  /**
1309
1413
  * Encodes a typed input (the schema's `Type`) against a schema, returning an
1310
- * `Option` that is `Some` with the encoded value on success or `None` on
1311
- * failure.
1414
+ * `Option` that is `Some` with the encoded value on success or `None` for schema
1415
+ * mismatches.
1312
1416
  *
1313
1417
  * **When to use**
1314
1418
  *
@@ -1321,24 +1425,38 @@ export declare const encodeUnknownOption: <S extends Encoder<unknown>>(schema: S
1321
1425
  * Options may be provided either when creating the encoder or when applying it;
1322
1426
  * application options override creation options.
1323
1427
  *
1428
+ * **Gotchas**
1429
+ *
1430
+ * Only causes made entirely of schema issues are converted to `None`. Causes
1431
+ * that contain defects, interruptions, or other non-schema reasons throw
1432
+ * instead.
1433
+ *
1324
1434
  * @category encoding
1325
1435
  * @since 3.10.0
1326
1436
  */
1327
1437
  export declare const encodeOption: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1328
1438
  /**
1329
1439
  * Encodes an `unknown` input against a schema, returning a `Result` that
1330
- * succeeds with the encoded value or fails with a {@link SchemaError}.
1440
+ * succeeds with the encoded value or fails with a {@link SchemaError} for schema
1441
+ * mismatches.
1331
1442
  *
1332
1443
  * **When to use**
1333
1444
  *
1334
- * Use when you do not know the input type statically and want encoding to
1335
- * return a `Result` with `SchemaError` failure data.
1445
+ * Use when you do not know the input type statically and want schema mismatches
1446
+ * returned as `Result.fail` with `SchemaError`.
1336
1447
  *
1337
1448
  * **Details**
1338
1449
  *
1339
1450
  * For values already typed as the schema's `Type` use {@link encodeResult}.
1340
1451
  * Options may be provided either when creating the encoder or when applying it;
1341
1452
  * application options override creation options.
1453
+ * Schema mismatches are returned as `Result.fail` with `SchemaError`.
1454
+ *
1455
+ * **Gotchas**
1456
+ *
1457
+ * Only causes made entirely of schema issues are returned as `Result.fail`.
1458
+ * Causes that contain defects, interruptions, or other non-schema reasons throw
1459
+ * instead.
1342
1460
  *
1343
1461
  * @see {@link SchemaParser.encodeUnknownResult} for the adapter that fails with `SchemaIssue.Issue` directly
1344
1462
  *
@@ -1349,18 +1467,25 @@ export declare function encodeUnknownResult<S extends Encoder<unknown>>(schema:
1349
1467
  /**
1350
1468
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1351
1469
  * `Result` that succeeds with the encoded value or fails with a
1352
- * {@link SchemaError}.
1470
+ * {@link SchemaError} for schema mismatches.
1353
1471
  *
1354
1472
  * **When to use**
1355
1473
  *
1356
- * Use when you already have a value typed as the schema's `Type` and want
1357
- * encoding to return a `Result` with `SchemaError` failure data.
1474
+ * Use when you already have a value typed as the schema's `Type` and want schema
1475
+ * mismatches returned as `Result.fail` with `SchemaError`.
1358
1476
  *
1359
1477
  * **Details**
1360
1478
  *
1361
1479
  * For `unknown` input use {@link encodeUnknownResult}.
1362
1480
  * Options may be provided either when creating the encoder or when applying it;
1363
1481
  * application options override creation options.
1482
+ * Schema mismatches are returned as `Result.fail` with `SchemaError`.
1483
+ *
1484
+ * **Gotchas**
1485
+ *
1486
+ * Only causes made entirely of schema issues are returned as `Result.fail`.
1487
+ * Causes that contain defects, interruptions, or other non-schema reasons throw
1488
+ * instead.
1364
1489
  *
1365
1490
  * @see {@link SchemaParser.encodeResult} for the adapter that fails with `SchemaIssue.Issue` directly
1366
1491
  *
@@ -1370,12 +1495,13 @@ export declare function encodeUnknownResult<S extends Encoder<unknown>>(schema:
1370
1495
  export declare const encodeResult: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
1371
1496
  /**
1372
1497
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1373
- * resolves with the encoded value or rejects with a {@link SchemaError}.
1498
+ * resolves with the encoded value or rejects with a {@link SchemaError} for
1499
+ * schema mismatches.
1374
1500
  *
1375
1501
  * **When to use**
1376
1502
  *
1377
1503
  * Use when you need encoding of unknown input to return a JavaScript `Promise`
1378
- * that rejects with `SchemaError`.
1504
+ * that rejects with `SchemaError` for schema mismatches.
1379
1505
  *
1380
1506
  * **Details**
1381
1507
  *
@@ -1383,7 +1509,12 @@ export declare const encodeResult: <S extends Encoder<unknown>>(schema: S, optio
1383
1509
  * Options may be provided either when creating the encoder or when applying it;
1384
1510
  * application options override creation options.
1385
1511
  *
1386
- * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1512
+ * **Gotchas**
1513
+ *
1514
+ * Non-schema failures may reject with a runtime failure instead of
1515
+ * `SchemaError`.
1516
+ *
1517
+ * @see {@link SchemaParser.encodeUnknownPromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`
1387
1518
  *
1388
1519
  * @category encoding
1389
1520
  * @since 3.10.0
@@ -1392,12 +1523,13 @@ export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema:
1392
1523
  /**
1393
1524
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1394
1525
  * `Promise` that resolves with the encoded value or rejects with a
1395
- * {@link SchemaError}.
1526
+ * {@link SchemaError} for schema mismatches.
1396
1527
  *
1397
1528
  * **When to use**
1398
1529
  *
1399
1530
  * Use when you already have a value typed as the schema's `Type` and need
1400
- * encoding to return a JavaScript `Promise` that rejects with `SchemaError`.
1531
+ * encoding to return a JavaScript `Promise` that rejects with `SchemaError` for
1532
+ * schema mismatches.
1401
1533
  *
1402
1534
  * **Details**
1403
1535
  *
@@ -1405,7 +1537,12 @@ export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema:
1405
1537
  * Options may be provided either when creating the encoder or when applying it;
1406
1538
  * application options override creation options.
1407
1539
  *
1408
- * @see {@link SchemaParser.encodePromise} for the adapter that rejects with `SchemaIssue.Issue` directly
1540
+ * **Gotchas**
1541
+ *
1542
+ * Non-schema failures may reject with a runtime failure instead of
1543
+ * `SchemaError`.
1544
+ *
1545
+ * @see {@link SchemaParser.encodePromise} for the adapter that rejects with an `Error` whose cause is `SchemaIssue.Issue`
1409
1546
  *
1410
1547
  * @category encoding
1411
1548
  * @since 3.10.0
@@ -1413,7 +1550,7 @@ export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema:
1413
1550
  export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
1414
1551
  /**
1415
1552
  * Encodes an `unknown` input against a schema synchronously, throwing a
1416
- * {@link SchemaError} on failure.
1553
+ * {@link SchemaError} for schema mismatches.
1417
1554
  *
1418
1555
  * **When to use**
1419
1556
  *
@@ -1422,11 +1559,15 @@ export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, opti
1422
1559
  *
1423
1560
  * **Details**
1424
1561
  *
1425
- * For non-throwing alternatives see {@link encodeUnknownOption},
1426
- * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For values
1427
- * already typed as the schema's `Type` use {@link encodeSync}.
1428
- * Options may be provided either when creating the encoder or when applying it;
1429
- * application options override creation options.
1562
+ * For alternatives that do not throw on schema mismatches, see
1563
+ * {@link encodeUnknownOption}, {@link encodeUnknownExit}, or
1564
+ * {@link encodeUnknownEffect}. For values already typed as the schema's `Type`
1565
+ * use {@link encodeSync}. Options may be provided either when creating the
1566
+ * encoder or when applying it; application options override creation options.
1567
+ *
1568
+ * **Gotchas**
1569
+ *
1570
+ * Non-schema failures may throw a runtime failure instead of `SchemaError`.
1430
1571
  *
1431
1572
  * @see {@link SchemaParser.encodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1432
1573
  *
@@ -1436,7 +1577,7 @@ export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, opti
1436
1577
  export declare function encodeUnknownSync<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Encoded"];
1437
1578
  /**
1438
1579
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1439
- * throwing a {@link SchemaError} on failure.
1580
+ * throwing a {@link SchemaError} for schema mismatches.
1440
1581
  *
1441
1582
  * **When to use**
1442
1583
  *
@@ -1449,6 +1590,10 @@ export declare function encodeUnknownSync<S extends Encoder<unknown>>(schema: S,
1449
1590
  * Options may be provided either when creating the encoder or when applying it;
1450
1591
  * application options override creation options.
1451
1592
  *
1593
+ * **Gotchas**
1594
+ *
1595
+ * Non-schema failures may throw a runtime failure instead of `SchemaError`.
1596
+ *
1452
1597
  * @see {@link SchemaParser.encodeSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
1453
1598
  *
1454
1599
  * @category encoding
@@ -1581,7 +1726,7 @@ interface optionalLambda extends Lambda {
1581
1726
  * Use {@link optionalKey} instead if you want exact optional semantics (absent
1582
1727
  * only, not `undefined`).
1583
1728
  *
1584
- * **Example** (Optional field accepting undefined)
1729
+ * **Example** (Defining an optional field accepting undefined)
1585
1730
  *
1586
1731
  * ```ts
1587
1732
  * import { Schema } from "effect"
@@ -1718,7 +1863,7 @@ export interface flip<S extends Top> extends Bottom<S["Encoded"], S["Type"], S["
1718
1863
  *
1719
1864
  * Calling `flip` twice returns the original schema.
1720
1865
  *
1721
- * **Example** (Flip a number-from-string schema)
1866
+ * **Example** (Flipping a number-from-string schema)
1722
1867
  *
1723
1868
  * ```ts
1724
1869
  * import { Schema } from "effect"
@@ -1745,7 +1890,7 @@ export interface Literal<L extends SchemaAST.LiteralValue> extends Bottom<L, L,
1745
1890
  /**
1746
1891
  * Creates a schema for a single literal value (string, number, bigint, boolean, or null).
1747
1892
  *
1748
- * **Example** (String literal)
1893
+ * **Example** (Defining a string literal)
1749
1894
  *
1750
1895
  * ```ts
1751
1896
  * import { Schema } from "effect"
@@ -1831,7 +1976,7 @@ export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends Bo
1831
1976
  * Use when the decoded value should remain the matched string and you do not
1832
1977
  * need the individual template parts parsed into a tuple.
1833
1978
  *
1834
- * **Example** (URL path pattern)
1979
+ * **Example** (Defining a URL path pattern)
1835
1980
  *
1836
1981
  * ```ts
1837
1982
  * import { Schema } from "effect"
@@ -1889,7 +2034,7 @@ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> exte
1889
2034
  * Unlike {@link TemplateLiteral}, this schema decodes the matched string into a
1890
2035
  * readonly tuple with one element per schema part.
1891
2036
  *
1892
- * **Example** (Parse path parameters)
2037
+ * **Example** (Parsing path parameters)
1893
2038
  *
1894
2039
  * ```ts
1895
2040
  * import { Schema } from "effect"
@@ -1917,7 +2062,7 @@ export interface Enum<A extends {
1917
2062
  /**
1918
2063
  * Creates a schema from a TypeScript enum object. Validates that the input is one of the enum's values.
1919
2064
  *
1920
- * **Example** (Direction enum)
2065
+ * **Example** (Defining a direction enum)
1921
2066
  *
1922
2067
  * ```ts
1923
2068
  * import { Schema } from "effect"
@@ -2160,7 +2305,7 @@ export interface UniqueSymbol<sym extends symbol> extends Bottom<sym, sym, never
2160
2305
  /**
2161
2306
  * Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.
2162
2307
  *
2163
- * **Example** (Specific symbol)
2308
+ * **Example** (Defining a specific symbol)
2164
2309
  *
2165
2310
  * ```ts
2166
2311
  * import { Schema } from "effect"
@@ -2389,7 +2534,7 @@ export interface Struct<Fields extends Struct.Fields> extends Bottom<Struct.Type
2389
2534
  * The resulting schema's `Type` is a readonly object type with the fields'
2390
2535
  * decoded types. The `Encoded` form mirrors the field schemas' encoded types.
2391
2536
  *
2392
- * **Example** (Basic struct)
2537
+ * **Example** (Defining a basic struct)
2393
2538
  *
2394
2539
  * ```ts
2395
2540
  * import { Schema } from "effect"
@@ -2469,7 +2614,7 @@ export interface encodeKeys<S extends Top & {
2469
2614
  * If two existing fields would produce the same encoded key, construction
2470
2615
  * fails.
2471
2616
  *
2472
- * **Example** (Rename `name` to `full_name` in the encoded form)
2617
+ * **Example** (Renaming `name` to `full_name` in the encoded form)
2473
2618
  *
2474
2619
  * ```ts
2475
2620
  * import { Schema } from "effect"
@@ -2501,7 +2646,7 @@ export declare function encodeKeys<S extends Top & {
2501
2646
  * computed or enriched fields to live in the decoded type without appearing in
2502
2647
  * the encoded form.
2503
2648
  *
2504
- * **Example** (Add a computed `fullName` field)
2649
+ * **Example** (Adding a computed `fullName` field)
2505
2650
  *
2506
2651
  * ```ts
2507
2652
  * import { Option, Schema } from "effect"
@@ -2690,7 +2835,7 @@ export interface $Record<Key extends Record.Key, Value extends Top> extends Bott
2690
2835
  /**
2691
2836
  * Defines a record (dictionary) schema with typed keys and values.
2692
2837
  *
2693
- * **Example** (String-keyed record of numbers)
2838
+ * **Example** (Defining a string-keyed record of numbers)
2694
2839
  *
2695
2840
  * ```ts
2696
2841
  * import { Schema } from "effect"
@@ -2831,7 +2976,7 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
2831
2976
  * Extends a struct schema with one or more record (index-signature) schemas,
2832
2977
  * producing a schema whose decoded type intersects the struct and all records.
2833
2978
  *
2834
- * **Example** (Struct with string-indexed extra keys)
2979
+ * **Example** (Defining structs with string-indexed extra keys)
2835
2980
  *
2836
2981
  * ```ts
2837
2982
  * import { Schema } from "effect"
@@ -2984,7 +3129,7 @@ export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Typ
2984
3129
  /**
2985
3130
  * Defines a fixed-length tuple schema from an array of element schemas.
2986
3131
  *
2987
- * **Example** (Pair of string and number)
3132
+ * **Example** (Defining a pair of string and number)
2988
3133
  *
2989
3134
  * ```ts
2990
3135
  * import { Schema } from "effect"
@@ -3137,7 +3282,7 @@ export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends T
3137
3282
  * example, `[Schema.Boolean, Schema.String]` represents zero or more booleans
3138
3283
  * followed by a final string.
3139
3284
  *
3140
- * **Example** (Tuple with rest)
3285
+ * **Example** (Defining tuples with rest elements)
3141
3286
  *
3142
3287
  * ```ts
3143
3288
  * import { Schema } from "effect"
@@ -3179,7 +3324,7 @@ export {
3179
3324
  /**
3180
3325
  * Defines a `ReadonlyArray` schema for a given element schema.
3181
3326
  *
3182
- * **Example** (Array of strings)
3327
+ * **Example** (Defining an array of strings)
3183
3328
  *
3184
3329
  * ```ts
3185
3330
  * import { Schema } from "effect"
@@ -3212,7 +3357,7 @@ interface NonEmptyArrayLambda extends Lambda {
3212
3357
  * Defines a non-empty `ReadonlyArray` schema — at least one element required.
3213
3358
  * Type is `readonly [T, ...T[]]`.
3214
3359
  *
3215
- * **Example** (Non-empty array of numbers)
3360
+ * **Example** (Defining a non-empty array of numbers)
3216
3361
  *
3217
3362
  * ```ts
3218
3363
  * import { Schema } from "effect"
@@ -3306,7 +3451,7 @@ interface mutableLambda extends Lambda {
3306
3451
  /**
3307
3452
  * Makes an array or tuple schema mutable, removing the `readonly` modifier.
3308
3453
  *
3309
- * **Example** (Mutable array)
3454
+ * **Example** (Defining mutable arrays)
3310
3455
  *
3311
3456
  * ```ts
3312
3457
  * import { Schema } from "effect"
@@ -3373,7 +3518,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
3373
3518
  * - `"anyOf"` (default) — matches if any member matches.
3374
3519
  * - `"oneOf"` — matches if exactly one member matches.
3375
3520
  *
3376
- * **Example** (String or number union)
3521
+ * **Example** (Defining a string or number union)
3377
3522
  *
3378
3523
  * ```ts
3379
3524
  * import { Schema } from "effect"
@@ -3415,7 +3560,7 @@ export interface Literals<L extends ReadonlyArray<SchemaAST.LiteralValue>> exten
3415
3560
  /**
3416
3561
  * Creates a union schema from an array of literal values.
3417
3562
  *
3418
- * **Example** (Status codes)
3563
+ * **Example** (Defining status codes)
3419
3564
  *
3420
3565
  * ```ts
3421
3566
  * import { Schema } from "effect"
@@ -3502,7 +3647,7 @@ export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"],
3502
3647
  * essential for creating recursive schemas where a schema references itself,
3503
3648
  * preventing infinite recursion during schema definition.
3504
3649
  *
3505
- * **Example** (Recursive tree schema)
3650
+ * **Example** (Defining recursive tree schemas)
3506
3651
  *
3507
3652
  * ```ts
3508
3653
  * import { Schema } from "effect"
@@ -3798,7 +3943,7 @@ export interface compose<To extends Top, From extends Top> extends decodeTo<To,
3798
3943
  * and is used on the encoding path, while `encode` maps `To["Encoded"]` to
3799
3944
  * `From["Type"]` and is used on the decoding path.
3800
3945
  *
3801
- * **Example** (String to Number with transformation)
3946
+ * **Example** (Transforming strings to numbers with a schema transformation)
3802
3947
  *
3803
3948
  * ```ts
3804
3949
  * import { Schema, SchemaGetter } from "effect"
@@ -3885,7 +4030,7 @@ export declare function decode<S extends Top, RD = never, RE = never>(transforma
3885
4030
  * `encodeTo(to)(from)` is equivalent to `to.pipe(decodeTo(from))`. The `from`
3886
4031
  * schema acts as the target decoded schema and `to` acts as the encoded source.
3887
4032
  *
3888
- * **Example** (Encode a number back to string)
4033
+ * **Example** (Encoding a number back to a string)
3889
4034
  *
3890
4035
  * ```ts
3891
4036
  * import { Schema, SchemaGetter } from "effect"
@@ -3965,7 +4110,7 @@ export interface withConstructorDefault<S extends Top & WithoutConstructorDefaul
3965
4110
  * Constructor defaults are applied only during `make*`, not during decoding or
3966
4111
  * encoding.
3967
4112
  *
3968
- * **Example** (Optional field with a static default)
4113
+ * **Example** (Defining an optional field with a static default)
3969
4114
  *
3970
4115
  * ```ts
3971
4116
  * import { Effect, Schema } from "effect"
@@ -4025,7 +4170,7 @@ export type DecodingDefaultOptions = {
4025
4170
  * - `"passthrough"` (default): include the value in the encoded output.
4026
4171
  * - `"omit"`: omit the key from the encoded output.
4027
4172
  *
4028
- * **Example** (Default for a missing struct key)
4173
+ * **Example** (Providing a default for a missing struct key)
4029
4174
  *
4030
4175
  * ```ts
4031
4176
  * import { Effect, Schema } from "effect"
@@ -4106,7 +4251,7 @@ export interface withDecodingDefault<S extends Top, R = never> extends decodeTo<
4106
4251
  * - `"passthrough"` (default): include the value in the encoded output.
4107
4252
  * - `"omit"`: omit the key from the encoded output.
4108
4253
  *
4109
- * **Example** (Default for an optional field value)
4254
+ * **Example** (Providing a default for an optional field value)
4110
4255
  *
4111
4256
  * ```ts
4112
4257
  * import { Effect, Schema } from "effect"
@@ -4175,7 +4320,7 @@ export interface tag<Tag extends SchemaAST.LiteralValue> extends withConstructor
4175
4320
  * for discriminator fields in tagged unions. When constructing via `make`, the
4176
4321
  * `_tag` field can be omitted and will be filled automatically.
4177
4322
  *
4178
- * **Example** (Discriminated union tag)
4323
+ * **Example** (Defining a discriminated union tag)
4179
4324
  *
4180
4325
  * ```ts
4181
4326
  * import { Schema } from "effect"
@@ -4206,7 +4351,7 @@ export declare function tag<Tag extends SchemaAST.LiteralValue>(literal: Tag): t
4206
4351
  * The tag is filled during decoding and construction, like {@link tag}, but is
4207
4352
  * omitted when encoding.
4208
4353
  *
4209
- * **Example** (Tag omitted during encoding)
4354
+ * **Example** (Omitting tags during encoding)
4210
4355
  *
4211
4356
  * ```ts
4212
4357
  * import { Schema } from "effect"
@@ -4248,7 +4393,7 @@ export type TaggedStruct<Tag extends SchemaAST.LiteralValue, Fields extends Stru
4248
4393
  * added automatically. However, when decoding or encoding, the `_tag` field
4249
4394
  * must be present in the input.
4250
4395
  *
4251
- * **Example** (Tagged struct as a shorthand for a struct with a `_tag` field)
4396
+ * **Example** (Defining a tagged struct shorthand)
4252
4397
  *
4253
4398
  * ```ts
4254
4399
  * import { Schema } from "effect"
@@ -4389,7 +4534,7 @@ export interface TaggedUnion<Cases extends Record<string, Top>> extends Bottom<{
4389
4534
  * Each key becomes the `_tag` literal and the value is passed to {@link TaggedStruct}.
4390
4535
  * The result includes `cases`, `guards`, `isAnyOf`, and `match` utilities.
4391
4536
  *
4392
- * **Example** (Discriminated union with pattern matching)
4537
+ * **Example** (Pattern matching a discriminated union)
4393
4538
  *
4394
4539
  * ```ts
4395
4540
  * import { Schema } from "effect"
@@ -4427,7 +4572,7 @@ export interface Opaque<Self, S extends Top, Brand> extends Bottom<Self, S["Enco
4427
4572
  * Useful for creating opaque types that are structurally identical to a base struct
4428
4573
  * but type-incompatible with it.
4429
4574
  *
4430
- * **Example** (Opaque struct)
4575
+ * **Example** (Defining opaque structs)
4431
4576
  *
4432
4577
  * ```ts
4433
4578
  * import { Schema } from "effect"
@@ -4460,7 +4605,7 @@ export interface instanceOf<T, Iso = T> extends declare<T, Iso> {
4460
4605
  * Creates a schema that validates values using `instanceof`.
4461
4606
  * Decoding and encoding pass the value through unchanged.
4462
4607
  *
4463
- * **Example** (Schema for a built-in class)
4608
+ * **Example** (Defining a schema for a built-in class)
4464
4609
  *
4465
4610
  * ```ts
4466
4611
  * import { Schema } from "effect"
@@ -4500,7 +4645,7 @@ export declare function link<T>(): <To extends Top>(encodeTo: To, transformation
4500
4645
  * When `abort` is `true`, parsing stops after this filter fails instead of
4501
4646
  * collecting later check failures.
4502
4647
  *
4503
- * **Example** (Failure at a nested path)
4648
+ * **Example** (Reporting failure at a nested path)
4504
4649
  *
4505
4650
  * ```ts
4506
4651
  * import { Schema } from "effect"
@@ -5442,7 +5587,7 @@ export declare const isBetweenBigDecimal: (options: {
5442
5587
  * constraint to ensure generated strings or arrays have at least the required
5443
5588
  * length.
5444
5589
  *
5445
- * **Example** (Minimum length check)
5590
+ * **Example** (Checking minimum length)
5446
5591
  *
5447
5592
  * ```ts
5448
5593
  * import { Schema } from "effect"
@@ -6476,7 +6621,7 @@ export interface Date extends instanceOf<globalThis.Date> {
6476
6621
  * JSON serializer encodes valid dates as ISO 8601 strings; invalid dates encode
6477
6622
  * as `"Invalid Date"`.
6478
6623
  *
6479
- * **Example** (Date schema)
6624
+ * **Example** (Defining a Date schema)
6480
6625
  *
6481
6626
  * ```ts
6482
6627
  * import { Schema } from "effect"
@@ -6566,7 +6711,7 @@ export interface Duration extends declare<Duration_.Duration> {
6566
6711
  * The default JSON serializer encodes `Duration` as a tagged object with the
6567
6712
  * duration type and value.
6568
6713
  *
6569
- * **Example** (Duration schema)
6714
+ * **Example** (Defining a Duration schema)
6570
6715
  *
6571
6716
  * ```ts
6572
6717
  * import { Duration, Schema } from "effect"
@@ -6928,7 +7073,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
6928
7073
  * // Success({"a":"1"})
6929
7074
  * ```
6930
7075
  *
6931
- * **Example** (Nested fields)
7076
+ * **Example** (Decoding nested fields)
6932
7077
  *
6933
7078
  * ```ts
6934
7079
  * import { Schema } from "effect"
@@ -7043,7 +7188,7 @@ export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearc
7043
7188
  * // Success({"a":"1"})
7044
7189
  * ```
7045
7190
  *
7046
- * **Example** (Nested fields)
7191
+ * **Example** (Decoding nested fields)
7047
7192
  *
7048
7193
  * ```ts
7049
7194
  * import { Schema } from "effect"
@@ -7851,7 +7996,7 @@ type MissingSelfGeneric<Usage extends string> = `Missing \`Self\` generic - use
7851
7996
  *
7852
7997
  * Passing `disableChecks` in the options skips constructor validation.
7853
7998
  *
7854
- * **Example** (Basic class)
7999
+ * **Example** (Defining a basic class)
7855
8000
  *
7856
8001
  * ```ts
7857
8002
  * import { Schema } from "effect"
@@ -7911,7 +8056,7 @@ export declare const Class: {
7911
8056
  *
7912
8057
  * Passing `disableChecks` in the options skips constructor validation.
7913
8058
  *
7914
- * **Example** (Basic class)
8059
+ * **Example** (Defining a basic class)
7915
8060
  *
7916
8061
  * ```ts
7917
8062
  * import { Schema } from "effect"
@@ -7971,7 +8116,7 @@ export declare const Class: {
7971
8116
  *
7972
8117
  * Passing `disableChecks` in the options skips constructor validation.
7973
8118
  *
7974
- * **Example** (Basic class)
8119
+ * **Example** (Defining a basic class)
7975
8120
  *
7976
8121
  * ```ts
7977
8122
  * import { Schema } from "effect"
@@ -8031,7 +8176,7 @@ export declare const Class: {
8031
8176
  *
8032
8177
  * Passing `disableChecks` in the options skips constructor validation.
8033
8178
  *
8034
- * **Example** (Basic class)
8179
+ * **Example** (Defining a basic class)
8035
8180
  *
8036
8181
  * ```ts
8037
8182
  * import { Schema } from "effect"
@@ -8087,7 +8232,7 @@ export declare const Class: {
8087
8232
  * The optional `identifier` parameter overrides the schema identifier;
8088
8233
  * it defaults to the `tag` value.
8089
8234
  *
8090
- * **Example** (Tagged class)
8235
+ * **Example** (Defining a tagged class)
8091
8236
  *
8092
8237
  * ```ts
8093
8238
  * import { Schema } from "effect"
@@ -8118,7 +8263,7 @@ export declare const TaggedClass: {
8118
8263
  * The optional `identifier` parameter overrides the schema identifier;
8119
8264
  * it defaults to the `tag` value.
8120
8265
  *
8121
- * **Example** (Tagged class)
8266
+ * **Example** (Defining a tagged class)
8122
8267
  *
8123
8268
  * ```ts
8124
8269
  * import { Schema } from "effect"
@@ -8149,7 +8294,7 @@ export declare const TaggedClass: {
8149
8294
  * The optional `identifier` parameter overrides the schema identifier;
8150
8295
  * it defaults to the `tag` value.
8151
8296
  *
8152
- * **Example** (Tagged class)
8297
+ * **Example** (Defining a tagged class)
8153
8298
  *
8154
8299
  * ```ts
8155
8300
  * import { Schema } from "effect"
@@ -8180,7 +8325,7 @@ export declare const TaggedClass: {
8180
8325
  * The optional `identifier` parameter overrides the schema identifier;
8181
8326
  * it defaults to the `tag` value.
8182
8327
  *
8183
- * **Example** (Tagged class)
8328
+ * **Example** (Defining a tagged class)
8184
8329
  *
8185
8330
  * ```ts
8186
8331
  * import { Schema } from "effect"
@@ -8311,7 +8456,7 @@ export declare const ErrorClass: {
8311
8456
  * Use to define typed errors that are schema validated, yielded in `Effect.gen`,
8312
8457
  * and matched as tagged union members.
8313
8458
  *
8314
- * **Example** (Tagged error class)
8459
+ * **Example** (Defining a tagged error class)
8315
8460
  *
8316
8461
  * ```ts
8317
8462
  * import { Effect, Schema } from "effect"
@@ -8338,7 +8483,7 @@ export declare const TaggedErrorClass: {
8338
8483
  * Use to define typed errors that are schema validated, yielded in `Effect.gen`,
8339
8484
  * and matched as tagged union members.
8340
8485
  *
8341
- * **Example** (Tagged error class)
8486
+ * **Example** (Defining a tagged error class)
8342
8487
  *
8343
8488
  * ```ts
8344
8489
  * import { Effect, Schema } from "effect"
@@ -8365,7 +8510,7 @@ export declare const TaggedErrorClass: {
8365
8510
  * Use to define typed errors that are schema validated, yielded in `Effect.gen`,
8366
8511
  * and matched as tagged union members.
8367
8512
  *
8368
- * **Example** (Tagged error class)
8513
+ * **Example** (Defining a tagged error class)
8369
8514
  *
8370
8515
  * ```ts
8371
8516
  * import { Effect, Schema } from "effect"
@@ -8392,7 +8537,7 @@ export declare const TaggedErrorClass: {
8392
8537
  * Use to define typed errors that are schema validated, yielded in `Effect.gen`,
8393
8538
  * and matched as tagged union members.
8394
8539
  *
8395
- * **Example** (Tagged error class)
8540
+ * **Example** (Defining a tagged error class)
8396
8541
  *
8397
8542
  * ```ts
8398
8543
  * import { Effect, Schema } from "effect"
@@ -8520,7 +8665,7 @@ export declare function overrideToEquivalence<S extends Top>(toEquivalence: () =
8520
8665
  * every field (and nested field) compares equal according to the schema
8521
8666
  * structure.
8522
8667
  *
8523
- * **Example** (Struct equivalence)
8668
+ * **Example** (Comparing structs)
8524
8669
  *
8525
8670
  * ```ts
8526
8671
  * import { Schema } from "effect"