effect 4.0.0-beta.85 → 4.0.0-beta.87

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 (263) hide show
  1. package/dist/ChannelSchema.d.ts +8 -8
  2. package/dist/ChannelSchema.d.ts.map +1 -1
  3. package/dist/Config.d.ts +2 -2
  4. package/dist/Config.d.ts.map +1 -1
  5. package/dist/Config.js +10 -3
  6. package/dist/Config.js.map +1 -1
  7. package/dist/Cron.d.ts.map +1 -1
  8. package/dist/Cron.js +4 -0
  9. package/dist/Cron.js.map +1 -1
  10. package/dist/Schema.d.ts +749 -393
  11. package/dist/Schema.d.ts.map +1 -1
  12. package/dist/Schema.js +95 -65
  13. package/dist/Schema.js.map +1 -1
  14. package/dist/SchemaAST.d.ts.map +1 -1
  15. package/dist/SchemaAST.js +20 -29
  16. package/dist/SchemaAST.js.map +1 -1
  17. package/dist/SchemaParser.d.ts +24 -24
  18. package/dist/SchemaParser.d.ts.map +1 -1
  19. package/dist/SchemaParser.js +43 -39
  20. package/dist/SchemaParser.js.map +1 -1
  21. package/dist/SchemaRepresentation.d.ts +300 -300
  22. package/dist/SchemaTransformation.d.ts +2 -2
  23. package/dist/SchemaTransformation.d.ts.map +1 -1
  24. package/dist/SchemaTransformation.js +5 -8
  25. package/dist/SchemaTransformation.js.map +1 -1
  26. package/dist/internal/effect.js +6 -7
  27. package/dist/internal/effect.js.map +1 -1
  28. package/dist/internal/matcher.js +0 -2
  29. package/dist/internal/matcher.js.map +1 -1
  30. package/dist/internal/schema/representation.js +1 -5
  31. package/dist/internal/schema/representation.js.map +1 -1
  32. package/dist/internal/schema/schema.js.map +1 -1
  33. package/dist/testing/TestSchema.d.ts +9 -9
  34. package/dist/testing/TestSchema.d.ts.map +1 -1
  35. package/dist/testing/TestSchema.js +3 -2
  36. package/dist/testing/TestSchema.js.map +1 -1
  37. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +2 -2
  38. package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
  39. package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
  40. package/dist/unstable/ai/Chat.d.ts +1 -1
  41. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  42. package/dist/unstable/ai/LanguageModel.d.ts +4 -4
  43. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  44. package/dist/unstable/ai/McpSchema.d.ts +13 -6
  45. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  46. package/dist/unstable/ai/McpSchema.js.map +1 -1
  47. package/dist/unstable/ai/McpServer.d.ts +4 -4
  48. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  49. package/dist/unstable/ai/McpServer.js.map +1 -1
  50. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +2 -2
  51. package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
  52. package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
  53. package/dist/unstable/ai/Response.d.ts +2 -2
  54. package/dist/unstable/ai/Response.d.ts.map +1 -1
  55. package/dist/unstable/ai/Response.js.map +1 -1
  56. package/dist/unstable/ai/Tool.d.ts +26 -26
  57. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  58. package/dist/unstable/ai/Tool.js.map +1 -1
  59. package/dist/unstable/cli/Argument.d.ts +8 -7
  60. package/dist/unstable/cli/Argument.d.ts.map +1 -1
  61. package/dist/unstable/cli/Argument.js.map +1 -1
  62. package/dist/unstable/cli/Flag.d.ts +8 -7
  63. package/dist/unstable/cli/Flag.d.ts.map +1 -1
  64. package/dist/unstable/cli/Flag.js.map +1 -1
  65. package/dist/unstable/cli/Param.d.ts +1806 -168
  66. package/dist/unstable/cli/Param.d.ts.map +1 -1
  67. package/dist/unstable/cli/Param.js +0 -70
  68. package/dist/unstable/cli/Param.js.map +1 -1
  69. package/dist/unstable/cli/Primitive.d.ts +3 -4
  70. package/dist/unstable/cli/Primitive.d.ts.map +1 -1
  71. package/dist/unstable/cli/Primitive.js.map +1 -1
  72. package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
  73. package/dist/unstable/cli/internal/ansi.js +0 -22
  74. package/dist/unstable/cli/internal/ansi.js.map +1 -1
  75. package/dist/unstable/cli/internal/config.d.ts +48 -0
  76. package/dist/unstable/cli/internal/config.d.ts.map +1 -1
  77. package/dist/unstable/cli/internal/config.js +0 -6
  78. package/dist/unstable/cli/internal/config.js.map +1 -1
  79. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -3
  80. package/dist/unstable/cluster/Reply.d.ts +2 -2
  81. package/dist/unstable/cluster/Reply.d.ts.map +1 -1
  82. package/dist/unstable/cluster/Reply.js.map +1 -1
  83. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  84. package/dist/unstable/encoding/Msgpack.d.ts +6 -6
  85. package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
  86. package/dist/unstable/encoding/Msgpack.js.map +1 -1
  87. package/dist/unstable/encoding/Ndjson.d.ts +8 -8
  88. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  89. package/dist/unstable/encoding/Sse.d.ts +1 -1
  90. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  91. package/dist/unstable/encoding/Sse.js.map +1 -1
  92. package/dist/unstable/eventlog/EventLogMessage.d.ts +22 -22
  93. package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
  94. package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
  95. package/dist/unstable/http/HttpBody.d.ts +1 -1
  96. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  97. package/dist/unstable/http/HttpClientRequest.d.ts +1 -1
  98. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  99. package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
  100. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  101. package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
  102. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  103. package/dist/unstable/http/HttpMiddleware.js +12 -3
  104. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  105. package/dist/unstable/httpapi/HttpApi.d.ts +1 -1
  106. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  107. package/dist/unstable/httpapi/HttpApiClient.d.ts +2 -2
  108. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  109. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  110. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +32 -32
  111. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  112. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  113. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
  114. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  115. package/dist/unstable/httpapi/HttpApiSchema.d.ts +13 -6
  116. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  117. package/dist/unstable/httpapi/HttpApiSchema.js +0 -13
  118. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  119. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  120. package/dist/unstable/observability/internal/otlpProtobuf.js +0 -68
  121. package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
  122. package/dist/unstable/observability/internal/protobuf.js +0 -28
  123. package/dist/unstable/observability/internal/protobuf.js.map +1 -1
  124. package/dist/unstable/persistence/KeyValueStore.d.ts +2 -2
  125. package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
  126. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  127. package/dist/unstable/persistence/Persistable.d.ts +6 -6
  128. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  129. package/dist/unstable/persistence/PersistedQueue.d.ts +3 -3
  130. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  131. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  132. package/dist/unstable/persistence/Persistence.d.ts +5 -5
  133. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  134. package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
  135. package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
  136. package/dist/unstable/reactivity/Atom.d.ts +1 -1
  137. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  138. package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
  139. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  140. package/dist/unstable/rpc/Rpc.d.ts +3 -4
  141. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  142. package/dist/unstable/rpc/Rpc.js +1 -1
  143. package/dist/unstable/rpc/Rpc.js.map +1 -1
  144. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  145. package/dist/unstable/rpc/RpcClient.js +25 -4
  146. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  147. package/dist/unstable/rpc/RpcMessage.d.ts +7 -0
  148. package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
  149. package/dist/unstable/rpc/RpcMessage.js +20 -0
  150. package/dist/unstable/rpc/RpcMessage.js.map +1 -1
  151. package/dist/unstable/rpc/RpcMiddleware.d.ts +2 -2
  152. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  153. package/dist/unstable/rpc/RpcSchema.d.ts +10 -3
  154. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  155. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  156. package/dist/unstable/rpc/RpcWorker.d.ts +3 -3
  157. package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
  158. package/dist/unstable/schema/Model.d.ts +2 -2
  159. package/dist/unstable/schema/Model.d.ts.map +1 -1
  160. package/dist/unstable/schema/Model.js.map +1 -1
  161. package/dist/unstable/schema/VariantSchema.d.ts +16 -2
  162. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  163. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  164. package/dist/unstable/sql/SqlConnection.d.ts +1 -0
  165. package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
  166. package/dist/unstable/sql/SqlConnection.js.map +1 -1
  167. package/dist/unstable/sql/SqlModel.js.map +1 -1
  168. package/dist/unstable/sql/SqlResolver.d.ts +4 -4
  169. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  170. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  171. package/dist/unstable/sql/SqlSchema.d.ts +5 -5
  172. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  173. package/dist/unstable/sql/Statement.d.ts +1 -0
  174. package/dist/unstable/sql/Statement.d.ts.map +1 -1
  175. package/dist/unstable/sql/Statement.js +3 -0
  176. package/dist/unstable/sql/Statement.js.map +1 -1
  177. package/dist/unstable/workflow/Activity.d.ts +2 -2
  178. package/dist/unstable/workflow/Activity.d.ts.map +1 -1
  179. package/dist/unstable/workflow/DurableDeferred.d.ts +18 -18
  180. package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
  181. package/dist/unstable/workflow/Workflow.d.ts +3 -3
  182. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  183. package/dist/unstable/workflow/Workflow.js.map +1 -1
  184. package/dist/unstable/workflow/WorkflowEngine.d.ts +3 -3
  185. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  186. package/package.json +1 -1
  187. package/src/ChannelSchema.ts +9 -9
  188. package/src/Config.ts +12 -5
  189. package/src/Cron.ts +4 -0
  190. package/src/Schema.ts +968 -689
  191. package/src/SchemaAST.ts +25 -35
  192. package/src/SchemaParser.ts +85 -77
  193. package/src/SchemaTransformation.ts +5 -6
  194. package/src/internal/effect.ts +6 -22
  195. package/src/internal/matcher.ts +0 -5
  196. package/src/internal/schema/arbitrary.ts +1 -1
  197. package/src/internal/schema/representation.ts +1 -5
  198. package/src/internal/schema/schema.ts +1 -1
  199. package/src/testing/TestSchema.ts +14 -13
  200. package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
  201. package/src/unstable/ai/Chat.ts +1 -1
  202. package/src/unstable/ai/LanguageModel.ts +7 -7
  203. package/src/unstable/ai/McpSchema.ts +16 -14
  204. package/src/unstable/ai/McpServer.ts +7 -7
  205. package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
  206. package/src/unstable/ai/Response.ts +9 -5
  207. package/src/unstable/ai/Tool.ts +49 -47
  208. package/src/unstable/cli/Argument.ts +9 -8
  209. package/src/unstable/cli/Flag.ts +9 -8
  210. package/src/unstable/cli/Param.ts +6 -146
  211. package/src/unstable/cli/Primitive.ts +5 -6
  212. package/src/unstable/cli/internal/ansi.ts +0 -33
  213. package/src/unstable/cli/internal/config.ts +0 -8
  214. package/src/unstable/cli/internal/parser.ts +2 -2
  215. package/src/unstable/cluster/MessageStorage.ts +1 -1
  216. package/src/unstable/cluster/Reply.ts +6 -2
  217. package/src/unstable/devtools/DevToolsSchema.ts +1 -1
  218. package/src/unstable/encoding/Msgpack.ts +9 -7
  219. package/src/unstable/encoding/Ndjson.ts +10 -10
  220. package/src/unstable/encoding/Sse.ts +1 -1
  221. package/src/unstable/eventlog/Event.ts +3 -3
  222. package/src/unstable/http/HttpBody.ts +1 -1
  223. package/src/unstable/http/HttpClientRequest.ts +1 -1
  224. package/src/unstable/http/HttpIncomingMessage.ts +1 -1
  225. package/src/unstable/http/HttpMiddleware.ts +12 -3
  226. package/src/unstable/httpapi/HttpApi.ts +1 -1
  227. package/src/unstable/httpapi/HttpApiBuilder.ts +9 -5
  228. package/src/unstable/httpapi/HttpApiClient.ts +10 -10
  229. package/src/unstable/httpapi/HttpApiEndpoint.ts +45 -33
  230. package/src/unstable/httpapi/HttpApiMiddleware.ts +2 -2
  231. package/src/unstable/httpapi/HttpApiSchema.ts +16 -43
  232. package/src/unstable/httpapi/OpenApi.ts +5 -5
  233. package/src/unstable/observability/internal/otlpProtobuf.ts +0 -75
  234. package/src/unstable/observability/internal/protobuf.ts +0 -42
  235. package/src/unstable/persistence/KeyValueStore.ts +2 -2
  236. package/src/unstable/persistence/Persistable.ts +7 -7
  237. package/src/unstable/persistence/PersistedQueue.ts +3 -3
  238. package/src/unstable/persistence/Persistence.ts +5 -5
  239. package/src/unstable/reactivity/AsyncResult.ts +4 -4
  240. package/src/unstable/reactivity/Atom.ts +1 -1
  241. package/src/unstable/reactivity/AtomHttpApi.ts +1 -1
  242. package/src/unstable/rpc/Rpc.ts +7 -8
  243. package/src/unstable/rpc/RpcClient.ts +26 -4
  244. package/src/unstable/rpc/RpcMessage.ts +19 -0
  245. package/src/unstable/rpc/RpcMiddleware.ts +2 -2
  246. package/src/unstable/rpc/RpcSchema.ts +12 -9
  247. package/src/unstable/rpc/RpcWorker.ts +3 -3
  248. package/src/unstable/schema/Model.ts +2 -2
  249. package/src/unstable/schema/VariantSchema.ts +19 -17
  250. package/src/unstable/sql/SqlConnection.ts +5 -0
  251. package/src/unstable/sql/SqlModel.ts +2 -2
  252. package/src/unstable/sql/SqlResolver.ts +6 -6
  253. package/src/unstable/sql/SqlSchema.ts +5 -5
  254. package/src/unstable/sql/Statement.ts +11 -0
  255. package/src/unstable/workflow/Activity.ts +6 -6
  256. package/src/unstable/workflow/DurableDeferred.ts +33 -33
  257. package/src/unstable/workflow/Workflow.ts +5 -5
  258. package/src/unstable/workflow/WorkflowEngine.ts +10 -10
  259. package/dist/internal/concurrency.d.ts +0 -2
  260. package/dist/internal/concurrency.d.ts.map +0 -1
  261. package/dist/internal/concurrency.js +0 -29
  262. package/dist/internal/concurrency.js.map +0 -1
  263. package/src/internal/concurrency.ts +0 -52
package/dist/Schema.d.ts CHANGED
@@ -102,24 +102,18 @@ export interface MakeOptions {
102
102
  }
103
103
  /**
104
104
  * The fully-parameterized base interface for all schemas. Exposes all 14 type
105
- * parameters controlling type inference, mutability, optionality, services,
106
- * and transformation behavior.
105
+ * parameters controlling type inference, mutability, optionality, services, and
106
+ * transformation behavior.
107
107
  *
108
108
  * **When to use**
109
109
  *
110
- * Use when you are writing advanced generic schema utilities or performing schema
111
- * introspection.
112
- * - In user code, prefer {@link Schema}, {@link Codec}, {@link Decoder}, or
113
- * {@link Encoder} instead.
114
- *
115
- * @see {@link Top} — the existential "any schema" type (erased type params)
116
- * @see {@link Schema} — tracks only the decoded Type
117
- * @see {@link Codec} — tracks Type + Encoded
110
+ * Use when you are writing advanced generic schema utilities or performing
111
+ * schema introspection.
118
112
  *
119
113
  * @category models
120
114
  * @since 4.0.0
121
115
  */
122
- export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.AST, out Rebuild extends Top, out TypeMakeIn = T, out Iso = T, in out TypeParameters extends ReadonlyArray<Top> = readonly [], out TypeMake = TypeMakeIn, out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required"> extends Pipeable.Pipeable {
116
+ export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.AST, out Rebuild extends Top, out TypeMakeIn = T, out Iso = T, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMake = TypeMakeIn, out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required"> extends Pipeable.Pipeable {
123
117
  readonly [TypeId]: typeof TypeId;
124
118
  readonly "ast": Ast;
125
119
  readonly "Rebuild": Rebuild;
@@ -202,13 +196,40 @@ export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.
202
196
  */
203
197
  makeEffect(input: this["~type.make.in"], options?: MakeOptions): Effect.Effect<this["Type"], SchemaError>;
204
198
  }
199
+ /**
200
+ * Lazy `Bottom` variant for schema implementations that compute their public
201
+ * views on demand.
202
+ *
203
+ * **When to use**
204
+ *
205
+ * Use as an implementation base for schema interfaces that must expose
206
+ * `Bottom` behavior without forcing TypeScript to eagerly evaluate expensive
207
+ * `Type`, `Encoded`, or service views.
208
+ *
209
+ * **Details**
210
+ *
211
+ * The laziness is purely type-level; runtime behavior is unchanged.
212
+ * `BottomLazy` keeps the structural operations inherited from `Bottom`, but
213
+ * erases the expensive schema views to `unknown`. Concrete schema interfaces can
214
+ * then redeclare the precise views they expose. This keeps wide schemas such as
215
+ * `Struct` and `Union` cheaper when generic code reads a single view, while
216
+ * preserving their exact public types.
217
+ *
218
+ * @see {@link Bottom} for the fully parameterized schema interface when every
219
+ * view must be supplied directly.
220
+ *
221
+ * @category utility types
222
+ * @since 4.0.0
223
+ */
224
+ export interface BottomLazy<out Ast extends SchemaAST.AST, out Rebuild extends Top, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required"> extends Bottom<unknown, unknown, unknown, unknown, Ast, Rebuild, unknown, unknown, TypeParameters, unknown, TypeMutability, TypeOptionality, TypeConstructorDefault, EncodedMutability, EncodedOptionality> {
225
+ }
205
226
  /**
206
227
  * Type-level representation returned by {@link declareConstructor}.
207
228
  *
208
229
  * @category constructors
209
230
  * @since 4.0.0
210
231
  */
211
- export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<Top>, Iso = T> extends Bottom<T, E, TypeParameters[number]["DecodingServices"], TypeParameters[number]["EncodingServices"], SchemaAST.Declaration, declareConstructor<T, E, TypeParameters, Iso>, T, Iso, TypeParameters> {
232
+ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<Constraint>, Iso = T> extends Bottom<T, E, TypeParameters[number]["DecodingServices"], TypeParameters[number]["EncodingServices"], SchemaAST.Declaration, declareConstructor<T, E, TypeParameters, Iso>, T, Iso, TypeParameters> {
212
233
  }
213
234
  /**
214
235
  * Creates a schema for a **parametric** type (a generic container such as
@@ -243,7 +264,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
243
264
  * const isBox = (u: unknown): u is Box<unknown> =>
244
265
  * typeof u === "object" && u !== null && "value" in u
245
266
  *
246
- * const Box = <A extends Schema.Top>(item: A) =>
267
+ * const Box = <A extends Schema.Constraint>(item: A) =>
247
268
  * Schema.declareConstructor<Box<A["Type"]>, Box<A["Encoded"]>>()(
248
269
  * [item],
249
270
  * ([itemCodec]) =>
@@ -264,7 +285,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
264
285
  * @category constructors
265
286
  * @since 4.0.0
266
287
  */
267
- export declare function declareConstructor<T, E = T, Iso = T>(): <const TypeParameters extends ReadonlyArray<Top>>(typeParameters: TypeParameters, run: (typeParameters: { readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]>; }) => (u: unknown, self: SchemaAST.Declaration, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue>, annotations?: Annotations.Declaration<T, TypeParameters>) => declareConstructor<T, E, TypeParameters, Iso>;
288
+ export declare function declareConstructor<T, E = T, Iso = T>(): <const TypeParameters extends ReadonlyArray<Constraint>>(typeParameters: TypeParameters, run: (typeParameters: { readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]>; }) => (u: unknown, self: SchemaAST.Declaration, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue>, annotations?: Annotations.Declaration<T, TypeParameters>) => declareConstructor<T, E, TypeParameters, Iso>;
268
289
  /**
269
290
  * Type-level representation returned by {@link declare}.
270
291
  *
@@ -439,8 +460,8 @@ export declare function annotateKey<S extends Top>(annotations: Annotations.Key<
439
460
  * In user code prefer the narrower interfaces:
440
461
  * - {@link Schema}`<T>` — when you only care about the decoded type
441
462
  * - {@link Codec}`<T, E, RD, RE>` — when you need the encoded type and service requirements
442
- * - {@link Decoder}`<T, RD>` — for decode-only APIs
443
- * - {@link Encoder}`<E, RE>` — for encode-only APIs
463
+ * - {@link ConstraintDecoder}`<T, RD>` — for decode-only APIs
464
+ * - {@link ConstraintEncoder}`<E, RE>` — for encode-only APIs
444
465
  *
445
466
  * @category models
446
467
  * @since 4.0.0
@@ -448,6 +469,121 @@ export declare function annotateKey<S extends Top>(annotations: Annotations.Key<
448
469
  export interface Top extends Bottom<unknown, unknown, unknown, unknown, SchemaAST.AST, Top, unknown, unknown, any, // this is because TypeParameters is invariant
449
470
  unknown, Mutability, Optionality, ConstructorDefault, Mutability, Optionality> {
450
471
  }
472
+ /**
473
+ * Lightweight structural constraint for APIs that accept schema values but only
474
+ * read their data and type-level views.
475
+ *
476
+ * **When to use**
477
+ *
478
+ * Use when you need to constrain a generic value to be a schema, but the API
479
+ * only reads properties such as `ast`, `Type`, `Encoded`, service
480
+ * requirements, constructor input views, or modifier flags.
481
+ *
482
+ * **Details**
483
+ *
484
+ * `Constraint` keeps the schema type identifier and the property surface needed
485
+ * by schema constructors, while avoiding the full `Bottom` protocol. Use
486
+ * {@link Top} when an API calls schema methods such as `annotate`, `check`,
487
+ * `rebuild`, `make`, or `makeEffect`.
488
+ *
489
+ * @see {@link Top} for the complete schema protocol.
490
+ *
491
+ * @category models
492
+ * @since 4.0.0
493
+ */
494
+ export interface Constraint {
495
+ readonly [TypeId]: typeof TypeId;
496
+ readonly "ast": SchemaAST.AST;
497
+ readonly "Type": unknown;
498
+ readonly "Encoded": unknown;
499
+ readonly "DecodingServices": unknown;
500
+ readonly "EncodingServices": unknown;
501
+ readonly "~type.parameters": any;
502
+ readonly "~type.make.in": unknown;
503
+ readonly "~type.make": unknown;
504
+ readonly "Iso": unknown;
505
+ readonly "~type.optionality": Optionality;
506
+ readonly "~type.mutability": Mutability;
507
+ readonly "~type.constructor.default": ConstructorDefault;
508
+ readonly "~encoded.optionality": Optionality;
509
+ readonly "~encoded.mutability": Mutability;
510
+ }
511
+ /**
512
+ * Lightweight structural constraint for APIs that need codec type views but do
513
+ * not need the full schema protocol.
514
+ *
515
+ * **When to use**
516
+ *
517
+ * Use when you need to preserve decoded type, encoded type, and service
518
+ * requirements for a schema value, but the API does not call schema methods
519
+ * such as `annotate`, `check`, `rebuild`, `make`, or `makeEffect`.
520
+ *
521
+ * @see {@link Constraint} for the generic lightweight schema constraint.
522
+ * @see {@link Codec} for the full schema protocol with codec type views.
523
+ *
524
+ * @category models
525
+ * @since 4.0.0
526
+ */
527
+ export interface ConstraintCodec<out T, out E = T, out RD = never, out RE = never> extends Constraint {
528
+ readonly "Type": T;
529
+ readonly "Encoded": E;
530
+ readonly "DecodingServices": RD;
531
+ readonly "EncodingServices": RE;
532
+ }
533
+ /**
534
+ * Lightweight structural constraint for APIs that need decoder type views but
535
+ * do not need the full schema protocol.
536
+ *
537
+ * **When to use**
538
+ *
539
+ * Use when you need to preserve a schema's decoded type and decoding services,
540
+ * but the API does not constrain the encoded type, encoding services, or call
541
+ * schema methods such as `annotate`, `check`, `rebuild`, `make`, or
542
+ * `makeEffect`.
543
+ *
544
+ * @see {@link ConstraintCodec} for APIs that need both decoded and encoded codec views.
545
+ * @see {@link Codec} for the full schema protocol with codec type views.
546
+ *
547
+ * @category models
548
+ * @since 4.0.0
549
+ */
550
+ export interface ConstraintDecoder<out T, out RD = never> extends ConstraintCodec<T, unknown, RD, unknown> {
551
+ }
552
+ /**
553
+ * Lightweight structural constraint for APIs that need encoder type views but
554
+ * do not need the full schema protocol.
555
+ *
556
+ * **When to use**
557
+ *
558
+ * Use when you need to preserve a schema's encoded type and encoding services,
559
+ * but the API does not constrain the decoded type, decoding services, or call
560
+ * schema methods such as `annotate`, `check`, `rebuild`, `make`, or
561
+ * `makeEffect`.
562
+ *
563
+ * @see {@link ConstraintCodec} for APIs that need both decoded and encoded codec views.
564
+ * @see {@link Codec} for the full schema protocol with codec type views.
565
+ *
566
+ * @category models
567
+ * @since 4.0.0
568
+ */
569
+ export interface ConstraintEncoder<out E, out RE = never> extends ConstraintCodec<unknown, E, unknown, RE> {
570
+ }
571
+ /**
572
+ * Lightweight structural constraint for APIs that need schema views and the
573
+ * rebuilt schema type, but do not call the full schema protocol.
574
+ *
575
+ * **When to use**
576
+ *
577
+ * Use when an API needs to read `Rebuild` in addition to the schema views
578
+ * exposed by {@link Constraint}, but does not call methods such as `annotate`,
579
+ * `check`, `rebuild`, `make`, or `makeEffect`.
580
+ *
581
+ * @category models
582
+ * @since 4.0.0
583
+ */
584
+ export interface ConstraintRebuildable extends Constraint {
585
+ readonly "Rebuild": Constraint;
586
+ }
451
587
  /**
452
588
  * Namespace of type-level helpers for {@link Schema}.
453
589
  *
@@ -470,7 +606,9 @@ export declare namespace Schema {
470
606
  * @category utility types
471
607
  * @since 3.10.0
472
608
  */
473
- type Type<S> = S extends Top ? S["Type"] : never;
609
+ type Type<S> = S extends {
610
+ readonly "Type": infer T;
611
+ } ? T : never;
474
612
  }
475
613
  /**
476
614
  * A typed view of a schema that tracks only the decoded (output) type `T`.
@@ -528,7 +666,9 @@ export declare namespace Codec {
528
666
  * @category utility types
529
667
  * @since 3.10.0
530
668
  */
531
- type Encoded<S> = S extends Top ? S["Encoded"] : never;
669
+ type Encoded<S> = S extends {
670
+ readonly "Encoded": infer E;
671
+ } ? E : never;
532
672
  /**
533
673
  * Extracts the Effect services required during *decoding* from a schema.
534
674
  *
@@ -545,7 +685,9 @@ export declare namespace Codec {
545
685
  * @category utility types
546
686
  * @since 4.0.0
547
687
  */
548
- type DecodingServices<S> = S extends Top ? S["DecodingServices"] : never;
688
+ type DecodingServices<S> = S extends {
689
+ readonly "DecodingServices": infer R;
690
+ } ? R : never;
549
691
  /**
550
692
  * Extracts the Effect services required during *encoding* from a schema.
551
693
  *
@@ -562,7 +704,9 @@ export declare namespace Codec {
562
704
  * @category utility types
563
705
  * @since 4.0.0
564
706
  */
565
- type EncodingServices<S> = S extends Top ? S["EncodingServices"] : never;
707
+ type EncodingServices<S> = S extends {
708
+ readonly "EncodingServices": infer R;
709
+ } ? R : never;
566
710
  }
567
711
  /**
568
712
  * A schema that additionally supports optic (lens/prism) operations.
@@ -599,8 +743,8 @@ export interface Optic<out T, out Iso> extends Schema<T> {
599
743
  * Most concrete schemas produced by this module implement `Codec`.
600
744
  *
601
745
  * For APIs that only need one direction, prefer the narrower views:
602
- * - {@link Decoder}`<T, RD>` — decode-only
603
- * - {@link Encoder}`<E, RE>` — encode-only
746
+ * - {@link ConstraintDecoder}`<T, RD>` — decode-only
747
+ * - {@link ConstraintEncoder}`<E, RE>` — encode-only
604
748
  * - {@link Schema}`<T>` — type-only (no encoded representation)
605
749
  *
606
750
  * **Example** (Accepting a codec that decodes to `number` from `string`)
@@ -627,58 +771,6 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
627
771
  readonly "EncodingServices": RE;
628
772
  readonly "Rebuild": Codec<T, E, RD, RE>;
629
773
  }
630
- /**
631
- * A {@link Codec} view for APIs that only *decode* (parse/validate) values.
632
- *
633
- * **Details**
634
- *
635
- * Use `Decoder<T, RD>` to accept "any schema that can decode to `T`" without
636
- * constraining or depending on the encoded representation (`Encoded` is
637
- * `unknown`) or encoding services.
638
- *
639
- * **Example** (Accepting schemas that only need to decode)
640
- *
641
- * ```ts
642
- * import { Schema } from "effect"
643
- *
644
- * declare function validate<T>(decoder: Schema.Decoder<T>): (input: unknown) => T
645
- *
646
- * validate(Schema.String) // ok
647
- * validate(Schema.NumberFromString) // ok
648
- * ```
649
- *
650
- * @category models
651
- * @since 4.0.0
652
- */
653
- export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, unknown> {
654
- readonly "Rebuild": Decoder<T, RD>;
655
- }
656
- /**
657
- * A {@link Codec} view for APIs that only *encode* values.
658
- *
659
- * **Details**
660
- *
661
- * Use `Encoder<E, RE>` to accept "any schema that can encode to `E`" without
662
- * constraining or depending on the decoded `Type` (`Type` is `unknown`) or
663
- * decoding services.
664
- *
665
- * **Example** (Accepting schemas that only need to encode)
666
- *
667
- * ```ts
668
- * import { Schema } from "effect"
669
- *
670
- * declare function serialize<E>(encoder: Schema.Encoder<E>): (value: unknown) => E
671
- *
672
- * serialize(Schema.String) // ok — encodes to string
673
- * serialize(Schema.NumberFromString) // ok — encodes number to string
674
- * ```
675
- *
676
- * @category models
677
- * @since 4.0.0
678
- */
679
- export interface Encoder<out E, out RE = never> extends Codec<unknown, E, unknown, RE> {
680
- readonly "Rebuild": Encoder<E, RE>;
681
- }
682
774
  /**
683
775
  * Returns a codec widened to the full {@link Codec} interface, prompting
684
776
  * TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).
@@ -822,7 +914,7 @@ export declare function isSchemaError(u: unknown): u is SchemaError;
822
914
  * @category Standard Schema
823
915
  * @since 4.0.0
824
916
  */
825
- export declare function toStandardSchemaV1<S extends Decoder<unknown>>(self: S, options?: {
917
+ export declare function toStandardSchemaV1<S extends ConstraintDecoder<unknown>>(self: S, options?: {
826
918
  readonly leafHook?: SchemaIssue.LeafHook | undefined;
827
919
  readonly checkHook?: SchemaIssue.CheckHook | undefined;
828
920
  readonly parseOptions?: SchemaAST.ParseOptions | undefined;
@@ -837,7 +929,7 @@ export declare function toStandardSchemaV1<S extends Decoder<unknown>>(self: S,
837
929
  * @category Standard Schema
838
930
  * @since 4.0.0
839
931
  */
840
- export declare function toStandardJSONSchemaV1<S extends Top>(self: S): StandardJSONSchemaV1<S["Encoded"], S["Type"]> & S;
932
+ export declare function toStandardJSONSchemaV1<S extends Constraint>(self: S): StandardJSONSchemaV1<S["Encoded"], S["Type"]> & S;
841
933
  /**
842
934
  * Creates a type guard function that checks if a value conforms to a given
843
935
  * schema.
@@ -919,7 +1011,7 @@ export declare const is: typeof SchemaParser.is;
919
1011
  * @category guards
920
1012
  * @since 4.0.0
921
1013
  */
922
- export declare const asserts: <S extends Top, I>(schema: S, input: I) => asserts input is I & S["Type"];
1014
+ export declare const asserts: <S extends Constraint, I>(schema: S, input: I) => asserts input is I & S["Type"];
923
1015
  /**
924
1016
  * Decodes an `unknown` input against a schema, returning an `Effect` that
925
1017
  * succeeds with the decoded value or fails with a {@link SchemaError}.
@@ -941,7 +1033,7 @@ export declare const asserts: <S extends Top, I>(schema: S, input: I) => asserts
941
1033
  * @category decoding
942
1034
  * @since 4.0.0
943
1035
  */
944
- export declare function decodeUnknownEffect<S extends Top>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
1036
+ export declare function decodeUnknownEffect<S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
945
1037
  /**
946
1038
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
947
1039
  * returning an `Effect` that succeeds with the decoded value or fails with a
@@ -963,7 +1055,7 @@ export declare function decodeUnknownEffect<S extends Top>(schema: S, options?:
963
1055
  * @category decoding
964
1056
  * @since 4.0.0
965
1057
  */
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"]>;
1058
+ export declare const decodeEffect: <S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
967
1059
  /**
968
1060
  * Decodes an `unknown` input against a schema synchronously, returning an
969
1061
  * `Exit` that is either a `Success` with the decoded value or a `Failure`.
@@ -994,7 +1086,7 @@ export declare const decodeEffect: <S extends Top>(schema: S, options?: SchemaAS
994
1086
  * @category decoding
995
1087
  * @since 4.0.0
996
1088
  */
997
- export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
1089
+ export declare function decodeUnknownExit<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
998
1090
  /**
999
1091
  * Decodes a typed input (the schema's `Encoded` type) against a schema
1000
1092
  * synchronously, returning an `Exit` that is either a `Success` with the decoded
@@ -1025,7 +1117,7 @@ export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S,
1025
1117
  * @category decoding
1026
1118
  * @since 4.0.0
1027
1119
  */
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>;
1120
+ export declare const decodeExit: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
1029
1121
  /**
1030
1122
  * Decodes an `unknown` input against a schema, returning an `Option` that is
1031
1123
  * `Some` with the decoded value on success or `None` for schema mismatches.
@@ -1052,7 +1144,7 @@ export declare const decodeExit: <S extends Decoder<unknown>>(schema: S, options
1052
1144
  * @category decoding
1053
1145
  * @since 3.10.0
1054
1146
  */
1055
- export declare const decodeUnknownOption: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
1147
+ export declare const decodeUnknownOption: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
1056
1148
  /**
1057
1149
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1058
1150
  * returning an `Option` that is `Some` with the decoded value on success or
@@ -1078,7 +1170,7 @@ export declare const decodeUnknownOption: <S extends Decoder<unknown>>(schema: S
1078
1170
  * @category decoding
1079
1171
  * @since 3.10.0
1080
1172
  */
1081
- export declare const decodeOption: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
1173
+ export declare const decodeOption: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
1082
1174
  /**
1083
1175
  * Decodes an `unknown` input against a schema, returning a `Result` that
1084
1176
  * succeeds with the decoded value or fails with a {@link SchemaError} for schema
@@ -1108,7 +1200,7 @@ export declare const decodeOption: <S extends Decoder<unknown>>(schema: S, optio
1108
1200
  * @category decoding
1109
1201
  * @since 4.0.0
1110
1202
  */
1111
- export declare function decodeUnknownResult<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
1203
+ export declare function decodeUnknownResult<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
1112
1204
  /**
1113
1205
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1114
1206
  * returning a `Result` that succeeds with the decoded value or fails with a
@@ -1137,7 +1229,7 @@ export declare function decodeUnknownResult<S extends Decoder<unknown>>(schema:
1137
1229
  * @category decoding
1138
1230
  * @since 4.0.0
1139
1231
  */
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>;
1232
+ export declare const decodeResult: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
1141
1233
  /**
1142
1234
  * Decodes an `unknown` input against a schema, returning a `Promise` that
1143
1235
  * resolves with the decoded value or rejects with a {@link SchemaError} for
@@ -1165,7 +1257,7 @@ export declare const decodeResult: <S extends Decoder<unknown>>(schema: S, optio
1165
1257
  * @category decoding
1166
1258
  * @since 3.10.0
1167
1259
  */
1168
- export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
1260
+ export declare function decodeUnknownPromise<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
1169
1261
  /**
1170
1262
  * Decodes a typed input (the schema's `Encoded` type) against a schema,
1171
1263
  * returning a `Promise` that resolves with the decoded value or rejects with a
@@ -1193,7 +1285,7 @@ export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema:
1193
1285
  * @category decoding
1194
1286
  * @since 3.10.0
1195
1287
  */
1196
- export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
1288
+ export declare const decodePromise: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
1197
1289
  /**
1198
1290
  * Decodes an `unknown` input against a schema synchronously, returning the
1199
1291
  * decoded value or throwing a {@link SchemaError} for schema mismatches.
@@ -1238,7 +1330,7 @@ export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, opti
1238
1330
  * @category decoding
1239
1331
  * @since 4.0.0
1240
1332
  */
1241
- export declare function decodeUnknownSync<S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"];
1333
+ export declare function decodeUnknownSync<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"];
1242
1334
  /**
1243
1335
  * Decodes a typed input (the schema's `Encoded` type) against a schema
1244
1336
  * synchronously, returning the decoded value or throwing a {@link SchemaError}
@@ -1265,7 +1357,7 @@ export declare function decodeUnknownSync<S extends Decoder<unknown>>(schema: S,
1265
1357
  * @category decoding
1266
1358
  * @since 4.0.0
1267
1359
  */
1268
- export declare const decodeSync: <S extends Decoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => S["Type"];
1360
+ export declare const decodeSync: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => S["Type"];
1269
1361
  /**
1270
1362
  * Encodes an `unknown` input against a schema, returning an `Effect` that
1271
1363
  * succeeds with the encoded value or fails with a {@link SchemaError}.
@@ -1298,7 +1390,7 @@ export declare const decodeSync: <S extends Decoder<unknown>>(schema: S, options
1298
1390
  * @category encoding
1299
1391
  * @since 4.0.0
1300
1392
  */
1301
- export declare function encodeUnknownEffect<S extends Top>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
1393
+ export declare function encodeUnknownEffect<S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
1302
1394
  /**
1303
1395
  * Encodes a typed input (the schema's `Type`) against a schema, returning an
1304
1396
  * `Effect` that succeeds with the encoded value or fails with a
@@ -1320,7 +1412,7 @@ export declare function encodeUnknownEffect<S extends Top>(schema: S, options?:
1320
1412
  * @category encoding
1321
1413
  * @since 4.0.0
1322
1414
  */
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"]>;
1415
+ export declare const encodeEffect: <S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
1324
1416
  /**
1325
1417
  * Encodes an `unknown` input against a schema synchronously, returning an
1326
1418
  * `Exit` that is either a `Success` with the encoded value or a `Failure`.
@@ -1350,7 +1442,7 @@ export declare const encodeEffect: <S extends Top>(schema: S, options?: SchemaAS
1350
1442
  * @category encoding
1351
1443
  * @since 4.0.0
1352
1444
  */
1353
- export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1445
+ export declare function encodeUnknownExit<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1354
1446
  /**
1355
1447
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1356
1448
  * returning an `Exit` that is either a `Success` with the encoded value or a
@@ -1381,7 +1473,7 @@ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S,
1381
1473
  * @category encoding
1382
1474
  * @since 4.0.0
1383
1475
  */
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>;
1476
+ export declare const encodeExit: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
1385
1477
  /**
1386
1478
  * Encodes an `unknown` input against a schema, returning an `Option` that is
1387
1479
  * `Some` with the encoded value on success or `None` for schema mismatches.
@@ -1408,7 +1500,7 @@ export declare const encodeExit: <S extends Encoder<unknown>>(schema: S, options
1408
1500
  * @category encoding
1409
1501
  * @since 3.10.0
1410
1502
  */
1411
- export declare const encodeUnknownOption: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1503
+ export declare const encodeUnknownOption: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1412
1504
  /**
1413
1505
  * Encodes a typed input (the schema's `Type`) against a schema, returning an
1414
1506
  * `Option` that is `Some` with the encoded value on success or `None` for schema
@@ -1434,7 +1526,7 @@ export declare const encodeUnknownOption: <S extends Encoder<unknown>>(schema: S
1434
1526
  * @category encoding
1435
1527
  * @since 3.10.0
1436
1528
  */
1437
- export declare const encodeOption: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1529
+ export declare const encodeOption: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
1438
1530
  /**
1439
1531
  * Encodes an `unknown` input against a schema, returning a `Result` that
1440
1532
  * succeeds with the encoded value or fails with a {@link SchemaError} for schema
@@ -1463,7 +1555,7 @@ export declare const encodeOption: <S extends Encoder<unknown>>(schema: S, optio
1463
1555
  * @category encoding
1464
1556
  * @since 4.0.0
1465
1557
  */
1466
- export declare function encodeUnknownResult<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
1558
+ export declare function encodeUnknownResult<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
1467
1559
  /**
1468
1560
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1469
1561
  * `Result` that succeeds with the encoded value or fails with a
@@ -1492,7 +1584,7 @@ export declare function encodeUnknownResult<S extends Encoder<unknown>>(schema:
1492
1584
  * @category encoding
1493
1585
  * @since 4.0.0
1494
1586
  */
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>;
1587
+ export declare const encodeResult: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
1496
1588
  /**
1497
1589
  * Encodes an `unknown` input against a schema, returning a `Promise` that
1498
1590
  * resolves with the encoded value or rejects with a {@link SchemaError} for
@@ -1519,7 +1611,7 @@ export declare const encodeResult: <S extends Encoder<unknown>>(schema: S, optio
1519
1611
  * @category encoding
1520
1612
  * @since 3.10.0
1521
1613
  */
1522
- export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
1614
+ export declare function encodeUnknownPromise<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
1523
1615
  /**
1524
1616
  * Encodes a typed input (the schema's `Type`) against a schema, returning a
1525
1617
  * `Promise` that resolves with the encoded value or rejects with a
@@ -1547,7 +1639,7 @@ export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema:
1547
1639
  * @category encoding
1548
1640
  * @since 3.10.0
1549
1641
  */
1550
- export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
1642
+ export declare const encodePromise: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
1551
1643
  /**
1552
1644
  * Encodes an `unknown` input against a schema synchronously, throwing a
1553
1645
  * {@link SchemaError} for schema mismatches.
@@ -1574,7 +1666,7 @@ export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, opti
1574
1666
  * @category encoding
1575
1667
  * @since 4.0.0
1576
1668
  */
1577
- export declare function encodeUnknownSync<S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Encoded"];
1669
+ export declare function encodeUnknownSync<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Encoded"];
1578
1670
  /**
1579
1671
  * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1580
1672
  * throwing a {@link SchemaError} for schema mismatches.
@@ -1599,7 +1691,7 @@ export declare function encodeUnknownSync<S extends Encoder<unknown>>(schema: S,
1599
1691
  * @category encoding
1600
1692
  * @since 4.0.0
1601
1693
  */
1602
- export declare const encodeSync: <S extends Encoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => S["Encoded"];
1694
+ export declare const encodeSync: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => S["Encoded"];
1603
1695
  /**
1604
1696
  * Creates a schema from an AST (Abstract Syntax Tree) node.
1605
1697
  *
@@ -1617,7 +1709,7 @@ export declare const encodeSync: <S extends Encoder<unknown>>(schema: S, options
1617
1709
  * @category constructors
1618
1710
  * @since 3.10.0
1619
1711
  */
1620
- export declare const make: <S extends Top>(ast: S["ast"], options?: object) => S;
1712
+ export declare const make: <S extends Constraint>(ast: S["ast"], options?: object) => S;
1621
1713
  /**
1622
1714
  * Transforms a schema into a class that can be extended with `extends`. The
1623
1715
  * resulting class inherits the full schema API (e.g. `annotate`) and can define
@@ -1655,12 +1747,19 @@ export declare function isSchema(u: unknown): u is Top;
1655
1747
  * @category models
1656
1748
  * @since 4.0.0
1657
1749
  */
1658
- export interface optionalKey<S extends Top> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], optionalKey<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], "optional", S["~type.constructor.default"], S["~encoded.mutability"], "optional"> {
1750
+ export interface optionalKey<S extends Constraint> extends BottomLazy<S["ast"], optionalKey<S>, S["~type.parameters"], S["~type.mutability"], "optional", S["~type.constructor.default"], S["~encoded.mutability"], "optional"> {
1751
+ readonly "Type": S["Type"];
1752
+ readonly "Encoded": S["Encoded"];
1753
+ readonly "DecodingServices": S["DecodingServices"];
1754
+ readonly "EncodingServices": S["EncodingServices"];
1755
+ readonly "~type.make.in": S["~type.make.in"];
1756
+ readonly "~type.make": S["~type.make"];
1757
+ readonly "Iso": S["Iso"];
1659
1758
  readonly schema: S;
1660
1759
  }
1661
1760
  interface optionalKeyLambda extends Lambda {
1662
- <S extends Top>(self: S): optionalKey<S>;
1663
- readonly "~lambda.out": this["~lambda.in"] extends Top ? optionalKey<this["~lambda.in"]> : never;
1761
+ <S extends Constraint>(self: S): optionalKey<S>;
1762
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? optionalKey<this["~lambda.in"]> : never;
1664
1763
  }
1665
1764
  /**
1666
1765
  * Creates an exact optional key schema for struct fields. Unlike `optional`,
@@ -1686,8 +1785,8 @@ interface optionalKeyLambda extends Lambda {
1686
1785
  */
1687
1786
  export declare const optionalKey: optionalKeyLambda;
1688
1787
  interface requiredKeyLambda extends Lambda {
1689
- <S extends Top>(self: optionalKey<S>): S;
1690
- readonly "~lambda.out": this["~lambda.in"] extends optionalKey<Top> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for requiredKey";
1788
+ <S extends Constraint>(self: optionalKey<S>): S;
1789
+ readonly "~lambda.out": this["~lambda.in"] extends optionalKey<Constraint> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for requiredKey";
1691
1790
  }
1692
1791
  /**
1693
1792
  * Reverses `optionalKey` and returns the inner required schema.
@@ -1707,12 +1806,12 @@ export declare const requiredKey: requiredKeyLambda;
1707
1806
  * @category models
1708
1807
  * @since 3.10.0
1709
1808
  */
1710
- export interface optional<S extends Top> extends optionalKey<UndefinedOr<S>> {
1809
+ export interface optional<S extends Constraint> extends optionalKey<UndefinedOr<S>> {
1711
1810
  readonly "Rebuild": optional<S>;
1712
1811
  }
1713
1812
  interface optionalLambda extends Lambda {
1714
- <S extends Top>(self: S): optional<S>;
1715
- readonly "~lambda.out": this["~lambda.in"] extends Top ? optional<this["~lambda.in"]> : never;
1813
+ <S extends Constraint>(self: S): optional<S>;
1814
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? optional<this["~lambda.in"]> : never;
1716
1815
  }
1717
1816
  /**
1718
1817
  * Marks a struct field as optional, allowing the key to be absent or
@@ -1745,8 +1844,8 @@ interface optionalLambda extends Lambda {
1745
1844
  */
1746
1845
  export declare const optional: optionalLambda;
1747
1846
  interface requiredLambda extends Lambda {
1748
- <S extends Top>(self: optional<S>): S;
1749
- readonly "~lambda.out": this["~lambda.in"] extends optional<Top> ? this["~lambda.in"]["schema"]["members"][0] : "Error: schema not eligible for required";
1847
+ <S extends Constraint>(self: optional<S>): S;
1848
+ readonly "~lambda.out": this["~lambda.in"] extends optional<Constraint> ? this["~lambda.in"]["schema"]["members"][0] : "Error: schema not eligible for required";
1750
1849
  }
1751
1850
  /**
1752
1851
  * Reverses `optional` and returns the inner schema.
@@ -1770,12 +1869,19 @@ export declare const required: requiredLambda;
1770
1869
  * @category models
1771
1870
  * @since 4.0.0
1772
1871
  */
1773
- export interface mutableKey<S extends Top> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], mutableKey<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], "mutable", S["~type.optionality"], S["~type.constructor.default"], "mutable", S["~encoded.optionality"]> {
1872
+ export interface mutableKey<S extends Constraint> extends BottomLazy<S["ast"], mutableKey<S>, S["~type.parameters"], "mutable", S["~type.optionality"], S["~type.constructor.default"], "mutable", S["~encoded.optionality"]> {
1873
+ readonly "Type": S["Type"];
1874
+ readonly "Encoded": S["Encoded"];
1875
+ readonly "DecodingServices": S["DecodingServices"];
1876
+ readonly "EncodingServices": S["EncodingServices"];
1877
+ readonly "~type.make.in": S["~type.make.in"];
1878
+ readonly "~type.make": S["~type.make"];
1879
+ readonly "Iso": S["Iso"];
1774
1880
  readonly schema: S;
1775
1881
  }
1776
1882
  interface mutableKeyLambda extends Lambda {
1777
- <S extends Top>(self: S): mutableKey<S>;
1778
- readonly "~lambda.out": this["~lambda.in"] extends Top ? mutableKey<this["~lambda.in"]> : never;
1883
+ <S extends Constraint>(self: S): mutableKey<S>;
1884
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? mutableKey<this["~lambda.in"]> : never;
1779
1885
  }
1780
1886
  /**
1781
1887
  * Makes a struct field mutable (removes the `readonly` modifier on the property).
@@ -1786,8 +1892,8 @@ interface mutableKeyLambda extends Lambda {
1786
1892
  */
1787
1893
  export declare const mutableKey: mutableKeyLambda;
1788
1894
  interface readonlyKeyLambda extends Lambda {
1789
- <S extends Top>(self: mutableKey<S>): S;
1790
- readonly "~lambda.out": this["~lambda.in"] extends mutableKey<Top> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for readonlyKey";
1895
+ <S extends Constraint>(self: mutableKey<S>): S;
1896
+ readonly "~lambda.out": this["~lambda.in"] extends mutableKey<Constraint> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for readonlyKey";
1791
1897
  }
1792
1898
  /**
1793
1899
  * Reverses `mutableKey` and returns the inner readonly schema.
@@ -1807,11 +1913,19 @@ export declare const readonlyKey: readonlyKeyLambda;
1807
1913
  * @category transforming
1808
1914
  * @since 4.0.0
1809
1915
  */
1810
- export interface toType<S extends Top> extends Bottom<S["Type"], S["Type"], never, never, S["ast"], toType<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
1916
+ export interface toType<S extends Constraint> extends BottomLazy<S["ast"], toType<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
1917
+ readonly "Type": S["Type"];
1918
+ readonly "Encoded": S["Type"];
1919
+ readonly "DecodingServices": never;
1920
+ readonly "EncodingServices": never;
1921
+ readonly "~type.make.in": S["~type.make.in"];
1922
+ readonly "~type.make": S["~type.make"];
1923
+ readonly "Iso": S["Iso"];
1924
+ readonly schema: S;
1811
1925
  }
1812
1926
  interface toTypeLambda extends Lambda {
1813
- <S extends Top>(self: S): toType<S>;
1814
- readonly "~lambda.out": this["~lambda.in"] extends Top ? toType<this["~lambda.in"]> : never;
1927
+ <S extends Constraint>(self: S): toType<S>;
1928
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? toType<this["~lambda.in"]> : never;
1815
1929
  }
1816
1930
  /**
1817
1931
  * Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
@@ -1827,11 +1941,19 @@ export declare const toType: toTypeLambda;
1827
1941
  * @category transforming
1828
1942
  * @since 4.0.0
1829
1943
  */
1830
- export interface toEncoded<S extends Top> extends Bottom<S["Encoded"], S["Encoded"], never, never, SchemaAST.AST, toEncoded<S>, S["Encoded"], S["Encoded"], ReadonlyArray<Top>, S["Encoded"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
1944
+ export interface toEncoded<S extends Constraint> extends BottomLazy<SchemaAST.AST, toEncoded<S>, ReadonlyArray<Constraint>, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
1945
+ readonly "Type": S["Encoded"];
1946
+ readonly "Encoded": S["Encoded"];
1947
+ readonly "DecodingServices": never;
1948
+ readonly "EncodingServices": never;
1949
+ readonly "~type.make.in": S["Encoded"];
1950
+ readonly "~type.make": S["Encoded"];
1951
+ readonly "Iso": S["Encoded"];
1952
+ readonly schema: S;
1831
1953
  }
1832
1954
  interface toEncodedLambda extends Lambda {
1833
- <S extends Top>(self: S): toEncoded<S>;
1834
- readonly "~lambda.out": this["~lambda.in"] extends Top ? toEncoded<this["~lambda.in"]> : never;
1955
+ <S extends Constraint>(self: S): toEncoded<S>;
1956
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? toEncoded<this["~lambda.in"]> : never;
1835
1957
  }
1836
1958
  /**
1837
1959
  * Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,
@@ -1848,7 +1970,14 @@ declare const FlipTypeId = "~effect/Schema/flip";
1848
1970
  * @category transforming
1849
1971
  * @since 4.0.0
1850
1972
  */
1851
- export interface flip<S extends Top> extends Bottom<S["Encoded"], S["Type"], S["EncodingServices"], S["DecodingServices"], SchemaAST.AST, flip<S>, S["Encoded"], S["Encoded"], ReadonlyArray<Top>, S["Encoded"], S["~encoded.mutability"], S["~encoded.optionality"], ConstructorDefault, S["~type.mutability"], S["~type.optionality"]> {
1973
+ export interface flip<S extends Top> extends BottomLazy<SchemaAST.AST, flip<S>, ReadonlyArray<Constraint>, S["~encoded.mutability"], S["~encoded.optionality"], ConstructorDefault, S["~type.mutability"], S["~type.optionality"]> {
1974
+ readonly "Type": S["Encoded"];
1975
+ readonly "Encoded": S["Type"];
1976
+ readonly "DecodingServices": S["EncodingServices"];
1977
+ readonly "EncodingServices": S["DecodingServices"];
1978
+ readonly "~type.make.in": S["Encoded"];
1979
+ readonly "~type.make": S["Encoded"];
1980
+ readonly "Iso": S["Encoded"];
1852
1981
  readonly [FlipTypeId]: typeof FlipTypeId;
1853
1982
  readonly schema: S;
1854
1983
  }
@@ -1923,7 +2052,7 @@ export declare namespace TemplateLiteral {
1923
2052
  * @category utility types
1924
2053
  * @since 4.0.0
1925
2054
  */
1926
- interface SchemaPart extends Top {
2055
+ interface SchemaPart extends Constraint {
1927
2056
  readonly Encoded: string | number | bigint;
1928
2057
  }
1929
2058
  /**
@@ -1948,7 +2077,9 @@ export declare namespace TemplateLiteral {
1948
2077
  * @since 4.0.0
1949
2078
  */
1950
2079
  type Parts = ReadonlyArray<Part>;
1951
- type AppendType<Template extends string, Next> = Next extends LiteralPart ? `${Template}${Next}` : Next extends Codec<unknown, infer E extends LiteralPart, unknown, unknown> ? `${Template}${E}` : never;
2080
+ type AppendType<Template extends string, Next> = Next extends LiteralPart ? `${Template}${Next}` : Next extends {
2081
+ readonly Encoded: infer E extends LiteralPart;
2082
+ } ? `${Template}${E}` : never;
1952
2083
  /**
1953
2084
  * Computes the encoded string literal type produced by concatenating the encoded
1954
2085
  * forms of all template literal parts.
@@ -2024,7 +2155,14 @@ export declare namespace TemplateLiteralParser {
2024
2155
  * @category models
2025
2156
  * @since 3.10.0
2026
2157
  */
2027
- export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> extends Bottom<TemplateLiteralParser.Type<Parts>, TemplateLiteral.Encoded<Parts>, never, never, SchemaAST.Arrays, TemplateLiteralParser<Parts>> {
2158
+ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> extends BottomLazy<SchemaAST.Arrays, TemplateLiteralParser<Parts>> {
2159
+ readonly "Type": TemplateLiteralParser.Type<Parts>;
2160
+ readonly "Encoded": TemplateLiteral.Encoded<Parts>;
2161
+ readonly "DecodingServices": never;
2162
+ readonly "EncodingServices": never;
2163
+ readonly "~type.make.in": TemplateLiteralParser.Type<Parts>;
2164
+ readonly "~type.make": TemplateLiteralParser.Type<Parts>;
2165
+ readonly "Iso": TemplateLiteralParser.Type<Parts>;
2028
2166
  readonly parts: Parts;
2029
2167
  }
2030
2168
  /**
@@ -2351,7 +2489,7 @@ export declare namespace Struct {
2351
2489
  * @since 3.10.0
2352
2490
  */
2353
2491
  type Fields = {
2354
- readonly [x: PropertyKey]: Top;
2492
+ readonly [x: PropertyKey]: Constraint;
2355
2493
  };
2356
2494
  type TypeOptionalKeys<Fields extends Struct.Fields> = {
2357
2495
  [K in keyof Fields]: Fields[K] extends {
@@ -2363,15 +2501,28 @@ export declare namespace Struct {
2363
2501
  readonly "~type.mutability": "mutable";
2364
2502
  } ? K : never;
2365
2503
  }[keyof Fields];
2366
- type Type_<F extends Fields, O extends keyof F = TypeOptionalKeys<F>, M extends keyof F = TypeMutableKeys<F>> = {
2367
- readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Type"];
2368
- } & {
2369
- readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Type"];
2370
- } & {
2371
- -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Type"];
2372
- } & {
2373
- -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Type"];
2504
+ type SetOptional<A, K extends keyof A> = Omit<A, K> & Partial<Pick<A, K>>;
2505
+ type Mutable<A> = {
2506
+ -readonly [K in keyof A]: A[K];
2507
+ };
2508
+ type SetMutable<A, K extends keyof A> = Omit<A, K> & Mutable<Pick<A, K>>;
2509
+ type Side = "Type" | "Iso" | "Encoded";
2510
+ type EncodedOptionalKeys<Fields extends Struct.Fields> = {
2511
+ [K in keyof Fields]: Fields[K] extends {
2512
+ readonly "~encoded.optionality": "optional";
2513
+ } ? K : never;
2514
+ }[keyof Fields];
2515
+ type EncodedMutableKeys<Fields extends Struct.Fields> = {
2516
+ [K in keyof Fields]: Fields[K] extends {
2517
+ readonly "~encoded.mutability": "mutable";
2518
+ } ? K : never;
2519
+ }[keyof Fields];
2520
+ type SideOptionalKeys<F extends Fields, S extends Side> = S extends "Encoded" ? EncodedOptionalKeys<F> : TypeOptionalKeys<F>;
2521
+ type SideMutableKeys<F extends Fields, S extends Side> = S extends "Encoded" ? EncodedMutableKeys<F> : TypeMutableKeys<F>;
2522
+ type ReadonlySide<F extends Fields, S extends Side> = {
2523
+ readonly [K in keyof F]: F[K][S];
2374
2524
  };
2525
+ type View<F extends Fields, S extends Side, O extends keyof F = SideOptionalKeys<F, S>, M extends keyof F = SideMutableKeys<F, S>> = [O | M] extends [never] ? ReadonlySide<F, S> : [M] extends [never] ? Simplify<SetOptional<ReadonlySide<F, S>, O>> : [O] extends [never] ? Simplify<SetMutable<ReadonlySide<F, S>, M>> : Simplify<SetMutable<SetOptional<ReadonlySide<F, S>, O>, Extract<keyof SetOptional<ReadonlySide<F, S>, O>, M>>>;
2375
2526
  /**
2376
2527
  * Computes the decoded object type for a struct field map.
2377
2528
  *
@@ -2383,16 +2534,7 @@ export declare namespace Struct {
2383
2534
  * @category utility types
2384
2535
  * @since 3.10.0
2385
2536
  */
2386
- type Type<F extends Fields> = Simplify<Type_<F>>;
2387
- type Iso_<F extends Fields, O extends keyof F = TypeOptionalKeys<F>, M extends keyof F = TypeMutableKeys<F>> = {
2388
- readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Iso"];
2389
- } & {
2390
- readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Iso"];
2391
- } & {
2392
- -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Iso"];
2393
- } & {
2394
- -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Iso"];
2395
- };
2537
+ type Type<F extends Fields> = View<F, "Type">;
2396
2538
  /**
2397
2539
  * Computes the iso object type for a struct field map from each field schema's
2398
2540
  * `Iso` type.
@@ -2405,26 +2547,7 @@ export declare namespace Struct {
2405
2547
  * @category utility types
2406
2548
  * @since 4.0.0
2407
2549
  */
2408
- type Iso<F extends Fields> = Simplify<Iso_<F>>;
2409
- type EncodedOptionalKeys<Fields extends Struct.Fields> = {
2410
- [K in keyof Fields]: Fields[K] extends {
2411
- readonly "~encoded.optionality": "optional";
2412
- } ? K : never;
2413
- }[keyof Fields];
2414
- type EncodedMutableKeys<Fields extends Struct.Fields> = {
2415
- [K in keyof Fields]: Fields[K] extends {
2416
- readonly "~encoded.mutability": "mutable";
2417
- } ? K : never;
2418
- }[keyof Fields];
2419
- type Encoded_<F extends Fields, O extends keyof F = EncodedOptionalKeys<F>, M extends keyof F = EncodedMutableKeys<F>> = {
2420
- readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Encoded"];
2421
- } & {
2422
- readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Encoded"];
2423
- } & {
2424
- -readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Encoded"];
2425
- } & {
2426
- -readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Encoded"];
2427
- };
2550
+ type Iso<F extends Fields> = View<F, "Iso">;
2428
2551
  /**
2429
2552
  * Computes the encoded object type for a struct field map.
2430
2553
  *
@@ -2437,7 +2560,7 @@ export declare namespace Struct {
2437
2560
  * @category utility types
2438
2561
  * @since 3.10.0
2439
2562
  */
2440
- type Encoded<F extends Fields> = Simplify<Encoded_<F>>;
2563
+ type Encoded<F extends Fields> = View<F, "Encoded">;
2441
2564
  /**
2442
2565
  * Union of all decoding service requirements needed by the schemas in a struct
2443
2566
  * field map.
@@ -2463,11 +2586,10 @@ export declare namespace Struct {
2463
2586
  readonly "~type.constructor.default": "with-default";
2464
2587
  } ? K : never;
2465
2588
  }[keyof Fields];
2466
- type MakeIn_<F extends Fields, O = TypeOptionalKeys<F> | TypeConstructorDefaultedKeys<F>> = {
2467
- readonly [K in keyof F as K extends O ? never : K]: F[K]["~type.make"];
2468
- } & {
2469
- readonly [K in keyof F as K extends O ? K : never]?: F[K]["~type.make"];
2589
+ type ReadonlyMakeIn<F extends Fields> = {
2590
+ readonly [K in keyof F]: F[K]["~type.make"];
2470
2591
  };
2592
+ type MakeInView<F extends Fields, O extends keyof F = TypeOptionalKeys<F> | TypeConstructorDefaultedKeys<F>> = [O] extends [never] ? ReadonlyMakeIn<F> : Simplify<SetOptional<ReadonlyMakeIn<F>, O>>;
2471
2593
  /**
2472
2594
  * Computes the input object type accepted when constructing a struct value.
2473
2595
  *
@@ -2479,7 +2601,7 @@ export declare namespace Struct {
2479
2601
  * @category utility types
2480
2602
  * @since 4.0.0
2481
2603
  */
2482
- type MakeIn<F extends Fields> = Simplify<MakeIn_<F>>;
2604
+ type MakeIn<F extends Fields> = MakeInView<F>;
2483
2605
  }
2484
2606
  /**
2485
2607
  * Type-level representation returned by {@link Struct}.
@@ -2487,7 +2609,14 @@ export declare namespace Struct {
2487
2609
  * @category models
2488
2610
  * @since 3.10.0
2489
2611
  */
2490
- export interface Struct<Fields extends Struct.Fields> extends Bottom<Struct.Type<Fields>, Struct.Encoded<Fields>, Struct.DecodingServices<Fields>, Struct.EncodingServices<Fields>, SchemaAST.Objects, Struct<Fields>, Struct.MakeIn<Fields>, Struct.Iso<Fields>> {
2612
+ export interface Struct<Fields extends Struct.Fields> extends BottomLazy<SchemaAST.Objects, Struct<Fields>> {
2613
+ readonly "Type": Struct.Type<Fields>;
2614
+ readonly "Encoded": Struct.Encoded<Fields>;
2615
+ readonly "DecodingServices": Struct.DecodingServices<Fields>;
2616
+ readonly "EncodingServices": Struct.EncodingServices<Fields>;
2617
+ readonly "~type.make.in": Struct.MakeIn<Fields>;
2618
+ readonly "~type.make": Struct.MakeIn<Fields>;
2619
+ readonly "Iso": Struct.Iso<Fields>;
2491
2620
  /**
2492
2621
  * The field definitions of this struct. Spread them into a new struct to
2493
2622
  * reuse fields across schemas.
@@ -2602,7 +2731,7 @@ export declare function fieldsAssign<const NewFields extends Struct.Fields>(fiel
2602
2731
  * @category transforming
2603
2732
  * @since 4.0.0
2604
2733
  */
2605
- export interface encodeKeys<S extends Top & {
2734
+ export interface encodeKeys<S extends Constraint & {
2606
2735
  readonly fields: Struct.Fields;
2607
2736
  }, M extends {
2608
2737
  readonly [K in keyof S["fields"]]?: PropertyKey;
@@ -2638,7 +2767,7 @@ export interface encodeKeys<S extends Top & {
2638
2767
  * @category transforming
2639
2768
  * @since 4.0.0
2640
2769
  */
2641
- export declare function encodeKeys<S extends Top & {
2770
+ export declare function encodeKeys<S extends Constraint & {
2642
2771
  readonly fields: Struct.Fields;
2643
2772
  }, const M extends {
2644
2773
  readonly [K in keyof S["fields"]]?: PropertyKey;
@@ -2721,7 +2850,7 @@ export declare namespace Record {
2721
2850
  * @category utility types
2722
2851
  * @since 3.10.0
2723
2852
  */
2724
- type Type<Key extends Record.Key, Value extends Top> = Value extends {
2853
+ type Type<Key extends Record.Key, Value extends Constraint> = Value extends {
2725
2854
  readonly "~type.optionality": "optional";
2726
2855
  } ? Value extends {
2727
2856
  readonly "~type.mutability": "mutable";
@@ -2743,7 +2872,7 @@ export declare namespace Record {
2743
2872
  * @category utility types
2744
2873
  * @since 4.0.0
2745
2874
  */
2746
- type Iso<Key extends Record.Key, Value extends Top> = Value extends {
2875
+ type Iso<Key extends Record.Key, Value extends Constraint> = Value extends {
2747
2876
  readonly "~type.optionality": "optional";
2748
2877
  } ? Value extends {
2749
2878
  readonly "~type.mutability": "mutable";
@@ -2770,7 +2899,7 @@ export declare namespace Record {
2770
2899
  * @category utility types
2771
2900
  * @since 3.10.0
2772
2901
  */
2773
- type Encoded<Key extends Record.Key, Value extends Top> = Value extends {
2902
+ type Encoded<Key extends Record.Key, Value extends Constraint> = Value extends {
2774
2903
  readonly "~encoded.optionality": "optional";
2775
2904
  } ? Value extends {
2776
2905
  readonly "~encoded.mutability": "mutable";
@@ -2792,7 +2921,7 @@ export declare namespace Record {
2792
2921
  * @category utility types
2793
2922
  * @since 4.0.0
2794
2923
  */
2795
- type DecodingServices<Key extends Record.Key, Value extends Top> = Key["DecodingServices"] | Value["DecodingServices"];
2924
+ type DecodingServices<Key extends Record.Key, Value extends Constraint> = Key["DecodingServices"] | Value["DecodingServices"];
2796
2925
  /**
2797
2926
  * Union of the encoding service requirements of a record's key schema and value
2798
2927
  * schema.
@@ -2800,7 +2929,7 @@ export declare namespace Record {
2800
2929
  * @category utility types
2801
2930
  * @since 4.0.0
2802
2931
  */
2803
- type EncodingServices<Key extends Record.Key, Value extends Top> = Key["EncodingServices"] | Value["EncodingServices"];
2932
+ type EncodingServices<Key extends Record.Key, Value extends Constraint> = Key["EncodingServices"] | Value["EncodingServices"];
2804
2933
  /**
2805
2934
  * Computes the input object type accepted when constructing a record value.
2806
2935
  *
@@ -2813,7 +2942,7 @@ export declare namespace Record {
2813
2942
  * @category utility types
2814
2943
  * @since 4.0.0
2815
2944
  */
2816
- type MakeIn<Key extends Record.Key, Value extends Top> = Value extends {
2945
+ type MakeIn<Key extends Record.Key, Value extends Constraint> = Value extends {
2817
2946
  readonly "~encoded.optionality": "optional";
2818
2947
  } ? Value extends {
2819
2948
  readonly "~encoded.mutability": "mutable";
@@ -2835,7 +2964,14 @@ export declare namespace Record {
2835
2964
  * @category models
2836
2965
  * @since 4.0.0
2837
2966
  */
2838
- export interface $Record<Key extends Record.Key, Value extends Top> extends Bottom<Record.Type<Key, Value>, Record.Encoded<Key, Value>, Record.DecodingServices<Key, Value>, Record.EncodingServices<Key, Value>, SchemaAST.Objects, $Record<Key, Value>, Simplify<Record.MakeIn<Key, Value>>, Record.Iso<Key, Value>> {
2967
+ export interface $Record<Key extends Record.Key, Value extends Constraint> extends BottomLazy<SchemaAST.Objects, $Record<Key, Value>> {
2968
+ readonly "Type": Record.Type<Key, Value>;
2969
+ readonly "Encoded": Record.Encoded<Key, Value>;
2970
+ readonly "DecodingServices": Record.DecodingServices<Key, Value>;
2971
+ readonly "EncodingServices": Record.EncodingServices<Key, Value>;
2972
+ readonly "~type.make.in": Simplify<Record.MakeIn<Key, Value>>;
2973
+ readonly "~type.make": Simplify<Record.MakeIn<Key, Value>>;
2974
+ readonly "Iso": Record.Iso<Key, Value>;
2839
2975
  readonly key: Key;
2840
2976
  readonly value: Value;
2841
2977
  }
@@ -2871,7 +3007,7 @@ export interface $Record<Key extends Record.Key, Value extends Top> extends Bott
2871
3007
  * @category constructors
2872
3008
  * @since 3.10.0
2873
3009
  */
2874
- export declare function Record<Key extends Record.Key, Value extends Top>(key: Key, value: Value, options?: {
3010
+ export declare function Record<Key extends Record.Key, Value extends Constraint>(key: Key, value: Value, options?: {
2875
3011
  readonly keyValueCombiner: {
2876
3012
  readonly decode?: Combiner.Combiner<readonly [Key["Type"], Value["Type"]]> | undefined;
2877
3013
  readonly encode?: Combiner.Combiner<readonly [Key["Encoded"], Value["Encoded"]]> | undefined;
@@ -2895,7 +3031,7 @@ export declare namespace StructWithRest {
2895
3031
  * @category utility types
2896
3032
  * @since 4.0.0
2897
3033
  */
2898
- type Objects = Top & {
3034
+ type Objects = Constraint & {
2899
3035
  readonly ast: SchemaAST.Objects;
2900
3036
  };
2901
3037
  /**
@@ -2905,7 +3041,7 @@ export declare namespace StructWithRest {
2905
3041
  * @category utility types
2906
3042
  * @since 3.10.0
2907
3043
  */
2908
- type Records = ReadonlyArray<$Record<Record.Key, Top>>;
3044
+ type Records = ReadonlyArray<$Record<Record.Key, Constraint>>;
2909
3045
  type MergeTuple<T extends ReadonlyArray<unknown>> = T extends readonly [infer Head, ...infer Tail] ? Head & MergeTuple<Tail> : {};
2910
3046
  type Intersect<S extends Objects, Records extends StructWithRest.Records, Side extends "Type" | "Iso" | "Encoded" | "~type.make"> = S[Side] & MergeTuple<{
2911
3047
  readonly [K in keyof Records]: Records[K][Side];
@@ -2968,16 +3104,43 @@ export declare namespace StructWithRest {
2968
3104
  type IncompatibleSideKeys<S extends Objects, Records extends StructWithRest.Records, Side extends "Type" | "Encoded" | "Iso" | "~type.make"> = {
2969
3105
  [I in keyof Records]: Records[I][Side] extends object ? IncompatibleKeys<S[Side], Records[I][Side]> : never;
2970
3106
  }[number];
3107
+ type IncompatibleRecords<S extends Objects, Records extends StructWithRest.Records> = IncompatibleSideKeys<S, Records, "Type"> | IncompatibleSideKeys<S, Records, "Encoded"> | IncompatibleSideKeys<S, Records, "Iso"> | IncompatibleSideKeys<S, Records, "~type.make">;
2971
3108
  /**
2972
- * Validates that the records are compatible with the struct.
3109
+ * Checks whether fixed fields are compatible with the rest record schemas.
3110
+ *
3111
+ * **Details**
3112
+ *
3113
+ * Returns `true` when all fixed fields can also satisfy the matching rest
3114
+ * index signatures. Returns a diagnostic object when TypeScript would make
3115
+ * the resulting intersection too narrow for one or more fixed keys.
3116
+ *
3117
+ * **Example** (Checking record compatibility)
3118
+ *
3119
+ * ```ts
3120
+ * import { Schema } from "effect"
3121
+ *
3122
+ * const user = Schema.Struct({ id: Schema.String })
3123
+ * const stringExtras = [Schema.Record(Schema.String, Schema.String)] as const
3124
+ *
3125
+ * type UserCheck = Schema.StructWithRest.ValidateRecords<typeof user, typeof stringExtras>
3126
+ *
3127
+ * const userCheck: UserCheck = true
3128
+ * void userCheck
3129
+ *
3130
+ * const counter = Schema.Struct({ count: Schema.NumberFromString })
3131
+ *
3132
+ * type CounterCheck = Schema.StructWithRest.ValidateRecords<typeof counter, typeof stringExtras>
3133
+ * // ^? { "incompatible index signatures": "count" }
3134
+ *
3135
+ * const counterCheck = null as unknown as CounterCheck
3136
+ * void counterCheck
3137
+ * ```
2973
3138
  *
2974
3139
  * @category utility types
2975
3140
  * @since 4.0.0
2976
3141
  */
2977
- type ValidateRecords<S extends Objects, Records extends StructWithRest.Records> = [
2978
- IncompatibleSideKeys<S, Records, "Type"> | IncompatibleSideKeys<S, Records, "Encoded"> | IncompatibleSideKeys<S, Records, "Iso"> | IncompatibleSideKeys<S, Records, "~type.make">
2979
- ] extends [never] ? unknown : {
2980
- "incompatible index signatures": IncompatibleSideKeys<S, Records, "Type"> | IncompatibleSideKeys<S, Records, "Encoded"> | IncompatibleSideKeys<S, Records, "Iso"> | IncompatibleSideKeys<S, Records, "~type.make">;
3142
+ type ValidateRecords<S extends Objects, Records extends StructWithRest.Records> = [IncompatibleRecords<S, Records>] extends [never] ? true : {
3143
+ "incompatible index signatures": IncompatibleRecords<S, Records>;
2981
3144
  };
2982
3145
  }
2983
3146
  /**
@@ -2986,7 +3149,14 @@ export declare namespace StructWithRest {
2986
3149
  * @category models
2987
3150
  * @since 4.0.0
2988
3151
  */
2989
- export interface StructWithRest<S extends StructWithRest.Objects, Records extends StructWithRest.Records> extends Bottom<Simplify<StructWithRest.Type<S, Records>>, Simplify<StructWithRest.Encoded<S, Records>>, StructWithRest.DecodingServices<S, Records>, StructWithRest.EncodingServices<S, Records>, SchemaAST.Objects, StructWithRest<S, Records>, Simplify<StructWithRest.MakeIn<S, Records>>, Simplify<StructWithRest.Iso<S, Records>>> {
3152
+ export interface StructWithRest<S extends StructWithRest.Objects, Records extends StructWithRest.Records> extends BottomLazy<SchemaAST.Objects, StructWithRest<S, Records>> {
3153
+ readonly "Type": Simplify<StructWithRest.Type<S, Records>>;
3154
+ readonly "Encoded": Simplify<StructWithRest.Encoded<S, Records>>;
3155
+ readonly "DecodingServices": StructWithRest.DecodingServices<S, Records>;
3156
+ readonly "EncodingServices": StructWithRest.EncodingServices<S, Records>;
3157
+ readonly "~type.make.in": Simplify<StructWithRest.MakeIn<S, Records>>;
3158
+ readonly "~type.make": Simplify<StructWithRest.MakeIn<S, Records>>;
3159
+ readonly "Iso": Simplify<StructWithRest.Iso<S, Records>>;
2990
3160
  readonly schema: S;
2991
3161
  readonly records: Records;
2992
3162
  }
@@ -2994,6 +3164,13 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
2994
3164
  * Extends a struct schema with one or more record (index-signature) schemas,
2995
3165
  * producing a schema whose decoded type intersects the struct and all records.
2996
3166
  *
3167
+ * **Gotchas**
3168
+ *
3169
+ * TypeScript index signatures also apply to fixed keys. `StructWithRest` does
3170
+ * not reject incompatible fixed fields at the call site; use
3171
+ * `StructWithRest.ValidateRecords` when you want an explicit type-level
3172
+ * compatibility check.
3173
+ *
2997
3174
  * **Example** (Defining structs with string-indexed extra keys)
2998
3175
  *
2999
3176
  * ```ts
@@ -3011,7 +3188,7 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
3011
3188
  * @category constructors
3012
3189
  * @since 4.0.0
3013
3190
  */
3014
- export declare function StructWithRest<const S extends StructWithRest.Objects, const Records extends StructWithRest.Records>(schema: S, records: Records & StructWithRest.ValidateRecords<S, Records>): StructWithRest<S, Records>;
3191
+ export declare function StructWithRest<const S extends StructWithRest.Objects, const Records extends StructWithRest.Records>(schema: S, records: Records): StructWithRest<S, Records>;
3015
3192
  /**
3016
3193
  * Namespace for `Tuple` type utilities.
3017
3194
  *
@@ -3032,7 +3209,7 @@ export declare namespace Tuple {
3032
3209
  * @category utility types
3033
3210
  * @since 3.10.0
3034
3211
  */
3035
- type Elements = ReadonlyArray<Top>;
3212
+ type Elements = ReadonlyArray<Constraint>;
3036
3213
  type Type_<Elements, Out extends ReadonlyArray<any> = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends {
3037
3214
  readonly "Type": infer T;
3038
3215
  } ? Head extends {
@@ -3122,7 +3299,14 @@ export declare namespace Tuple {
3122
3299
  * @category models
3123
3300
  * @since 3.10.0
3124
3301
  */
3125
- export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Type<Elements>, Tuple.Encoded<Elements>, Tuple.DecodingServices<Elements>, Tuple.EncodingServices<Elements>, SchemaAST.Arrays, Tuple<Elements>, Tuple.MakeIn<Elements>, Tuple.Iso<Elements>> {
3302
+ export interface Tuple<Elements extends Tuple.Elements> extends BottomLazy<SchemaAST.Arrays, Tuple<Elements>> {
3303
+ readonly "Type": Tuple.Type<Elements>;
3304
+ readonly "Encoded": Tuple.Encoded<Elements>;
3305
+ readonly "DecodingServices": Tuple.DecodingServices<Elements>;
3306
+ readonly "EncodingServices": Tuple.EncodingServices<Elements>;
3307
+ readonly "~type.make.in": Tuple.MakeIn<Elements>;
3308
+ readonly "~type.make": Tuple.MakeIn<Elements>;
3309
+ readonly "Iso": Tuple.Iso<Elements>;
3126
3310
  readonly elements: Elements;
3127
3311
  /**
3128
3312
  * Returns a new tuple with the elements modified by the provided function.
@@ -3162,7 +3346,7 @@ export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Typ
3162
3346
  * @category constructors
3163
3347
  * @since 3.10.0
3164
3348
  */
3165
- export declare function Tuple<const Elements extends ReadonlyArray<Top>>(elements: Elements): Tuple<Elements>;
3349
+ export declare function Tuple<const Elements extends ReadonlyArray<Constraint>>(elements: Elements): Tuple<Elements>;
3166
3350
  /**
3167
3351
  * Namespace for `TupleWithRest` type utilities.
3168
3352
  *
@@ -3183,7 +3367,7 @@ export declare namespace TupleWithRest {
3183
3367
  * @category utility types
3184
3368
  * @since 3.10.0
3185
3369
  */
3186
- type TupleType = Top & {
3370
+ type TupleType = Constraint & {
3187
3371
  readonly Type: ReadonlyArray<unknown>;
3188
3372
  readonly Encoded: ReadonlyArray<unknown>;
3189
3373
  readonly ast: SchemaAST.Arrays;
@@ -3201,7 +3385,7 @@ export declare namespace TupleWithRest {
3201
3385
  * @category utility types
3202
3386
  * @since 3.10.0
3203
3387
  */
3204
- type Rest = readonly [Top, ...Array<Top>];
3388
+ type Rest = readonly [Constraint, ...Array<Constraint>];
3205
3389
  /**
3206
3390
  * Computes the decoded tuple type for a `TupleWithRest`.
3207
3391
  *
@@ -3214,7 +3398,7 @@ export declare namespace TupleWithRest {
3214
3398
  * @category utility types
3215
3399
  * @since 3.10.0
3216
3400
  */
3217
- type Type<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray<Top>] ? Readonly<[
3401
+ type Type<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? Readonly<[
3218
3402
  ...T,
3219
3403
  ...Array<Head["Type"]>,
3220
3404
  ...{
@@ -3233,7 +3417,7 @@ export declare namespace TupleWithRest {
3233
3417
  * @category utility types
3234
3418
  * @since 4.0.0
3235
3419
  */
3236
- type Iso<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray<Top>] ? Readonly<[
3420
+ type Iso<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? Readonly<[
3237
3421
  ...T,
3238
3422
  ...Array<Head["Iso"]>,
3239
3423
  ...{
@@ -3252,7 +3436,7 @@ export declare namespace TupleWithRest {
3252
3436
  * @category utility types
3253
3437
  * @since 3.10.0
3254
3438
  */
3255
- type Encoded<E extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray<Top>] ? readonly [
3439
+ type Encoded<E extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? readonly [
3256
3440
  ...E,
3257
3441
  ...Array<Head["Encoded"]>,
3258
3442
  ...{
@@ -3271,7 +3455,7 @@ export declare namespace TupleWithRest {
3271
3455
  * @category utility types
3272
3456
  * @since 4.0.0
3273
3457
  */
3274
- type MakeIn<M extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Top, ...infer Tail extends ReadonlyArray<Top>] ? readonly [
3458
+ type MakeIn<M extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? readonly [
3275
3459
  ...M,
3276
3460
  ...Array<Head["~type.make"]>,
3277
3461
  ...{
@@ -3285,7 +3469,14 @@ export declare namespace TupleWithRest {
3285
3469
  * @category models
3286
3470
  * @since 4.0.0
3287
3471
  */
3288
- export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends TupleWithRest.Rest> extends Bottom<TupleWithRest.Type<S["Type"], Rest>, TupleWithRest.Encoded<S["Encoded"], Rest>, S["DecodingServices"] | Rest[number]["DecodingServices"], S["EncodingServices"] | Rest[number]["EncodingServices"], SchemaAST.Arrays, TupleWithRest<S, Rest>, TupleWithRest.MakeIn<S["~type.make"], Rest>, TupleWithRest.Iso<S["Iso"], Rest>> {
3472
+ export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends TupleWithRest.Rest> extends BottomLazy<SchemaAST.Arrays, TupleWithRest<S, Rest>> {
3473
+ readonly "Type": TupleWithRest.Type<S["Type"], Rest>;
3474
+ readonly "Encoded": TupleWithRest.Encoded<S["Encoded"], Rest>;
3475
+ readonly "DecodingServices": S["DecodingServices"] | Rest[number]["DecodingServices"];
3476
+ readonly "EncodingServices": S["EncodingServices"] | Rest[number]["EncodingServices"];
3477
+ readonly "~type.make.in": TupleWithRest.MakeIn<S["~type.make"], Rest>;
3478
+ readonly "~type.make": TupleWithRest.MakeIn<S["~type.make"], Rest>;
3479
+ readonly "Iso": TupleWithRest.Iso<S["Iso"], Rest>;
3289
3480
  readonly schema: S;
3290
3481
  readonly rest: Rest;
3291
3482
  }
@@ -3326,12 +3517,19 @@ export declare function TupleWithRest<S extends Tuple<Tuple.Elements>, const Res
3326
3517
  * @category models
3327
3518
  * @since 4.0.0
3328
3519
  */
3329
- export interface $Array<S extends Top> extends Bottom<ReadonlyArray<S["Type"]>, ReadonlyArray<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"], SchemaAST.Arrays, $Array<S>, ReadonlyArray<S["~type.make"]>, ReadonlyArray<S["Iso"]>> {
3520
+ export interface $Array<S extends Constraint> extends BottomLazy<SchemaAST.Arrays, $Array<S>> {
3521
+ readonly "Type": ReadonlyArray<S["Type"]>;
3522
+ readonly "Encoded": ReadonlyArray<S["Encoded"]>;
3523
+ readonly "DecodingServices": S["DecodingServices"];
3524
+ readonly "EncodingServices": S["EncodingServices"];
3525
+ readonly "~type.make.in": ReadonlyArray<S["~type.make"]>;
3526
+ readonly "~type.make": ReadonlyArray<S["~type.make"]>;
3527
+ readonly "Iso": ReadonlyArray<S["Iso"]>;
3330
3528
  readonly value: S;
3331
3529
  }
3332
3530
  interface ArrayLambda extends Lambda {
3333
- <S extends Top>(self: S): $Array<S>;
3334
- readonly "~lambda.out": this["~lambda.in"] extends Top ? $Array<this["~lambda.in"]> : never;
3531
+ <S extends Constraint>(self: S): $Array<S>;
3532
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? $Array<this["~lambda.in"]> : never;
3335
3533
  }
3336
3534
  /**
3337
3535
  * @category constructors
@@ -3364,12 +3562,19 @@ ArraySchema as Array };
3364
3562
  * @category models
3365
3563
  * @since 3.10.0
3366
3564
  */
3367
- export interface NonEmptyArray<S extends Top> extends Bottom<readonly [S["Type"], ...Array<S["Type"]>], readonly [S["Encoded"], ...Array<S["Encoded"]>], S["DecodingServices"], S["EncodingServices"], SchemaAST.Arrays, NonEmptyArray<S>, readonly [S["~type.make"], ...Array<S["~type.make"]>], readonly [S["Iso"], ...Array<S["Iso"]>]> {
3565
+ export interface NonEmptyArray<S extends Constraint> extends BottomLazy<SchemaAST.Arrays, NonEmptyArray<S>> {
3566
+ readonly "Type": readonly [S["Type"], ...Array<S["Type"]>];
3567
+ readonly "Encoded": readonly [S["Encoded"], ...Array<S["Encoded"]>];
3568
+ readonly "DecodingServices": S["DecodingServices"];
3569
+ readonly "EncodingServices": S["EncodingServices"];
3570
+ readonly "~type.make.in": readonly [S["~type.make"], ...Array<S["~type.make"]>];
3571
+ readonly "~type.make": readonly [S["~type.make"], ...Array<S["~type.make"]>];
3572
+ readonly "Iso": readonly [S["Iso"], ...Array<S["Iso"]>];
3368
3573
  readonly value: S;
3369
3574
  }
3370
3575
  interface NonEmptyArrayLambda extends Lambda {
3371
- <S extends Top>(self: S): NonEmptyArray<S>;
3372
- readonly "~lambda.out": this["~lambda.in"] extends Top ? NonEmptyArray<this["~lambda.in"]> : never;
3576
+ <S extends Constraint>(self: S): NonEmptyArray<S>;
3577
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NonEmptyArray<this["~lambda.in"]> : never;
3373
3578
  }
3374
3579
  /**
3375
3580
  * Defines a non-empty `ReadonlyArray` schema — at least one element required.
@@ -3396,7 +3601,7 @@ export declare const NonEmptyArray: NonEmptyArrayLambda;
3396
3601
  * @category constructors
3397
3602
  * @since 3.10.0
3398
3603
  */
3399
- export interface ArrayEnsure<S extends Top> extends decodeTo<$Array<toType<S>>, Union<readonly [S, $Array<S>]>> {
3604
+ export interface ArrayEnsure<S extends Constraint> extends decodeTo<$Array<toType<S>>, Union<readonly [S, $Array<S>]>> {
3400
3605
  readonly "Rebuild": ArrayEnsure<S>;
3401
3606
  }
3402
3607
  /**
@@ -3425,14 +3630,14 @@ export interface ArrayEnsure<S extends Top> extends decodeTo<$Array<toType<S>>,
3425
3630
  * @category constructors
3426
3631
  * @since 3.10.0
3427
3632
  */
3428
- export declare function ArrayEnsure<S extends Top>(schema: S): ArrayEnsure<S>;
3633
+ export declare function ArrayEnsure<S extends Constraint>(schema: S): ArrayEnsure<S>;
3429
3634
  /**
3430
3635
  * Type-level representation returned by {@link UniqueArray}.
3431
3636
  *
3432
3637
  * @category models
3433
3638
  * @since 4.0.0
3434
3639
  */
3435
- export interface UniqueArray<S extends Top> extends $Array<S> {
3640
+ export interface UniqueArray<S extends Constraint> extends $Array<S> {
3436
3641
  readonly "Rebuild": UniqueArray<S>;
3437
3642
  }
3438
3643
  /**
@@ -3446,23 +3651,30 @@ export interface UniqueArray<S extends Top> extends $Array<S> {
3446
3651
  * @category constructors
3447
3652
  * @since 4.0.0
3448
3653
  */
3449
- export declare function UniqueArray<S extends Top>(item: S): UniqueArray<S>;
3654
+ export declare function UniqueArray<S extends Constraint>(item: S): UniqueArray<S>;
3450
3655
  /**
3451
3656
  * Type-level representation returned by {@link mutable}.
3452
3657
  *
3453
3658
  * @category transforming
3454
3659
  * @since 3.10.0
3455
3660
  */
3456
- export interface mutable<S extends Top & {
3661
+ export interface mutable<S extends Constraint & {
3457
3662
  readonly "ast": SchemaAST.Arrays;
3458
- }> extends Bottom<Mutable<S["Type"]>, Mutable<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"], S["ast"], mutable<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3663
+ }> extends BottomLazy<S["ast"], mutable<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3664
+ readonly "Type": Mutable<S["Type"]>;
3665
+ readonly "Encoded": Mutable<S["Encoded"]>;
3666
+ readonly "DecodingServices": S["DecodingServices"];
3667
+ readonly "EncodingServices": S["EncodingServices"];
3668
+ readonly "~type.make.in": S["~type.make.in"];
3669
+ readonly "~type.make": S["~type.make"];
3670
+ readonly "Iso": S["Iso"];
3459
3671
  readonly schema: S;
3460
3672
  }
3461
3673
  interface mutableLambda extends Lambda {
3462
- <S extends Top & {
3674
+ <S extends Constraint & {
3463
3675
  readonly "ast": SchemaAST.Arrays;
3464
3676
  }>(self: S): mutable<S>;
3465
- readonly "~lambda.out": this["~lambda.in"] extends Top & {
3677
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint & {
3466
3678
  readonly "ast": SchemaAST.Arrays;
3467
3679
  } ? mutable<this["~lambda.in"]> : "Error: schema not eligible for mutable";
3468
3680
  }
@@ -3490,21 +3702,30 @@ export declare const mutable: mutableLambda;
3490
3702
  * @category models
3491
3703
  * @since 3.10.0
3492
3704
  */
3493
- export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
3494
- [K in keyof Members]: Members[K]["Type"];
3495
- }[number], {
3496
- [K in keyof Members]: Members[K]["Encoded"];
3497
- }[number], {
3498
- [K in keyof Members]: Members[K]["DecodingServices"];
3499
- }[number], {
3500
- [K in keyof Members]: Members[K]["EncodingServices"];
3501
- }[number], SchemaAST.Union<{
3705
+ export interface Union<Members extends ReadonlyArray<Constraint>> extends BottomLazy<SchemaAST.Union<{
3502
3706
  [K in keyof Members]: Members[K]["ast"];
3503
- }[number]>, Union<Members>, {
3504
- [K in keyof Members]: Members[K]["~type.make"];
3505
- }[number], {
3506
- [K in keyof Members]: Members[K]["Iso"];
3507
- }[number]> {
3707
+ }[number]>, Union<Members>> {
3708
+ readonly "Type": {
3709
+ [K in keyof Members]: Members[K]["Type"];
3710
+ }[number];
3711
+ readonly "Encoded": {
3712
+ [K in keyof Members]: Members[K]["Encoded"];
3713
+ }[number];
3714
+ readonly "DecodingServices": {
3715
+ [K in keyof Members]: Members[K]["DecodingServices"];
3716
+ }[number];
3717
+ readonly "EncodingServices": {
3718
+ [K in keyof Members]: Members[K]["EncodingServices"];
3719
+ }[number];
3720
+ readonly "~type.make.in": {
3721
+ [K in keyof Members]: Members[K]["~type.make"];
3722
+ }[number];
3723
+ readonly "~type.make": {
3724
+ [K in keyof Members]: Members[K]["~type.make"];
3725
+ }[number];
3726
+ readonly "Iso": {
3727
+ [K in keyof Members]: Members[K]["Iso"];
3728
+ }[number];
3508
3729
  readonly members: Members;
3509
3730
  /**
3510
3731
  * Returns a new union with the members modified by the provided function.
@@ -3522,7 +3743,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
3522
3743
  * use this option if you have verified that your refinements remain correct
3523
3744
  * after the transformation.
3524
3745
  */
3525
- mapMembers<To extends ReadonlyArray<Top>>(f: (members: Members) => To, options?: {
3746
+ mapMembers<To extends ReadonlyArray<Constraint>>(f: (members: Members) => To, options?: {
3526
3747
  readonly unsafePreserveChecks?: boolean | undefined;
3527
3748
  } | undefined): Union<Simplify<Readonly<To>>>;
3528
3749
  }
@@ -3550,7 +3771,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
3550
3771
  * @category constructors
3551
3772
  * @since 3.10.0
3552
3773
  */
3553
- export declare function Union<const Members extends ReadonlyArray<Top>>(members: Members, options?: {
3774
+ export declare function Union<const Members extends ReadonlyArray<Constraint>>(members: Members, options?: {
3554
3775
  mode?: "anyOf" | "oneOf";
3555
3776
  }): Union<Members>;
3556
3777
  /**
@@ -3567,7 +3788,7 @@ export interface Literals<L extends ReadonlyArray<SchemaAST.LiteralValue>> exten
3567
3788
  /**
3568
3789
  * Map over the members of the union.
3569
3790
  */
3570
- mapMembers<To extends ReadonlyArray<Top>>(f: (members: this["members"]) => To): Union<Simplify<Readonly<To>>>;
3791
+ mapMembers<To extends ReadonlyArray<Constraint>>(f: (members: this["members"]) => To): Union<Simplify<Readonly<To>>>;
3571
3792
  pick<const L2 extends ReadonlyArray<L[number]>>(literals: L2): Literals<L2>;
3572
3793
  transform<const L2 extends {
3573
3794
  readonly [I in keyof L]: SchemaAST.LiteralValue;
@@ -3598,12 +3819,12 @@ export declare function Literals<const L extends ReadonlyArray<SchemaAST.Literal
3598
3819
  * @category models
3599
3820
  * @since 3.10.0
3600
3821
  */
3601
- export interface NullOr<S extends Top> extends Union<readonly [S, Null]> {
3822
+ export interface NullOr<S extends Constraint> extends Union<readonly [S, Null]> {
3602
3823
  readonly "Rebuild": NullOr<S>;
3603
3824
  }
3604
3825
  interface NullOrLambda extends Lambda {
3605
- <S extends Top>(self: S): NullOr<S>;
3606
- readonly "~lambda.out": this["~lambda.in"] extends Top ? NullOr<this["~lambda.in"]> : never;
3826
+ <S extends Constraint>(self: S): NullOr<S>;
3827
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NullOr<this["~lambda.in"]> : never;
3607
3828
  }
3608
3829
  /**
3609
3830
  * Creates a union schema of `S | null`.
@@ -3618,12 +3839,12 @@ export declare const NullOr: NullOrLambda;
3618
3839
  * @category models
3619
3840
  * @since 3.10.0
3620
3841
  */
3621
- export interface UndefinedOr<S extends Top> extends Union<readonly [S, Undefined]> {
3842
+ export interface UndefinedOr<S extends Constraint> extends Union<readonly [S, Undefined]> {
3622
3843
  readonly "Rebuild": UndefinedOr<S>;
3623
3844
  }
3624
3845
  interface UndefinedOrLambda extends Lambda {
3625
- <S extends Top>(self: S): UndefinedOr<S>;
3626
- readonly "~lambda.out": this["~lambda.in"] extends Top ? UndefinedOr<this["~lambda.in"]> : never;
3846
+ <S extends Constraint>(self: S): UndefinedOr<S>;
3847
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? UndefinedOr<this["~lambda.in"]> : never;
3627
3848
  }
3628
3849
  /**
3629
3850
  * Creates a union schema of `S | undefined`.
@@ -3638,12 +3859,12 @@ export declare const UndefinedOr: UndefinedOrLambda;
3638
3859
  * @category models
3639
3860
  * @since 3.10.0
3640
3861
  */
3641
- export interface NullishOr<S extends Top> extends Union<readonly [S, Null, Undefined]> {
3862
+ export interface NullishOr<S extends Constraint> extends Union<readonly [S, Null, Undefined]> {
3642
3863
  readonly "Rebuild": NullishOr<S>;
3643
3864
  }
3644
3865
  interface NullishOrLambda extends Lambda {
3645
- <S extends Top>(self: S): NullishOr<S>;
3646
- readonly "~lambda.out": this["~lambda.in"] extends Top ? NullishOr<this["~lambda.in"]> : never;
3866
+ <S extends Constraint>(self: S): NullishOr<S>;
3867
+ readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NullishOr<this["~lambda.in"]> : never;
3647
3868
  }
3648
3869
  /**
3649
3870
  * Creates a union schema of `S | null | undefined`.
@@ -3658,7 +3879,14 @@ export declare const NullishOr: NullishOrLambda;
3658
3879
  * @category models
3659
3880
  * @since 3.10.0
3660
3881
  */
3661
- export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], SchemaAST.Suspend, suspend<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3882
+ export interface suspend<S extends Constraint> extends BottomLazy<SchemaAST.Suspend, suspend<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3883
+ readonly "Type": S["Type"];
3884
+ readonly "Encoded": S["Encoded"];
3885
+ readonly "DecodingServices": S["DecodingServices"];
3886
+ readonly "EncodingServices": S["EncodingServices"];
3887
+ readonly "~type.make.in": S["~type.make.in"];
3888
+ readonly "~type.make": S["~type.make"];
3889
+ readonly "Iso": S["Iso"];
3662
3890
  }
3663
3891
  /**
3664
3892
  * Creates a suspended schema that defers evaluation until needed. This is
@@ -3684,7 +3912,7 @@ export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"],
3684
3912
  * @category constructors
3685
3913
  * @since 3.10.0
3686
3914
  */
3687
- export declare function suspend<S extends Top>(f: () => S): suspend<S>;
3915
+ export declare function suspend<S extends Constraint>(f: () => S): suspend<S>;
3688
3916
  /**
3689
3917
  * Attaches one or more filter checks to a schema without changing the
3690
3918
  * TypeScript type.
@@ -3709,7 +3937,14 @@ export declare function check<S extends Top>(...checks: readonly [SchemaAST.Chec
3709
3937
  * @category filtering
3710
3938
  * @since 3.10.0
3711
3939
  */
3712
- export interface refine<T extends S["Type"], S extends Top> extends Bottom<T, S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], refine<T, S>, S["~type.make.in"], T, S["~type.parameters"], T, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3940
+ export interface refine<T extends S["Type"], S extends Constraint> extends BottomLazy<S["ast"], refine<T, S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3941
+ readonly "Type": T;
3942
+ readonly "Encoded": S["Encoded"];
3943
+ readonly "DecodingServices": S["DecodingServices"];
3944
+ readonly "EncodingServices": S["EncodingServices"];
3945
+ readonly "~type.make.in": S["~type.make.in"];
3946
+ readonly "~type.make": T;
3947
+ readonly "Iso": T;
3713
3948
  readonly schema: S;
3714
3949
  }
3715
3950
  /**
@@ -3727,7 +3962,7 @@ export interface refine<T extends S["Type"], S extends Top> extends Bottom<T, S[
3727
3962
  * @category filtering
3728
3963
  * @since 3.10.0
3729
3964
  */
3730
- export declare function refine<S extends Top, T extends S["Type"]>(refinement: (value: S["Type"]) => value is T, annotations?: Annotations.Filter): (schema: S) => refine<T, S>;
3965
+ export declare function refine<S extends Constraint, T extends S["Type"]>(refinement: (value: S["Type"]) => value is T, annotations?: Annotations.Filter): (schema: S) => refine<T, S>;
3731
3966
  type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string ? Brand.Brand<U> : never>;
3732
3967
  /**
3733
3968
  * Type-level representation returned by {@link brand}.
@@ -3735,7 +3970,14 @@ type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string
3735
3970
  * @category branding
3736
3971
  * @since 3.10.0
3737
3972
  */
3738
- export interface brand<S extends Top, B> extends Bottom<S["Type"] & DistributeBrands<B>, S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], brand<S, B>, S["~type.make.in"], S["Type"] & DistributeBrands<B>, S["~type.parameters"], S["Type"] & DistributeBrands<B>, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3973
+ export interface brand<S extends Constraint, B> extends BottomLazy<S["ast"], brand<S, B>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
3974
+ readonly "Type": S["Type"] & DistributeBrands<B>;
3975
+ readonly "Encoded": S["Encoded"];
3976
+ readonly "DecodingServices": S["DecodingServices"];
3977
+ readonly "EncodingServices": S["EncodingServices"];
3978
+ readonly "~type.make.in": S["~type.make.in"];
3979
+ readonly "~type.make": S["Type"] & DistributeBrands<B>;
3980
+ readonly "Iso": S["Type"] & DistributeBrands<B>;
3739
3981
  readonly schema: S;
3740
3982
  readonly identifier: string;
3741
3983
  }
@@ -3758,7 +4000,7 @@ export interface brand<S extends Top, B> extends Bottom<S["Type"] & DistributeBr
3758
4000
  * @category branding
3759
4001
  * @since 3.10.0
3760
4002
  */
3761
- export declare function brand<B extends string>(identifier: B): <S extends Top>(schema: S) => brand<S["Rebuild"], B>;
4003
+ export declare function brand<B extends string>(identifier: B): <S extends ConstraintRebuildable>(schema: S) => brand<S["Rebuild"], B>;
3762
4004
  /**
3763
4005
  * Creates a branded schema from a {@link Brand.Constructor}, applying the
3764
4006
  * constructor's checks and brand tag to the underlying schema.
@@ -3775,7 +4017,14 @@ export declare function fromBrand<A extends Brand.Brand<any>>(identifier: string
3775
4017
  * @category decoding
3776
4018
  * @since 4.0.0
3777
4019
  */
3778
- export interface middlewareDecoding<S extends Top, RD> extends Bottom<S["Type"], S["Encoded"], RD, S["EncodingServices"], S["ast"], middlewareDecoding<S, RD>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4020
+ export interface middlewareDecoding<S extends Constraint, RD> extends BottomLazy<S["ast"], middlewareDecoding<S, RD>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4021
+ readonly "Type": S["Type"];
4022
+ readonly "Encoded": S["Encoded"];
4023
+ readonly "DecodingServices": RD;
4024
+ readonly "EncodingServices": S["EncodingServices"];
4025
+ readonly "~type.make.in": S["~type.make.in"];
4026
+ readonly "~type.make": S["~type.make"];
4027
+ readonly "Iso": S["Iso"];
3779
4028
  readonly schema: S;
3780
4029
  }
3781
4030
  /**
@@ -3803,14 +4052,21 @@ export interface middlewareDecoding<S extends Top, RD> extends Bottom<S["Type"],
3803
4052
  * @category decoding
3804
4053
  * @since 4.0.0
3805
4054
  */
3806
- export declare function middlewareDecoding<S extends Top, RD>(decode: (effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>): (schema: S) => middlewareDecoding<S, RD>;
4055
+ export declare function middlewareDecoding<S extends Constraint, RD>(decode: (effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>): (schema: S) => middlewareDecoding<S, RD>;
3807
4056
  /**
3808
4057
  * Type-level representation returned by {@link middlewareEncoding}.
3809
4058
  *
3810
4059
  * @category encoding
3811
4060
  * @since 4.0.0
3812
4061
  */
3813
- export interface middlewareEncoding<S extends Top, RE> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], RE, S["ast"], middlewareEncoding<S, RE>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4062
+ export interface middlewareEncoding<S extends Constraint, RE> extends BottomLazy<S["ast"], middlewareEncoding<S, RE>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4063
+ readonly "Type": S["Type"];
4064
+ readonly "Encoded": S["Encoded"];
4065
+ readonly "DecodingServices": S["DecodingServices"];
4066
+ readonly "EncodingServices": RE;
4067
+ readonly "~type.make.in": S["~type.make.in"];
4068
+ readonly "~type.make": S["~type.make"];
4069
+ readonly "Iso": S["Iso"];
3814
4070
  readonly schema: S;
3815
4071
  }
3816
4072
  /**
@@ -3838,7 +4094,7 @@ export interface middlewareEncoding<S extends Top, RE> extends Bottom<S["Type"],
3838
4094
  * @category encoding
3839
4095
  * @since 4.0.0
3840
4096
  */
3841
- export declare function middlewareEncoding<S extends Top, RE>(encode: (effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE>): (schema: S) => middlewareEncoding<S, RE>;
4097
+ export declare function middlewareEncoding<S extends Constraint, RE>(encode: (effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE>): (schema: S) => middlewareEncoding<S, RE>;
3842
4098
  /**
3843
4099
  * Recovers from a decoding error by providing a fallback value.
3844
4100
  *
@@ -3861,7 +4117,7 @@ export declare function middlewareEncoding<S extends Top, RE>(encode: (effect: E
3861
4117
  * @category error handling
3862
4118
  * @since 4.0.0
3863
4119
  */
3864
- export declare function catchDecoding<S extends Top>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue>): (self: S) => S["Rebuild"];
4120
+ export declare function catchDecoding<S extends Constraint>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue>): (self: S) => middlewareDecoding<S, S["DecodingServices"]>;
3865
4121
  /**
3866
4122
  * Recovers from a decoding error with a handler that may require Effect services.
3867
4123
  *
@@ -3882,7 +4138,7 @@ export declare function catchDecoding<S extends Top>(f: (issue: SchemaIssue.Issu
3882
4138
  * @category error handling
3883
4139
  * @since 4.0.0
3884
4140
  */
3885
- export declare function catchDecodingWithContext<S extends Top, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>): (self: S) => middlewareDecoding<S, S["DecodingServices"] | R>;
4141
+ export declare function catchDecodingWithContext<S extends Constraint, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>): (self: S) => middlewareDecoding<S, S["DecodingServices"] | R>;
3886
4142
  /**
3887
4143
  * Recovers from an encoding error by providing a fallback value.
3888
4144
  *
@@ -3895,7 +4151,7 @@ export declare function catchDecodingWithContext<S extends Top, R = never>(f: (i
3895
4151
  * @category error handling
3896
4152
  * @since 4.0.0
3897
4153
  */
3898
- export declare function catchEncoding<S extends Top>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue>): (self: S) => S["Rebuild"];
4154
+ export declare function catchEncoding<S extends Constraint>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue>): (self: S) => middlewareEncoding<S, S["EncodingServices"]>;
3899
4155
  /**
3900
4156
  * Recovers from an encoding error with a handler that may require Effect services.
3901
4157
  *
@@ -3916,14 +4172,21 @@ export declare function catchEncoding<S extends Top>(f: (issue: SchemaIssue.Issu
3916
4172
  * @category error handling
3917
4173
  * @since 4.0.0
3918
4174
  */
3919
- export declare function catchEncodingWithContext<S extends Top, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, R>): (self: S) => middlewareEncoding<S, S["EncodingServices"] | R>;
4175
+ export declare function catchEncodingWithContext<S extends Constraint, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, R>): (self: S) => middlewareEncoding<S, S["EncodingServices"] | R>;
3920
4176
  /**
3921
4177
  * Type-level representation returned by {@link decodeTo}.
3922
4178
  *
3923
4179
  * @category transforming
3924
4180
  * @since 4.0.0
3925
4181
  */
3926
- export interface decodeTo<To extends Top, From extends Top, RD = never, RE = never> extends Bottom<To["Type"], From["Encoded"], To["DecodingServices"] | From["DecodingServices"] | RD, To["EncodingServices"] | From["EncodingServices"] | RE, To["ast"], decodeTo<To, From, RD, RE>, To["~type.make.in"], To["Iso"], To["~type.parameters"], To["~type.make"], To["~type.mutability"], To["~type.optionality"], To["~type.constructor.default"], From["~encoded.mutability"], From["~encoded.optionality"]> {
4182
+ export interface decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never> extends BottomLazy<To["ast"], decodeTo<To, From, RD, RE>, To["~type.parameters"], To["~type.mutability"], To["~type.optionality"], To["~type.constructor.default"], From["~encoded.mutability"], From["~encoded.optionality"]> {
4183
+ readonly "Type": To["Type"];
4184
+ readonly "Encoded": From["Encoded"];
4185
+ readonly "DecodingServices": To["DecodingServices"] | From["DecodingServices"] | RD;
4186
+ readonly "EncodingServices": To["EncodingServices"] | From["EncodingServices"] | RE;
4187
+ readonly "~type.make.in": To["~type.make.in"];
4188
+ readonly "~type.make": To["~type.make"];
4189
+ readonly "Iso": To["Iso"];
3927
4190
  readonly from: From;
3928
4191
  readonly to: To;
3929
4192
  }
@@ -3933,7 +4196,7 @@ export interface decodeTo<To extends Top, From extends Top, RD = never, RE = nev
3933
4196
  * @category transforming
3934
4197
  * @since 3.10.0
3935
4198
  */
3936
- export interface compose<To extends Top, From extends Top> extends decodeTo<To, From> {
4199
+ export interface compose<To extends Constraint, From extends Constraint> extends decodeTo<To, From> {
3937
4200
  }
3938
4201
  /**
3939
4202
  * Creates a schema that transforms from a source schema to a target schema.
@@ -3983,8 +4246,8 @@ export interface compose<To extends Top, From extends Top> extends decodeTo<To,
3983
4246
  * @category transforming
3984
4247
  * @since 4.0.0
3985
4248
  */
3986
- export declare function decodeTo<To extends Top>(to: To): <From extends Top>(from: From) => compose<To, From>;
3987
- export declare function decodeTo<To extends Top, From extends Top, RD = never, RE = never>(to: To, transformation: {
4249
+ export declare function decodeTo<To extends Constraint>(to: To): <From extends Constraint>(from: From) => compose<To, From>;
4250
+ export declare function decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(to: To, transformation: {
3988
4251
  readonly decode: SchemaGetter.Getter<NoInfer<To["Encoded"]>, NoInfer<From["Type"]>, RD>;
3989
4252
  readonly encode: SchemaGetter.Getter<NoInfer<From["Type"]>, NoInfer<To["Encoded"]>, RE>;
3990
4253
  }): (from: From) => decodeTo<To, From, RD, RE>;
@@ -4031,7 +4294,7 @@ export declare function decodeTo<To extends Top, From extends Top, RD = never, R
4031
4294
  * @category transforming
4032
4295
  * @since 3.10.0
4033
4296
  */
4034
- export declare function decode<S extends Top, RD = never, RE = never>(transformation: {
4297
+ export declare function decode<S extends Constraint, RD = never, RE = never>(transformation: {
4035
4298
  readonly decode: SchemaGetter.Getter<S["Type"], S["Type"], RD>;
4036
4299
  readonly encode: SchemaGetter.Getter<S["Type"], S["Type"], RE>;
4037
4300
  }): (self: S) => decodeTo<toType<S>, S, RD, RE>;
@@ -4064,8 +4327,8 @@ export declare function decode<S extends Top, RD = never, RE = never>(transforma
4064
4327
  * @category transforming
4065
4328
  * @since 4.0.0
4066
4329
  */
4067
- export declare function encodeTo<To extends Top>(to: To): <From extends Top>(from: From) => decodeTo<From, To>;
4068
- export declare function encodeTo<To extends Top, From extends Top, RD = never, RE = never>(to: To, transformation: {
4330
+ export declare function encodeTo<To extends Constraint>(to: To): <From extends Constraint>(from: From) => decodeTo<From, To>;
4331
+ export declare function encodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(to: To, transformation: {
4069
4332
  readonly decode: SchemaGetter.Getter<NoInfer<From["Encoded"]>, NoInfer<To["Type"]>, RD>;
4070
4333
  readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, NoInfer<From["Encoded"]>, RE>;
4071
4334
  }): (from: From) => decodeTo<From, To, RD, RE>;
@@ -4094,7 +4357,7 @@ export declare function encodeTo<To extends Top, From extends Top, RD = never, R
4094
4357
  * @category transforming
4095
4358
  * @since 3.10.0
4096
4359
  */
4097
- export declare function encode<S extends Top, RD = never, RE = never>(transformation: {
4360
+ export declare function encode<S extends Constraint, RD = never, RE = never>(transformation: {
4098
4361
  readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>;
4099
4362
  readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE>;
4100
4363
  }): (self: S) => decodeTo<S, toEncoded<S>, RD, RE>;
@@ -4117,7 +4380,14 @@ export interface WithoutConstructorDefault {
4117
4380
  * @category constructors
4118
4381
  * @since 3.10.0
4119
4382
  */
4120
- export interface withConstructorDefault<S extends Top & WithoutConstructorDefault> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], withConstructorDefault<S>, S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], "with-default", S["~encoded.mutability"], S["~encoded.optionality"]> {
4383
+ export interface withConstructorDefault<S extends Constraint & WithoutConstructorDefault> extends BottomLazy<S["ast"], withConstructorDefault<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], "with-default", S["~encoded.mutability"], S["~encoded.optionality"]> {
4384
+ readonly "Type": S["Type"];
4385
+ readonly "Encoded": S["Encoded"];
4386
+ readonly "DecodingServices": S["DecodingServices"];
4387
+ readonly "EncodingServices": S["EncodingServices"];
4388
+ readonly "~type.make.in": S["~type.make.in"];
4389
+ readonly "~type.make": S["~type.make"];
4390
+ readonly "Iso": S["Iso"];
4121
4391
  readonly schema: S;
4122
4392
  }
4123
4393
  /**
@@ -4147,14 +4417,14 @@ export interface withConstructorDefault<S extends Top & WithoutConstructorDefaul
4147
4417
  * @category constructors
4148
4418
  * @since 3.10.0
4149
4419
  */
4150
- export declare function withConstructorDefault<S extends Top & WithoutConstructorDefault>(defaultValue: Effect.Effect<S["~type.make.in"], SchemaError>): (schema: S) => withConstructorDefault<S>;
4420
+ export declare function withConstructorDefault<S extends Constraint & WithoutConstructorDefault>(defaultValue: Effect.Effect<S["~type.make.in"], SchemaError>): (schema: S) => withConstructorDefault<S>;
4151
4421
  /**
4152
4422
  * Type-level representation returned by {@link withDecodingDefaultKey}.
4153
4423
  *
4154
4424
  * @category decoding
4155
4425
  * @since 4.0.0
4156
4426
  */
4157
- export interface withDecodingDefaultKey<S extends Top, R = never> extends decodeTo<S, optionalKey<toEncoded<S>>, R> {
4427
+ export interface withDecodingDefaultKey<S extends Constraint, R = never> extends decodeTo<S, optionalKey<toEncoded<S>>, R> {
4158
4428
  readonly "Rebuild": withDecodingDefaultKey<S, R>;
4159
4429
  }
4160
4430
  /**
@@ -4206,14 +4476,14 @@ export type DecodingDefaultOptions = {
4206
4476
  * @category decoding
4207
4477
  * @since 4.0.0
4208
4478
  */
4209
- export declare function withDecodingDefaultKey<S extends Top, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultKey<S, R>;
4479
+ export declare function withDecodingDefaultKey<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultKey<S, R>;
4210
4480
  /**
4211
4481
  * Type-level representation returned by {@link withDecodingDefaultTypeKey}.
4212
4482
  *
4213
4483
  * @category decoding
4214
4484
  * @since 4.0.0
4215
4485
  */
4216
- export interface withDecodingDefaultTypeKey<S extends Top, R = never> extends decodeTo<withDecodingDefaultKey<toType<S>, R>, optionalKey<S>> {
4486
+ export interface withDecodingDefaultTypeKey<S extends Constraint, R = never> extends decodeTo<withDecodingDefaultKey<toType<S>, R>, optionalKey<S>> {
4217
4487
  readonly "Rebuild": withDecodingDefaultTypeKey<S, R>;
4218
4488
  }
4219
4489
  /**
@@ -4238,14 +4508,14 @@ export interface withDecodingDefaultTypeKey<S extends Top, R = never> extends de
4238
4508
  * @category decoding
4239
4509
  * @since 4.0.0
4240
4510
  */
4241
- export declare function withDecodingDefaultTypeKey<S extends Top, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultTypeKey<S, R>;
4511
+ export declare function withDecodingDefaultTypeKey<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultTypeKey<S, R>;
4242
4512
  /**
4243
4513
  * Type-level representation returned by {@link withDecodingDefault}.
4244
4514
  *
4245
4515
  * @category decoding
4246
4516
  * @since 3.10.0
4247
4517
  */
4248
- export interface withDecodingDefault<S extends Top, R = never> extends decodeTo<S, optional<toEncoded<S>>, R> {
4518
+ export interface withDecodingDefault<S extends Constraint, R = never> extends decodeTo<S, optional<toEncoded<S>>, R> {
4249
4519
  readonly "Rebuild": withDecodingDefault<S, R>;
4250
4520
  }
4251
4521
  /**
@@ -4287,14 +4557,14 @@ export interface withDecodingDefault<S extends Top, R = never> extends decodeTo<
4287
4557
  * @category decoding
4288
4558
  * @since 3.10.0
4289
4559
  */
4290
- export declare function withDecodingDefault<S extends Top, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefault<S, R>;
4560
+ export declare function withDecodingDefault<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefault<S, R>;
4291
4561
  /**
4292
4562
  * Type-level representation returned by {@link withDecodingDefaultType}.
4293
4563
  *
4294
4564
  * @category decoding
4295
4565
  * @since 4.0.0
4296
4566
  */
4297
- export interface withDecodingDefaultType<S extends Top, R = never> extends decodeTo<withDecodingDefault<toType<S>, R>, optional<S>> {
4567
+ export interface withDecodingDefaultType<S extends Constraint, R = never> extends decodeTo<withDecodingDefault<toType<S>, R>, optional<S>> {
4298
4568
  readonly "Rebuild": withDecodingDefaultType<S, R>;
4299
4569
  }
4300
4570
  /**
@@ -4324,7 +4594,7 @@ export interface withDecodingDefaultType<S extends Top, R = never> extends decod
4324
4594
  * @category decoding
4325
4595
  * @since 4.0.0
4326
4596
  */
4327
- export declare function withDecodingDefaultType<S extends Top, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultType<S, R>;
4597
+ export declare function withDecodingDefaultType<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultType<S, R>;
4328
4598
  /**
4329
4599
  * Type-level representation returned by {@link tag}.
4330
4600
  *
@@ -4449,11 +4719,11 @@ export declare function TaggedStruct<const Tag extends SchemaAST.LiteralValue, c
4449
4719
  * Recursively flatten any nested Schema.Union members into a single tuple of leaf schemas.
4450
4720
  */
4451
4721
  type Flatten<Schemas> = Schemas extends readonly [infer Head, ...infer Tail] ? Head extends Union<infer Inner> ? [...Flatten<Inner>, ...Flatten<Tail>] : [Head, ...Flatten<Tail>] : [];
4452
- type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Top & {
4722
+ type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Constraint & {
4453
4723
  readonly Type: {
4454
4724
  readonly [K in Tag]: PropertyKey;
4455
4725
  };
4456
- }>, Flattened extends ReadonlyArray<Top & {
4726
+ }>, Flattened extends ReadonlyArray<Constraint & {
4457
4727
  readonly Type: {
4458
4728
  readonly [K in Tag]: PropertyKey;
4459
4729
  };
@@ -4482,7 +4752,7 @@ type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Top
4482
4752
  * @category combinators
4483
4753
  * @since 4.0.0
4484
4754
  */
4485
- export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray<Top & {
4755
+ export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray<Constraint & {
4486
4756
  readonly Type: {
4487
4757
  readonly [K in Tag]: PropertyKey;
4488
4758
  };
@@ -4511,7 +4781,7 @@ export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray
4511
4781
  * @category combinators
4512
4782
  * @since 4.0.0
4513
4783
  */
4514
- export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag): <const Members extends ReadonlyArray<Top & {
4784
+ export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag): <const Members extends ReadonlyArray<Constraint & {
4515
4785
  readonly Type: { readonly [K in Tag]: PropertyKey; };
4516
4786
  }>>(self: Union<Members>) => toTaggedUnion<Tag, Members>;
4517
4787
  /**
@@ -4520,17 +4790,28 @@ export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag):
4520
4790
  * @category models
4521
4791
  * @since 4.0.0
4522
4792
  */
4523
- export interface TaggedUnion<Cases extends Record<string, Top>> extends Bottom<{
4524
- [K in keyof Cases]: Cases[K]["Type"];
4525
- }[keyof Cases], {
4526
- [K in keyof Cases]: Cases[K]["Encoded"];
4527
- }[keyof Cases], {
4528
- [K in keyof Cases]: Cases[K]["DecodingServices"];
4529
- }[keyof Cases], {
4530
- [K in keyof Cases]: Cases[K]["EncodingServices"];
4531
- }[keyof Cases], SchemaAST.Union<SchemaAST.Objects>, TaggedUnion<Cases>, {
4532
- [K in keyof Cases]: Cases[K]["~type.make"];
4533
- }[keyof Cases]> {
4793
+ export interface TaggedUnion<Cases extends Record<string, Constraint>> extends BottomLazy<SchemaAST.Union<SchemaAST.Objects>, TaggedUnion<Cases>> {
4794
+ readonly "Type": {
4795
+ [K in keyof Cases]: Cases[K]["Type"];
4796
+ }[keyof Cases];
4797
+ readonly "Encoded": {
4798
+ [K in keyof Cases]: Cases[K]["Encoded"];
4799
+ }[keyof Cases];
4800
+ readonly "DecodingServices": {
4801
+ [K in keyof Cases]: Cases[K]["DecodingServices"];
4802
+ }[keyof Cases];
4803
+ readonly "EncodingServices": {
4804
+ [K in keyof Cases]: Cases[K]["EncodingServices"];
4805
+ }[keyof Cases];
4806
+ readonly "~type.make.in": {
4807
+ [K in keyof Cases]: Cases[K]["~type.make"];
4808
+ }[keyof Cases];
4809
+ readonly "~type.make": {
4810
+ [K in keyof Cases]: Cases[K]["~type.make"];
4811
+ }[keyof Cases];
4812
+ readonly "Iso": {
4813
+ [K in keyof Cases]: Cases[K]["Type"];
4814
+ }[keyof Cases];
4534
4815
  readonly cases: Cases;
4535
4816
  readonly isAnyOf: <const Keys>(keys: ReadonlyArray<Keys>) => (value: Cases[keyof Cases]["Type"]) => value is Extract<Cases[keyof Cases]["Type"], {
4536
4817
  _tag: Keys;
@@ -4582,7 +4863,14 @@ export declare function TaggedUnion<const CasesByTag extends Record<string, Stru
4582
4863
  * @category models
4583
4864
  * @since 4.0.0
4584
4865
  */
4585
- export interface Opaque<Self, S extends Top, Brand> extends Bottom<Self, S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], S["Rebuild"], S["~type.make.in"], S["Iso"], S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4866
+ export interface Opaque<Self, S extends Top, Brand> extends BottomLazy<S["ast"], S["Rebuild"], S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
4867
+ readonly "Type": Self;
4868
+ readonly "Encoded": S["Encoded"];
4869
+ readonly "DecodingServices": S["DecodingServices"];
4870
+ readonly "EncodingServices": S["EncodingServices"];
4871
+ readonly "~type.make.in": S["~type.make.in"];
4872
+ readonly "~type.make": S["~type.make"];
4873
+ readonly "Iso": S["Iso"];
4586
4874
  new (_: never): S["Type"] & Brand;
4587
4875
  }
4588
4876
  /**
@@ -4645,7 +4933,7 @@ export declare function instanceOf<C extends abstract new (...args: any) => any,
4645
4933
  * @category transforming
4646
4934
  * @since 4.0.0
4647
4935
  */
4648
- export declare function link<T>(): <To extends Top>(encodeTo: To, transformation: {
4936
+ export declare function link<T>(): <To extends Constraint>(encodeTo: To, transformation: {
4649
4937
  readonly decode: SchemaGetter.Getter<T, NoInfer<To["Type"]>>;
4650
4938
  readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, T>;
4651
4939
  }) => SchemaAST.Link;
@@ -5835,7 +6123,7 @@ export declare function isPropertiesLengthBetween(minimum: number, maximum: numb
5835
6123
  * @category Object checks
5836
6124
  * @since 4.0.0
5837
6125
  */
5838
- export declare function isPropertyNames(keySchema: Top, annotations?: Annotations.Filter): SchemaAST.Filter<object>;
6126
+ export declare function isPropertyNames(keySchema: Constraint, annotations?: Annotations.Filter): SchemaAST.Filter<object>;
5839
6127
  /**
5840
6128
  * Validates that all items in an array are unique according to Effect equality.
5841
6129
  *
@@ -5905,7 +6193,7 @@ export declare const Char: Char;
5905
6193
  * @category Option
5906
6194
  * @since 3.10.0
5907
6195
  */
5908
- export interface Option<A extends Top> extends declareConstructor<Option_.Option<A["Type"]>, Option_.Option<A["Encoded"]>, readonly [A], OptionIso<A>> {
6196
+ export interface Option<A extends Constraint> extends declareConstructor<Option_.Option<A["Type"]>, Option_.Option<A["Encoded"]>, readonly [A], OptionIso<A>> {
5909
6197
  readonly "Rebuild": Option<A>;
5910
6198
  readonly value: A;
5911
6199
  }
@@ -5920,7 +6208,7 @@ export interface Option<A extends Top> extends declareConstructor<Option_.Option
5920
6208
  * @category Option
5921
6209
  * @since 4.0.0
5922
6210
  */
5923
- export type OptionIso<A extends Top> = {
6211
+ export type OptionIso<A extends Constraint> = {
5924
6212
  readonly _tag: "None";
5925
6213
  } | {
5926
6214
  readonly _tag: "Some";
@@ -5932,14 +6220,14 @@ export type OptionIso<A extends Top> = {
5932
6220
  * @category Option
5933
6221
  * @since 3.10.0
5934
6222
  */
5935
- export declare function Option<A extends Top>(value: A): Option<A>;
6223
+ export declare function Option<A extends Constraint>(value: A): Option<A>;
5936
6224
  /**
5937
6225
  * Type-level representation returned by {@link OptionFromNullOr}.
5938
6226
  *
5939
6227
  * @category Option
5940
6228
  * @since 3.10.0
5941
6229
  */
5942
- export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<S>>, NullOr<S>> {
6230
+ export interface OptionFromNullOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullOr<S>> {
5943
6231
  readonly "Rebuild": OptionFromNullOr<S>;
5944
6232
  }
5945
6233
  /**
@@ -5953,14 +6241,14 @@ export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<
5953
6241
  * @category Option
5954
6242
  * @since 3.10.0
5955
6243
  */
5956
- export declare function OptionFromNullOr<S extends Top>(schema: S): OptionFromNullOr<S>;
6244
+ export declare function OptionFromNullOr<S extends Constraint>(schema: S): OptionFromNullOr<S>;
5957
6245
  /**
5958
6246
  * Type-level representation returned by {@link OptionFromUndefinedOr}.
5959
6247
  *
5960
6248
  * @category Option
5961
6249
  * @since 3.10.0
5962
6250
  */
5963
- export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
6251
+ export interface OptionFromUndefinedOr<S extends Constraint> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
5964
6252
  readonly "Rebuild": OptionFromUndefinedOr<S>;
5965
6253
  }
5966
6254
  /**
@@ -5975,14 +6263,14 @@ export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<to
5975
6263
  * @category Option
5976
6264
  * @since 3.10.0
5977
6265
  */
5978
- export declare function OptionFromUndefinedOr<S extends Top>(schema: S): OptionFromUndefinedOr<S>;
6266
+ export declare function OptionFromUndefinedOr<S extends Constraint>(schema: S): OptionFromUndefinedOr<S>;
5979
6267
  /**
5980
6268
  * Type-level representation returned by {@link OptionFromNullishOr}.
5981
6269
  *
5982
6270
  * @category Option
5983
6271
  * @since 3.10.0
5984
6272
  */
5985
- export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
6273
+ export interface OptionFromNullishOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
5986
6274
  readonly "Rebuild": OptionFromNullishOr<S>;
5987
6275
  }
5988
6276
  /**
@@ -5998,7 +6286,7 @@ export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toTy
5998
6286
  * @category Option
5999
6287
  * @since 3.10.0
6000
6288
  */
6001
- export declare function OptionFromNullishOr<S extends Top>(schema: S, options?: {
6289
+ export declare function OptionFromNullishOr<S extends Constraint>(schema: S, options?: {
6002
6290
  onNoneEncoding: null | undefined;
6003
6291
  }): OptionFromNullishOr<S>;
6004
6292
  /**
@@ -6007,7 +6295,7 @@ export declare function OptionFromNullishOr<S extends Top>(schema: S, options?:
6007
6295
  * @category Option
6008
6296
  * @since 4.0.0
6009
6297
  */
6010
- export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
6298
+ export interface OptionFromOptionalKey<S extends Constraint> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
6011
6299
  readonly "Rebuild": OptionFromOptionalKey<S>;
6012
6300
  }
6013
6301
  /**
@@ -6021,14 +6309,14 @@ export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<to
6021
6309
  * @category Option
6022
6310
  * @since 4.0.0
6023
6311
  */
6024
- export declare function OptionFromOptionalKey<S extends Top>(schema: S): OptionFromOptionalKey<S>;
6312
+ export declare function OptionFromOptionalKey<S extends Constraint>(schema: S): OptionFromOptionalKey<S>;
6025
6313
  /**
6026
6314
  * Type-level representation returned by {@link OptionFromOptional}.
6027
6315
  *
6028
6316
  * @category Option
6029
6317
  * @since 4.0.0
6030
6318
  */
6031
- export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toType<S>>, optional<S>> {
6319
+ export interface OptionFromOptional<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<S>> {
6032
6320
  readonly "Rebuild": OptionFromOptional<S>;
6033
6321
  }
6034
6322
  /**
@@ -6044,14 +6332,14 @@ export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toTyp
6044
6332
  * @category Option
6045
6333
  * @since 4.0.0
6046
6334
  */
6047
- export declare function OptionFromOptional<S extends Top>(schema: S): OptionFromOptional<S>;
6335
+ export declare function OptionFromOptional<S extends Constraint>(schema: S): OptionFromOptional<S>;
6048
6336
  /**
6049
6337
  * Type-level representation returned by {@link OptionFromOptionalNullOr}.
6050
6338
  *
6051
6339
  * @category Option
6052
6340
  * @since 4.0.0
6053
6341
  */
6054
- export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option<toType<S>>, optional<NullOr<S>>> {
6342
+ export interface OptionFromOptionalNullOr<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<NullOr<S>>> {
6055
6343
  readonly "Rebuild": OptionFromOptionalNullOr<S>;
6056
6344
  }
6057
6345
  /**
@@ -6068,7 +6356,7 @@ export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option
6068
6356
  * @category Option
6069
6357
  * @since 4.0.0
6070
6358
  */
6071
- export declare function OptionFromOptionalNullOr<S extends Top>(schema: S, options?: {
6359
+ export declare function OptionFromOptionalNullOr<S extends Constraint>(schema: S, options?: {
6072
6360
  readonly onNoneEncoding: "omit" | null | undefined;
6073
6361
  }): OptionFromOptionalNullOr<S>;
6074
6362
  /**
@@ -6077,7 +6365,7 @@ export declare function OptionFromOptionalNullOr<S extends Top>(schema: S, optio
6077
6365
  * @category schemas
6078
6366
  * @since 4.0.0
6079
6367
  */
6080
- export interface Result<A extends Top, E extends Top> extends declareConstructor<Result_.Result<A["Type"], E["Type"]>, Result_.Result<A["Encoded"], E["Encoded"]>, readonly [A, E], ResultIso<A, E>> {
6368
+ export interface Result<A extends Constraint, E extends Constraint> extends declareConstructor<Result_.Result<A["Type"], E["Type"]>, Result_.Result<A["Encoded"], E["Encoded"]>, readonly [A, E], ResultIso<A, E>> {
6081
6369
  readonly "Rebuild": Result<A, E>;
6082
6370
  readonly success: A;
6083
6371
  readonly failure: E;
@@ -6093,7 +6381,7 @@ export interface Result<A extends Top, E extends Top> extends declareConstructor
6093
6381
  * @category schemas
6094
6382
  * @since 4.0.0
6095
6383
  */
6096
- export type ResultIso<A extends Top, E extends Top> = {
6384
+ export type ResultIso<A extends Constraint, E extends Constraint> = {
6097
6385
  readonly _tag: "Success";
6098
6386
  readonly success: A["Iso"];
6099
6387
  } | {
@@ -6106,14 +6394,14 @@ export type ResultIso<A extends Top, E extends Top> = {
6106
6394
  * @category schemas
6107
6395
  * @since 4.0.0
6108
6396
  */
6109
- export declare function Result<A extends Top, E extends Top>(success: A, failure: E): Result<A, E>;
6397
+ export declare function Result<A extends Constraint, E extends Constraint>(success: A, failure: E): Result<A, E>;
6110
6398
  /**
6111
6399
  * Type-level representation returned by {@link Redacted}.
6112
6400
  *
6113
6401
  * @category Redacted
6114
6402
  * @since 3.10.0
6115
6403
  */
6116
- export interface Redacted<S extends Top> extends declareConstructor<Redacted_.Redacted<S["Type"]>, Redacted_.Redacted<S["Encoded"]>, readonly [S]> {
6404
+ export interface Redacted<S extends Constraint> extends declareConstructor<Redacted_.Redacted<S["Type"]>, Redacted_.Redacted<S["Encoded"]>, readonly [S]> {
6117
6405
  readonly "Rebuild": Redacted<S>;
6118
6406
  readonly value: S;
6119
6407
  }
@@ -6137,10 +6425,11 @@ export interface Redacted<S extends Top> extends declareConstructor<Redacted_.Re
6137
6425
  * into JSON, it will fail with an error. This is useful when the wrapped schema is
6138
6426
  * sensitive and should not be exposed in JSON.
6139
6427
  *
6428
+ * @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.
6140
6429
  * @category Redacted
6141
6430
  * @since 3.10.0
6142
6431
  */
6143
- export declare function Redacted<S extends Top>(value: S, options?: {
6432
+ export declare function Redacted<S extends Constraint>(value: S, options?: {
6144
6433
  readonly label?: string | undefined;
6145
6434
  readonly disallowJsonEncode?: boolean | undefined;
6146
6435
  }): Redacted<S>;
@@ -6150,7 +6439,7 @@ export declare function Redacted<S extends Top>(value: S, options?: {
6150
6439
  * @category Redacted
6151
6440
  * @since 4.0.0
6152
6441
  */
6153
- export interface RedactedFromValue<S extends Top> extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>> {
6442
+ export interface RedactedFromValue<S extends Constraint> extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>> {
6154
6443
  readonly "Rebuild": RedactedFromValue<S>;
6155
6444
  }
6156
6445
  /**
@@ -6160,16 +6449,17 @@ export interface RedactedFromValue<S extends Top> extends decodeTo<Redacted<toTy
6160
6449
  * @category Redacted
6161
6450
  * @since 4.0.0
6162
6451
  */
6163
- export declare function redact<S extends Top>(schema: S): middlewareDecoding<S, S["DecodingServices"]>;
6452
+ export declare function redact<S extends Constraint>(schema: S): middlewareDecoding<S, S["DecodingServices"]>;
6164
6453
  /**
6165
6454
  * Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
6166
6455
  * expects the input to already be a `Redacted` instance, this schema decodes
6167
6456
  * the raw value and wraps it.
6168
6457
  *
6458
+ * @see {@link Redacted} for schemas whose input is already a `Redacted` value.
6169
6459
  * @category Redacted
6170
6460
  * @since 4.0.0
6171
6461
  */
6172
- export declare function RedactedFromValue<S extends Top>(value: S, options?: {
6462
+ export declare function RedactedFromValue<S extends Constraint>(value: S, options?: {
6173
6463
  readonly label?: string | undefined;
6174
6464
  readonly disallowEncode?: boolean | undefined;
6175
6465
  }): RedactedFromValue<S>;
@@ -6179,7 +6469,7 @@ export declare function RedactedFromValue<S extends Top>(value: S, options?: {
6179
6469
  * @category CauseReason
6180
6470
  * @since 4.0.0
6181
6471
  */
6182
- export interface CauseReason<E extends Top, D extends Top> extends declareConstructor<Cause_.Reason<E["Type"]>, Cause_.Reason<E["Encoded"]>, readonly [E, D], CauseReasonIso<E, D>> {
6472
+ export interface CauseReason<E extends Constraint, D extends Constraint> extends declareConstructor<Cause_.Reason<E["Type"]>, Cause_.Reason<E["Encoded"]>, readonly [E, D], CauseReasonIso<E, D>> {
6183
6473
  readonly "Rebuild": CauseReason<E, D>;
6184
6474
  readonly error: E;
6185
6475
  readonly defect: D;
@@ -6195,7 +6485,7 @@ export interface CauseReason<E extends Top, D extends Top> extends declareConstr
6195
6485
  * @category CauseReason
6196
6486
  * @since 4.0.0
6197
6487
  */
6198
- export type CauseReasonIso<E extends Top, D extends Top> = {
6488
+ export type CauseReasonIso<E extends Constraint, D extends Constraint> = {
6199
6489
  readonly _tag: "Fail";
6200
6490
  readonly error: E["Iso"];
6201
6491
  } | {
@@ -6225,14 +6515,14 @@ export type CauseReasonIso<E extends Top, D extends Top> = {
6225
6515
  * @category CauseReason
6226
6516
  * @since 4.0.0
6227
6517
  */
6228
- export declare function CauseReason<E extends Top, D extends Top>(error: E, defect: D): CauseReason<E, D>;
6518
+ export declare function CauseReason<E extends Constraint, D extends Constraint>(error: E, defect: D): CauseReason<E, D>;
6229
6519
  /**
6230
6520
  * Type-level representation returned by {@link Cause}.
6231
6521
  *
6232
6522
  * @category Cause
6233
6523
  * @since 3.10.0
6234
6524
  */
6235
- export interface Cause<E extends Top, D extends Top> extends declareConstructor<Cause_.Cause<E["Type"]>, Cause_.Cause<E["Encoded"]>, readonly [E, D], CauseIso<E, D>> {
6525
+ export interface Cause<E extends Constraint, D extends Constraint> extends declareConstructor<Cause_.Cause<E["Type"]>, Cause_.Cause<E["Encoded"]>, readonly [E, D], CauseIso<E, D>> {
6236
6526
  readonly "Rebuild": Cause<E, D>;
6237
6527
  readonly error: E;
6238
6528
  readonly defect: D;
@@ -6252,7 +6542,7 @@ export interface Cause<E extends Top, D extends Top> extends declareConstructor<
6252
6542
  * @category Cause
6253
6543
  * @since 4.0.0
6254
6544
  */
6255
- export type CauseIso<E extends Top, D extends Top> = ReadonlyArray<CauseReasonIso<E, D>>;
6545
+ export type CauseIso<E extends Constraint, D extends Constraint> = ReadonlyArray<CauseReasonIso<E, D>>;
6256
6546
  /**
6257
6547
  * Creates a schema for `Cause` values using separate schemas for typed failures
6258
6548
  * and unexpected defects.
@@ -6274,7 +6564,7 @@ export type CauseIso<E extends Top, D extends Top> = ReadonlyArray<CauseReasonIs
6274
6564
  * @category Cause
6275
6565
  * @since 3.10.0
6276
6566
  */
6277
- export declare function Cause<E extends Top, D extends Top>(error: E, defect: D): Cause<E, D>;
6567
+ export declare function Cause<E extends Constraint, D extends Constraint>(error: E, defect: D): Cause<E, D>;
6278
6568
  /**
6279
6569
  * Type-level representation of {@link Error}.
6280
6570
  *
@@ -6378,7 +6668,7 @@ export declare function Defect(options?: ErrorOptions): Defect;
6378
6668
  * @category Exit
6379
6669
  * @since 3.10.0
6380
6670
  */
6381
- export interface Exit<A extends Top, E extends Top, D extends Top> extends declareConstructor<Exit_.Exit<A["Type"], E["Type"]>, Exit_.Exit<A["Encoded"], E["Encoded"]>, readonly [A, E, D], ExitIso<A, E, D>> {
6671
+ export interface Exit<A extends Constraint, E extends Constraint, D extends Constraint> extends declareConstructor<Exit_.Exit<A["Type"], E["Type"]>, Exit_.Exit<A["Encoded"], E["Encoded"]>, readonly [A, E, D], ExitIso<A, E, D>> {
6382
6672
  readonly "Rebuild": Exit<A, E, D>;
6383
6673
  readonly value: A;
6384
6674
  readonly error: E;
@@ -6395,7 +6685,7 @@ export interface Exit<A extends Top, E extends Top, D extends Top> extends decla
6395
6685
  * @category Exit
6396
6686
  * @since 4.0.0
6397
6687
  */
6398
- export type ExitIso<A extends Top, E extends Top, D extends Top> = {
6688
+ export type ExitIso<A extends Constraint, E extends Constraint, D extends Constraint> = {
6399
6689
  readonly _tag: "Success";
6400
6690
  readonly value: A["Iso"];
6401
6691
  } | {
@@ -6414,14 +6704,14 @@ export type ExitIso<A extends Top, E extends Top, D extends Top> = {
6414
6704
  * @category Exit
6415
6705
  * @since 3.10.0
6416
6706
  */
6417
- export declare function Exit<A extends Top, E extends Top, D extends Top>(value: A, error: E, defect: D): Exit<A, E, D>;
6707
+ export declare function Exit<A extends Constraint, E extends Constraint, D extends Constraint>(value: A, error: E, defect: D): Exit<A, E, D>;
6418
6708
  /**
6419
6709
  * Type-level representation returned by {@link ReadonlyMap}.
6420
6710
  *
6421
6711
  * @category ReadonlyMap
6422
6712
  * @since 4.0.0
6423
6713
  */
6424
- export interface $ReadonlyMap<Key extends Top, Value extends Top> extends declareConstructor<globalThis.ReadonlyMap<Key["Type"], Value["Type"]>, globalThis.ReadonlyMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], ReadonlyMapIso<Key, Value>> {
6714
+ export interface $ReadonlyMap<Key extends Constraint, Value extends Constraint> extends declareConstructor<globalThis.ReadonlyMap<Key["Type"], Value["Type"]>, globalThis.ReadonlyMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], ReadonlyMapIso<Key, Value>> {
6425
6715
  readonly "Rebuild": $ReadonlyMap<Key, Value>;
6426
6716
  readonly key: Key;
6427
6717
  readonly value: Value;
@@ -6433,7 +6723,7 @@ export interface $ReadonlyMap<Key extends Top, Value extends Top> extends declar
6433
6723
  * @category ReadonlyMap
6434
6724
  * @since 4.0.0
6435
6725
  */
6436
- export type ReadonlyMapIso<Key extends Top, Value extends Top> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
6726
+ export type ReadonlyMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
6437
6727
  /**
6438
6728
  * Schema for readonly maps whose keys and values conform to the provided
6439
6729
  * schemas.
@@ -6441,14 +6731,14 @@ export type ReadonlyMapIso<Key extends Top, Value extends Top> = ReadonlyArray<r
6441
6731
  * @category ReadonlyMap
6442
6732
  * @since 3.10.0
6443
6733
  */
6444
- export declare function ReadonlyMap<Key extends Top, Value extends Top>(key: Key, value: Value): $ReadonlyMap<Key, Value>;
6734
+ export declare function ReadonlyMap<Key extends Constraint, Value extends Constraint>(key: Key, value: Value): $ReadonlyMap<Key, Value>;
6445
6735
  /**
6446
6736
  * Type-level representation returned by {@link HashMap}.
6447
6737
  *
6448
6738
  * @category HashMap
6449
6739
  * @since 3.10.0
6450
6740
  */
6451
- export interface HashMap<Key extends Top, Value extends Top> extends declareConstructor<HashMap_.HashMap<Key["Type"], Value["Type"]>, HashMap_.HashMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], HashMapIso<Key, Value>> {
6741
+ export interface HashMap<Key extends Constraint, Value extends Constraint> extends declareConstructor<HashMap_.HashMap<Key["Type"], Value["Type"]>, HashMap_.HashMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], HashMapIso<Key, Value>> {
6452
6742
  readonly "Rebuild": HashMap<Key, Value>;
6453
6743
  readonly key: Key;
6454
6744
  readonly value: Value;
@@ -6460,21 +6750,21 @@ export interface HashMap<Key extends Top, Value extends Top> extends declareCons
6460
6750
  * @category HashMap
6461
6751
  * @since 4.0.0
6462
6752
  */
6463
- export type HashMapIso<Key extends Top, Value extends Top> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
6753
+ export type HashMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
6464
6754
  /**
6465
6755
  * Schema for hash maps whose keys and values conform to the provided schemas.
6466
6756
  *
6467
6757
  * @category HashMap
6468
6758
  * @since 3.10.0
6469
6759
  */
6470
- export declare function HashMap<Key extends Top, Value extends Top>(key: Key, value: Value): HashMap<Key, Value>;
6760
+ export declare function HashMap<Key extends Constraint, Value extends Constraint>(key: Key, value: Value): HashMap<Key, Value>;
6471
6761
  /**
6472
6762
  * Type-level representation returned by {@link ReadonlySet}.
6473
6763
  *
6474
6764
  * @category ReadonlySet
6475
6765
  * @since 4.0.0
6476
6766
  */
6477
- export interface $ReadonlySet<Value extends Top> extends declareConstructor<globalThis.ReadonlySet<Value["Type"]>, globalThis.ReadonlySet<Value["Encoded"]>, readonly [Value], ReadonlySetIso<Value>> {
6767
+ export interface $ReadonlySet<Value extends Constraint> extends declareConstructor<globalThis.ReadonlySet<Value["Type"]>, globalThis.ReadonlySet<Value["Encoded"]>, readonly [Value], ReadonlySetIso<Value>> {
6478
6768
  readonly "Rebuild": $ReadonlySet<Value>;
6479
6769
  readonly value: Value;
6480
6770
  }
@@ -6485,21 +6775,21 @@ export interface $ReadonlySet<Value extends Top> extends declareConstructor<glob
6485
6775
  * @category ReadonlySet
6486
6776
  * @since 4.0.0
6487
6777
  */
6488
- export type ReadonlySetIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
6778
+ export type ReadonlySetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
6489
6779
  /**
6490
6780
  * Schema for readonly sets whose values conform to the provided element schema.
6491
6781
  *
6492
6782
  * @category ReadonlySet
6493
6783
  * @since 3.10.0
6494
6784
  */
6495
- export declare function ReadonlySet<Value extends Top>(value: Value): $ReadonlySet<Value>;
6785
+ export declare function ReadonlySet<Value extends Constraint>(value: Value): $ReadonlySet<Value>;
6496
6786
  /**
6497
6787
  * Type-level representation returned by {@link HashSet}.
6498
6788
  *
6499
6789
  * @category HashSet
6500
6790
  * @since 3.10.0
6501
6791
  */
6502
- export interface HashSet<Value extends Top> extends declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, readonly [Value], HashSetIso<Value>> {
6792
+ export interface HashSet<Value extends Constraint> extends declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, readonly [Value], HashSetIso<Value>> {
6503
6793
  readonly "Rebuild": HashSet<Value>;
6504
6794
  readonly value: Value;
6505
6795
  }
@@ -6510,21 +6800,21 @@ export interface HashSet<Value extends Top> extends declareConstructor<HashSet_.
6510
6800
  * @category HashSet
6511
6801
  * @since 4.0.0
6512
6802
  */
6513
- export type HashSetIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
6803
+ export type HashSetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
6514
6804
  /**
6515
6805
  * Schema for hash sets whose values conform to the provided element schema.
6516
6806
  *
6517
6807
  * @category HashSet
6518
6808
  * @since 3.10.0
6519
6809
  */
6520
- export declare function HashSet<Value extends Top>(value: Value): HashSet<Value>;
6810
+ export declare function HashSet<Value extends Constraint>(value: Value): HashSet<Value>;
6521
6811
  /**
6522
6812
  * Type-level representation returned by {@link Chunk}.
6523
6813
  *
6524
6814
  * @category Chunk
6525
6815
  * @since 3.10.0
6526
6816
  */
6527
- export interface Chunk<Value extends Top> extends declareConstructor<Chunk_.Chunk<Value["Type"]>, Chunk_.Chunk<Value["Encoded"]>, readonly [Value], ChunkIso<Value>> {
6817
+ export interface Chunk<Value extends Constraint> extends declareConstructor<Chunk_.Chunk<Value["Type"]>, Chunk_.Chunk<Value["Encoded"]>, readonly [Value], ChunkIso<Value>> {
6528
6818
  readonly "Rebuild": Chunk<Value>;
6529
6819
  readonly value: Value;
6530
6820
  }
@@ -6542,14 +6832,14 @@ export interface Chunk<Value extends Top> extends declareConstructor<Chunk_.Chun
6542
6832
  * @category Chunk
6543
6833
  * @since 4.0.0
6544
6834
  */
6545
- export type ChunkIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
6835
+ export type ChunkIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
6546
6836
  /**
6547
6837
  * Schema for chunks whose values conform to the provided element schema.
6548
6838
  *
6549
6839
  * @category Chunk
6550
6840
  * @since 3.10.0
6551
6841
  */
6552
- export declare function Chunk<Value extends Top>(value: Value): Chunk<Value>;
6842
+ export declare function Chunk<Value extends Constraint>(value: Value): Chunk<Value>;
6553
6843
  /**
6554
6844
  * Type-level representation of {@link RegExp}.
6555
6845
  *
@@ -6930,7 +7220,7 @@ export declare const UnknownFromJsonString: UnknownFromJsonString;
6930
7220
  * @category models
6931
7221
  * @since 4.0.0
6932
7222
  */
6933
- export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
7223
+ export interface fromJsonString<S extends Constraint> extends decodeTo<S, String> {
6934
7224
  readonly "Rebuild": fromJsonString<S>;
6935
7225
  }
6936
7226
  /**
@@ -6999,7 +7289,7 @@ export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
6999
7289
  * @category constructors
7000
7290
  * @since 4.0.0
7001
7291
  */
7002
- export declare function fromJsonString<S extends Top>(schema: S): fromJsonString<S>;
7292
+ export declare function fromJsonString<S extends Constraint>(schema: S): fromJsonString<S>;
7003
7293
  /**
7004
7294
  * Type-level representation of {@link File}.
7005
7295
  *
@@ -7048,7 +7338,7 @@ export declare const FormData: FormData;
7048
7338
  * @category FormData
7049
7339
  * @since 4.0.0
7050
7340
  */
7051
- export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
7341
+ export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData> {
7052
7342
  readonly "Rebuild": fromFormData<S>;
7053
7343
  }
7054
7344
  /**
@@ -7067,10 +7357,8 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
7067
7357
  *
7068
7358
  * You can express nested values using bracket notation.
7069
7359
  *
7070
- * If you want to decode values that are not strings, use
7071
- * `Schema.toCodecStringTree` with the `keepDeclarations: true` option.
7072
- * This serializer preserves values such as numbers and `Blob` objects when
7073
- * compatible with the schema.
7360
+ * If you want to decode string fields into non-string primitive values, use
7361
+ * `Schema.toCodecStringTree`.
7074
7362
  *
7075
7363
  * **Example** (Decoding a flat structure)
7076
7364
  *
@@ -7124,8 +7412,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
7124
7412
  * Schema.toCodecStringTree(
7125
7413
  * Schema.Struct({
7126
7414
  * a: Schema.Int
7127
- * }),
7128
- * { keepDeclarations: true }
7415
+ * })
7129
7416
  * )
7130
7417
  * )
7131
7418
  *
@@ -7139,7 +7426,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
7139
7426
  * @category decoding
7140
7427
  * @since 4.0.0
7141
7428
  */
7142
- export declare function fromFormData<S extends Top>(schema: S): fromFormData<S>;
7429
+ export declare function fromFormData<S extends Constraint>(schema: S): fromFormData<S>;
7143
7430
  /**
7144
7431
  * Type-level representation of {@link URLSearchParams}.
7145
7432
  *
@@ -7166,7 +7453,7 @@ export declare const URLSearchParams: URLSearchParams;
7166
7453
  * @category search params
7167
7454
  * @since 4.0.0
7168
7455
  */
7169
- export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearchParams> {
7456
+ export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, URLSearchParams> {
7170
7457
  readonly "Rebuild": fromURLSearchParams<S>;
7171
7458
  }
7172
7459
  /**
@@ -7249,7 +7536,7 @@ export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearc
7249
7536
  * @category decoding
7250
7537
  * @since 4.0.0
7251
7538
  */
7252
- export declare function fromURLSearchParams<S extends Top>(schema: S): fromURLSearchParams<S>;
7539
+ export declare function fromURLSearchParams<S extends Constraint>(schema: S): fromURLSearchParams<S>;
7253
7540
  /**
7254
7541
  * Type-level representation of {@link Finite}.
7255
7542
  *
@@ -7966,9 +8253,16 @@ export declare const DateTimeZonedFromString: DateTimeZonedFromString;
7966
8253
  * @category models
7967
8254
  * @since 3.10.0
7968
8255
  */
7969
- export interface Class<Self, S extends Top & {
8256
+ export interface Class<Self, S extends Constraint & {
7970
8257
  readonly fields: Struct.Fields;
7971
- }, Inherited> extends Bottom<Self, S["Encoded"], S["DecodingServices"], S["EncodingServices"], SchemaAST.Declaration, decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>, RequiredKeys<S["~type.make.in"]> extends never ? void | S["~type.make.in"] : S["~type.make.in"], S["Iso"], readonly [S], Self, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
8258
+ }, Inherited> extends BottomLazy<SchemaAST.Declaration, decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>, readonly [S], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
8259
+ readonly "Type": Self;
8260
+ readonly "Encoded": S["Encoded"];
8261
+ readonly "DecodingServices": S["DecodingServices"];
8262
+ readonly "EncodingServices": S["EncodingServices"];
8263
+ readonly "~type.make.in": RequiredKeys<S["~type.make.in"]> extends never ? void | S["~type.make.in"] : S["~type.make.in"];
8264
+ readonly "~type.make": Self;
8265
+ readonly "Iso": S["Iso"];
7972
8266
  new (...args: {} extends S["~type.make.in"] ? [props?: S["~type.make.in"], options?: MakeOptions] : [props: S["~type.make.in"], options?: MakeOptions]): S["Type"] & Inherited;
7973
8267
  readonly identifier: string;
7974
8268
  readonly fields: S["fields"];
@@ -8626,7 +8920,7 @@ export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>;
8626
8920
  * @category Arbitrary
8627
8921
  * @since 4.0.0
8628
8922
  */
8629
- export declare function toArbitraryLazy<S extends Top>(schema: S): LazyArbitrary<S["Type"]>;
8923
+ export declare function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<S["Type"]>;
8630
8924
  /**
8631
8925
  * Derives a `fast-check` `Arbitrary` from a schema for property-based
8632
8926
  * testing. The derived arbitrary generates values that satisfy the schema.
@@ -8656,8 +8950,8 @@ export declare function toArbitraryLazy<S extends Top>(schema: S): LazyArbitrary
8656
8950
  * @category Arbitrary
8657
8951
  * @since 4.0.0
8658
8952
  */
8659
- export declare function toArbitrary<S extends Top>(schema: S): FastCheck.Arbitrary<S["Type"]>;
8660
- export declare function toArbitrary<S extends Top>(schema: S, options: {
8953
+ export declare function toArbitrary<S extends Constraint>(schema: S): FastCheck.Arbitrary<S["Type"]>;
8954
+ export declare function toArbitrary<S extends Constraint>(schema: S, options: {
8661
8955
  readonly report: true;
8662
8956
  }): Annotations.ToArbitrary.WithReport<FastCheck.Arbitrary<S["Type"]>>;
8663
8957
  /**
@@ -8686,9 +8980,9 @@ export declare function overrideToFormatter<S extends Top>(toFormatter: () => Fo
8686
8980
  * @category Formatter
8687
8981
  * @since 4.0.0
8688
8982
  */
8689
- export declare function toFormatter<T>(schema: Schema<T>, options?: {
8983
+ export declare function toFormatter<S extends Constraint>(schema: S, options?: {
8690
8984
  readonly onBefore?: ((ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => Formatter<any>) => Formatter<any> | undefined) | undefined;
8691
- }): Formatter<T>;
8985
+ }): Formatter<S["Type"]>;
8692
8986
  /**
8693
8987
  * Overrides the equivalence derivation for a schema by supplying a custom
8694
8988
  * `Equivalence`.
@@ -8730,7 +9024,7 @@ export declare function toEquivalence<T>(schema: Schema<T>): Equivalence.Equival
8730
9024
  * @category Representation
8731
9025
  * @since 4.0.0
8732
9026
  */
8733
- export declare function toRepresentation(schema: Top): SchemaRepresentation.Document;
9027
+ export declare function toRepresentation(schema: Constraint): SchemaRepresentation.Document;
8734
9028
  /**
8735
9029
  * Options for {@link toJsonSchemaDocument}.
8736
9030
  *
@@ -8823,7 +9117,23 @@ export interface ToJsonSchemaOptions {
8823
9117
  * @category converting
8824
9118
  * @since 4.0.0
8825
9119
  */
8826
- export declare function toJsonSchemaDocument(schema: Top, options?: ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
9120
+ export declare function toJsonSchemaDocument(schema: Constraint, options?: ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
9121
+ /**
9122
+ * Type-level representation returned by {@link toCodecJson}.
9123
+ *
9124
+ * @category Canonical Codecs
9125
+ * @since 4.0.0
9126
+ */
9127
+ export interface toCodecJson<S extends Constraint> extends BottomLazy<S["ast"], toCodecJson<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
9128
+ readonly "Type": S["Type"];
9129
+ readonly "Encoded": Json;
9130
+ readonly "DecodingServices": S["DecodingServices"];
9131
+ readonly "EncodingServices": S["EncodingServices"];
9132
+ readonly "~type.make.in": S["~type.make.in"];
9133
+ readonly "~type.make": S["~type.make"];
9134
+ readonly "Iso": S["Iso"];
9135
+ readonly schema: S;
9136
+ }
8827
9137
  /**
8828
9138
  * Derives a canonical JSON codec from a schema. The encoded form is `Json`, and
8829
9139
  * decoding produces the schema's `Type`.
@@ -8831,7 +9141,7 @@ export declare function toJsonSchemaDocument(schema: Top, options?: ToJsonSchema
8831
9141
  * @category Canonical Codecs
8832
9142
  * @since 4.0.0
8833
9143
  */
8834
- export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, Json, RD, RE>;
9144
+ export declare function toCodecJson<S extends Constraint>(schema: S): toCodecJson<S>;
8835
9145
  /**
8836
9146
  * Derives an isomorphism codec from a schema. The encoded form is the
8837
9147
  * schema's `Iso` type — the intermediate representation used for round-tripping.
@@ -8839,7 +9149,7 @@ export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>):
8839
9149
  * @category Canonical Codecs
8840
9150
  * @since 4.0.0
8841
9151
  */
8842
- export declare function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]>;
9152
+ export declare function toCodecIso<S extends Constraint>(schema: S): Codec<S["Type"], S["Iso"]>;
8843
9153
  /**
8844
9154
  * A {@link Tree} of `string | undefined` nodes. Leaf values are either a
8845
9155
  * string representation or `undefined` for opaque/declaration types.
@@ -8848,6 +9158,22 @@ export declare function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S
8848
9158
  * @since 4.0.0
8849
9159
  */
8850
9160
  export type StringTree = Tree<string | undefined>;
9161
+ /**
9162
+ * Type-level representation returned by {@link toCodecStringTree}.
9163
+ *
9164
+ * @category Canonical Codecs
9165
+ * @since 4.0.0
9166
+ */
9167
+ export interface toCodecStringTree<S extends Constraint> extends BottomLazy<S["ast"], toCodecStringTree<S>, ReadonlyArray<Constraint>, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
9168
+ readonly "Type": S["Type"];
9169
+ readonly "Encoded": StringTree;
9170
+ readonly "DecodingServices": S["DecodingServices"];
9171
+ readonly "EncodingServices": S["EncodingServices"];
9172
+ readonly "~type.make.in": S["~type.make.in"];
9173
+ readonly "~type.make": S["~type.make"];
9174
+ readonly "Iso": S["Iso"];
9175
+ readonly schema: S;
9176
+ }
8851
9177
  /**
8852
9178
  * Converts a schema to the StringTree canonical codec, where every leaf value
8853
9179
  * becomes a string while preserving the original structure.
@@ -8857,21 +9183,44 @@ export type StringTree = Tree<string | undefined>;
8857
9183
  * Declarations are converted to `undefined` (unless they have a
8858
9184
  * `toCodecJson` or `toCodec` annotation).
8859
9185
  *
8860
- * Options:
9186
+ * @category Canonical Codecs
9187
+ * @since 4.0.0
9188
+ */
9189
+ export declare function toCodecStringTree<S extends Constraint>(schema: S): toCodecStringTree<S>;
9190
+ /**
9191
+ * Type-level representation returned by {@link toCodecArrayFromSingle}.
8861
9192
  *
8862
- * - `keepDeclarations`: if `true`, it **does not** convert declarations to
8863
- * `undefined` but instead keeps them as they are (unless they have a
8864
- * `toCodecJson` or `toCodec` annotation).
9193
+ * @category Canonical Codecs
9194
+ * @since 4.0.0
9195
+ */
9196
+ export interface toCodecArrayFromSingle<S extends Constraint> extends BottomLazy<S["ast"], toCodecArrayFromSingle<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
9197
+ readonly "Type": S["Type"];
9198
+ readonly "Encoded": S["Encoded"];
9199
+ readonly "DecodingServices": S["DecodingServices"];
9200
+ readonly "EncodingServices": S["EncodingServices"];
9201
+ readonly "~type.make.in": S["~type.make.in"];
9202
+ readonly "~type.make": S["~type.make"];
9203
+ readonly "Iso": S["Iso"];
9204
+ }
9205
+ /**
9206
+ * Allows array schemas to decode from either an array input or a single value
9207
+ * input.
8865
9208
  *
8866
- * Defaults to `false`.
9209
+ * **When to use**
9210
+ *
9211
+ * Use when you need to accept transport formats that may represent a
9212
+ * single-item array as a bare value, such as query-string or form-data adapters.
9213
+ *
9214
+ * **Gotchas**
9215
+ *
9216
+ * This combinator is intentionally not part of `toCodecStringTree`; it adds a
9217
+ * decoding convenience rather than a canonical StringTree representation. It
9218
+ * does not parse comma-separated strings.
8867
9219
  *
8868
9220
  * @category Canonical Codecs
8869
9221
  * @since 4.0.0
8870
9222
  */
8871
- export declare function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, StringTree, RD, RE>;
8872
- export declare function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>, options: {
8873
- readonly keepDeclarations: true;
8874
- }): Codec<T, unknown, RD, RE>;
9223
+ export declare function toCodecArrayFromSingle<S extends Constraint>(schema: S): toCodecArrayFromSingle<S>;
8875
9224
  type XmlEncoderOptions = {
8876
9225
  /** Root element name for the returned XML string. Default: "root" */
8877
9226
  readonly rootName?: string | undefined;
@@ -8904,28 +9253,35 @@ export declare function toEncoderXml<T, E, RD, RE>(codec: Codec<T, E, RD, RE>, o
8904
9253
  * @category Optic
8905
9254
  * @since 4.0.0
8906
9255
  */
8907
- export declare function toIso<S extends Top>(schema: S): Optic_.Iso<S["Type"], S["Iso"]>;
9256
+ export declare function toIso<S extends Constraint>(schema: S): Optic_.Iso<S["Type"], S["Iso"]>;
8908
9257
  /**
8909
9258
  * Returns an identity `Iso` over the schema's source (`Type`) side.
8910
9259
  *
8911
9260
  * @category Optic
8912
9261
  * @since 4.0.0
8913
9262
  */
8914
- export declare function toIsoSource<S extends Top>(_: S): Optic_.Iso<S["Type"], S["Type"]>;
9263
+ export declare function toIsoSource<S extends Constraint>(_: S): Optic_.Iso<S["Type"], S["Type"]>;
8915
9264
  /**
8916
9265
  * Returns an identity `Iso` over the schema's focus (`Iso`) side.
8917
9266
  *
8918
9267
  * @category Optic
8919
9268
  * @since 4.0.0
8920
9269
  */
8921
- export declare function toIsoFocus<S extends Top>(_: S): Optic_.Iso<S["Iso"], S["Iso"]>;
9270
+ export declare function toIsoFocus<S extends Constraint>(_: S): Optic_.Iso<S["Iso"], S["Iso"]>;
8922
9271
  /**
8923
9272
  * Type-level representation returned by {@link overrideToCodecIso}.
8924
9273
  *
8925
9274
  * @category Optic
8926
9275
  * @since 4.0.0
8927
9276
  */
8928
- export interface overrideToCodecIso<S extends Top, Iso> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], overrideToCodecIso<S, Iso>, S["~type.make.in"], Iso, S["~type.parameters"], S["~type.make"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
9277
+ export interface overrideToCodecIso<S extends Constraint, Iso> extends BottomLazy<S["ast"], overrideToCodecIso<S, Iso>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
9278
+ readonly "Type": S["Type"];
9279
+ readonly "Encoded": S["Encoded"];
9280
+ readonly "DecodingServices": S["DecodingServices"];
9281
+ readonly "EncodingServices": S["EncodingServices"];
9282
+ readonly "~type.make.in": S["~type.make.in"];
9283
+ readonly "~type.make": S["~type.make"];
9284
+ readonly "Iso": Iso;
8929
9285
  readonly schema: S;
8930
9286
  }
8931
9287
  /**
@@ -8945,7 +9301,7 @@ export interface overrideToCodecIso<S extends Top, Iso> extends Bottom<S["Type"]
8945
9301
  * @category Optic
8946
9302
  * @since 4.0.0
8947
9303
  */
8948
- export declare function overrideToCodecIso<S extends Top, Iso>(to: Codec<Iso>, transformation: {
9304
+ export declare function overrideToCodecIso<S extends Constraint, Iso>(to: Codec<Iso>, transformation: {
8949
9305
  readonly decode: SchemaGetter.Getter<S["Type"], Iso>;
8950
9306
  readonly encode: SchemaGetter.Getter<Iso, S["Type"]>;
8951
9307
  }): (schema: S) => overrideToCodecIso<S, Iso>;
@@ -8984,7 +9340,7 @@ export interface TreeRecord<A> {
8984
9340
  * @category Tree
8985
9341
  * @since 4.0.0
8986
9342
  */
8987
- export declare function Tree<S extends Top>(node: S): Union<readonly [S, $Array<suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>, $Record<String, suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>]>;
9343
+ export declare function Tree<S extends Constraint>(node: S): Union<readonly [S, $Array<suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>, $Record<String, suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>]>;
8988
9344
  /**
8989
9345
  * Recursive TypeScript type for any valid immutable JSON value: `null`,
8990
9346
  * `number`, `boolean`, `string`, a readonly array of `Json` values, or a
@@ -9070,7 +9426,7 @@ export declare const MutableJson: Codec<MutableJson>;
9070
9426
  * @category Schema Resolvers
9071
9427
  * @since 4.0.0
9072
9428
  */
9073
- export declare function resolveAnnotations<S extends Top>(schema: S): Annotations.Bottom<S["Type"], S["~type.parameters"]> | undefined;
9429
+ export declare function resolveAnnotations<S extends Constraint>(schema: S): Annotations.Bottom<S["Type"], S["~type.parameters"]> | undefined;
9074
9430
  /**
9075
9431
  * Resolves the context (key-level) annotations from a schema. Context
9076
9432
  * annotations are those attached via `annotateKey` and live on the AST's
@@ -9079,7 +9435,7 @@ export declare function resolveAnnotations<S extends Top>(schema: S): Annotation
9079
9435
  * @category Schema Resolvers
9080
9436
  * @since 4.0.0
9081
9437
  */
9082
- export declare function resolveAnnotationsKey<S extends Top>(schema: S): Annotations.Key<S["Type"]> | undefined;
9438
+ export declare function resolveAnnotationsKey<S extends Constraint>(schema: S): Annotations.Key<S["Type"]> | undefined;
9083
9439
  /**
9084
9440
  * The `Annotations` namespace groups all annotation interfaces used to attach
9085
9441
  * metadata to schemas. Annotations control documentation, validation messages,
@@ -9201,7 +9557,7 @@ export declare namespace Annotations {
9201
9557
  * @category models
9202
9558
  * @since 4.0.0
9203
9559
  */
9204
- interface Bottom<T, TypeParameters extends ReadonlyArray<Top>> extends Documentation<T> {
9560
+ interface Bottom<T, TypeParameters extends ReadonlyArray<Constraint>> extends Documentation<T> {
9205
9561
  /**
9206
9562
  * Complete message to use when this schema node reports an issue.
9207
9563
  *
@@ -9258,7 +9614,7 @@ export declare namespace Annotations {
9258
9614
  * @category utility types
9259
9615
  * @since 4.0.0
9260
9616
  */
9261
- type Type<TypeParameters extends ReadonlyArray<Top>> = {
9617
+ type Type<TypeParameters extends ReadonlyArray<Constraint>> = {
9262
9618
  readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"]>;
9263
9619
  };
9264
9620
  /**
@@ -9267,7 +9623,7 @@ export declare namespace Annotations {
9267
9623
  * @category utility types
9268
9624
  * @since 4.0.0
9269
9625
  */
9270
- type Encoded<TypeParameters extends ReadonlyArray<Top>> = {
9626
+ type Encoded<TypeParameters extends ReadonlyArray<Constraint>> = {
9271
9627
  readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Encoded"]>;
9272
9628
  };
9273
9629
  }
@@ -9281,7 +9637,7 @@ export declare namespace Annotations {
9281
9637
  * @category models
9282
9638
  * @since 4.0.0
9283
9639
  */
9284
- interface Declaration<T, TypeParameters extends ReadonlyArray<Top> = readonly []> extends Bottom<T, TypeParameters> {
9640
+ interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint> = readonly []> extends Bottom<T, TypeParameters> {
9285
9641
  readonly toCodec?: ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link) | undefined;
9286
9642
  readonly toCodecJson?: ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link) | undefined;
9287
9643
  readonly toCodecIso?: ((typeParameters: TypeParameters.Type<TypeParameters>) => SchemaAST.Link) | undefined;
@@ -9376,7 +9732,7 @@ export declare namespace Annotations {
9376
9732
  * @since 4.0.0
9377
9733
  */
9378
9734
  interface Filter {
9379
- readonly constraint?: Constraint | undefined;
9735
+ readonly constraint?: GenerationConstraint | undefined;
9380
9736
  readonly candidate?: Candidate | undefined;
9381
9737
  }
9382
9738
  /**
@@ -9422,10 +9778,10 @@ export declare namespace Annotations {
9422
9778
  *
9423
9779
  * **Details**
9424
9780
  *
9425
- * `Constraint` is a generation hint for the current schema AST node, not a
9426
- * self-describing validation contract. Each generator consumes the fields it
9427
- * understands for the current node and ignores the rest; final schema
9428
- * filters still validate every generated value.
9781
+ * `GenerationConstraint` is a generation hint for the current schema AST
9782
+ * node, not a self-describing validation contract. Each generator consumes
9783
+ * the fields it understands for the current node and ignores the rest;
9784
+ * final schema filters still validate every generated value.
9429
9785
  *
9430
9786
  * `minLength` and `maxLength` represent node-local cardinality: string
9431
9787
  * length for strings, array length for arrays, final own-property count for
@@ -9438,7 +9794,7 @@ export declare namespace Annotations {
9438
9794
  * @category models
9439
9795
  * @since 4.0.0
9440
9796
  */
9441
- interface Constraint {
9797
+ interface GenerationConstraint {
9442
9798
  readonly minLength?: number | undefined;
9443
9799
  readonly maxLength?: number | undefined;
9444
9800
  readonly patterns?: readonly [string, ...Array<string>];
@@ -9479,7 +9835,7 @@ export declare namespace Annotations {
9479
9835
  * @since 4.0.0
9480
9836
  */
9481
9837
  interface Context {
9482
- readonly constraint?: ToArbitrary.Constraint | undefined;
9838
+ readonly constraint?: ToArbitrary.GenerationConstraint | undefined;
9483
9839
  readonly recursion?: ToArbitrary.Recursion | undefined;
9484
9840
  }
9485
9841
  /**
@@ -9541,7 +9897,7 @@ export declare namespace Annotations {
9541
9897
  * @category models
9542
9898
  * @since 4.0.0
9543
9899
  */
9544
- interface Declaration<T, TypeParameters extends ReadonlyArray<Top>> {
9900
+ interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
9545
9901
  (typeParameters: {
9546
9902
  readonly [K in keyof TypeParameters]: TypeParameter<TypeParameters[K]["Type"]>;
9547
9903
  }): (fc: typeof FastCheck, context: Context) => Output<T>;
@@ -9612,7 +9968,7 @@ export declare namespace Annotations {
9612
9968
  * @category models
9613
9969
  * @since 4.0.0
9614
9970
  */
9615
- interface Declaration<T, TypeParameters extends ReadonlyArray<Top>> {
9971
+ interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
9616
9972
  (typeParameters: {
9617
9973
  readonly [K in keyof TypeParameters]: Formatter<TypeParameters[K]["Type"]>;
9618
9974
  }): Formatter<T>;
@@ -9635,7 +9991,7 @@ export declare namespace Annotations {
9635
9991
  * @category models
9636
9992
  * @since 4.0.0
9637
9993
  */
9638
- interface Declaration<T, TypeParameters extends ReadonlyArray<Top>> {
9994
+ interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
9639
9995
  (typeParameters: {
9640
9996
  readonly [K in keyof TypeParameters]: Equivalence.Equivalence<TypeParameters[K]["Type"]>;
9641
9997
  }): Equivalence.Equivalence<T>;