effect 4.0.0-beta.3 → 4.0.0-beta.31

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 (1008) hide show
  1. package/dist/Array.d.ts +126 -299
  2. package/dist/Array.d.ts.map +1 -1
  3. package/dist/Array.js +102 -62
  4. package/dist/Array.js.map +1 -1
  5. package/dist/Brand.d.ts +1 -1
  6. package/dist/Brand.d.ts.map +1 -1
  7. package/dist/Brand.js +1 -1
  8. package/dist/Brand.js.map +1 -1
  9. package/dist/Cache.d.ts +2 -2
  10. package/dist/Cache.d.ts.map +1 -1
  11. package/dist/Cache.js +6 -5
  12. package/dist/Cache.js.map +1 -1
  13. package/dist/Cause.d.ts +2 -2
  14. package/dist/Cause.d.ts.map +1 -1
  15. package/dist/Channel.d.ts +118 -32
  16. package/dist/Channel.d.ts.map +1 -1
  17. package/dist/Channel.js +82 -37
  18. package/dist/Channel.js.map +1 -1
  19. package/dist/Chunk.d.ts +54 -247
  20. package/dist/Chunk.d.ts.map +1 -1
  21. package/dist/Chunk.js +36 -67
  22. package/dist/Chunk.js.map +1 -1
  23. package/dist/Combiner.d.ts +280 -13
  24. package/dist/Combiner.d.ts.map +1 -1
  25. package/dist/Combiner.js +198 -7
  26. package/dist/Combiner.js.map +1 -1
  27. package/dist/Config.d.ts +165 -9
  28. package/dist/Config.d.ts.map +1 -1
  29. package/dist/Config.js +65 -10
  30. package/dist/Config.js.map +1 -1
  31. package/dist/ConfigProvider.d.ts +1 -1
  32. package/dist/Cron.d.ts +1 -1
  33. package/dist/Cron.js +3 -3
  34. package/dist/Cron.js.map +1 -1
  35. package/dist/Data.d.ts +535 -366
  36. package/dist/Data.d.ts.map +1 -1
  37. package/dist/Data.js +132 -79
  38. package/dist/Data.js.map +1 -1
  39. package/dist/DateTime.d.ts +56 -238
  40. package/dist/DateTime.d.ts.map +1 -1
  41. package/dist/DateTime.js +7 -52
  42. package/dist/DateTime.js.map +1 -1
  43. package/dist/Duration.d.ts +39 -11
  44. package/dist/Duration.d.ts.map +1 -1
  45. package/dist/Duration.js +88 -59
  46. package/dist/Duration.js.map +1 -1
  47. package/dist/Effect.d.ts +1206 -924
  48. package/dist/Effect.d.ts.map +1 -1
  49. package/dist/Effect.js +390 -329
  50. package/dist/Effect.js.map +1 -1
  51. package/dist/Encoding.d.ts +194 -0
  52. package/dist/Encoding.d.ts.map +1 -0
  53. package/dist/Encoding.js +352 -0
  54. package/dist/Encoding.js.map +1 -0
  55. package/dist/Equal.d.ts +276 -109
  56. package/dist/Equal.d.ts.map +1 -1
  57. package/dist/Equal.js +124 -48
  58. package/dist/Equal.js.map +1 -1
  59. package/dist/ErrorReporter.d.ts +374 -0
  60. package/dist/ErrorReporter.d.ts.map +1 -0
  61. package/dist/ErrorReporter.js +244 -0
  62. package/dist/ErrorReporter.js.map +1 -0
  63. package/dist/Exit.d.ts +24 -12
  64. package/dist/Exit.d.ts.map +1 -1
  65. package/dist/Exit.js +8 -4
  66. package/dist/Exit.js.map +1 -1
  67. package/dist/Fiber.d.ts +3 -2
  68. package/dist/Fiber.d.ts.map +1 -1
  69. package/dist/Fiber.js.map +1 -1
  70. package/dist/FileSystem.d.ts +1 -1
  71. package/dist/FileSystem.d.ts.map +1 -1
  72. package/dist/FileSystem.js +5 -5
  73. package/dist/FileSystem.js.map +1 -1
  74. package/dist/Filter.d.ts +34 -38
  75. package/dist/Filter.d.ts.map +1 -1
  76. package/dist/Filter.js +15 -13
  77. package/dist/Filter.js.map +1 -1
  78. package/dist/Formatter.d.ts +131 -47
  79. package/dist/Formatter.d.ts.map +1 -1
  80. package/dist/Formatter.js +229 -51
  81. package/dist/Formatter.js.map +1 -1
  82. package/dist/Function.d.ts +1 -9
  83. package/dist/Function.d.ts.map +1 -1
  84. package/dist/Function.js +2 -10
  85. package/dist/Function.js.map +1 -1
  86. package/dist/Graph.d.ts +1 -1
  87. package/dist/Graph.d.ts.map +1 -1
  88. package/dist/Graph.js +5 -8
  89. package/dist/Graph.js.map +1 -1
  90. package/dist/HashMap.d.ts +15 -14
  91. package/dist/HashMap.d.ts.map +1 -1
  92. package/dist/HashMap.js +4 -4
  93. package/dist/HashMap.js.map +1 -1
  94. package/dist/Iterable.d.ts +39 -39
  95. package/dist/Iterable.d.ts.map +1 -1
  96. package/dist/Iterable.js +94 -22
  97. package/dist/Iterable.js.map +1 -1
  98. package/dist/JsonSchema.d.ts +299 -10
  99. package/dist/JsonSchema.d.ts.map +1 -1
  100. package/dist/JsonSchema.js +323 -4
  101. package/dist/JsonSchema.js.map +1 -1
  102. package/dist/Latch.d.ts +109 -0
  103. package/dist/Latch.d.ts.map +1 -0
  104. package/dist/Latch.js +72 -0
  105. package/dist/Latch.js.map +1 -0
  106. package/dist/Layer.d.ts +217 -127
  107. package/dist/Layer.d.ts.map +1 -1
  108. package/dist/Layer.js +51 -46
  109. package/dist/Layer.js.map +1 -1
  110. package/dist/LayerMap.d.ts +8 -8
  111. package/dist/LayerMap.d.ts.map +1 -1
  112. package/dist/LayerMap.js +3 -3
  113. package/dist/LogLevel.d.ts +32 -0
  114. package/dist/LogLevel.d.ts.map +1 -1
  115. package/dist/LogLevel.js +28 -100
  116. package/dist/LogLevel.js.map +1 -1
  117. package/dist/Logger.d.ts +29 -95
  118. package/dist/Logger.d.ts.map +1 -1
  119. package/dist/Logger.js +2 -3
  120. package/dist/Logger.js.map +1 -1
  121. package/dist/ManagedRuntime.d.ts +2 -2
  122. package/dist/ManagedRuntime.js +2 -2
  123. package/dist/Metric.d.ts +4 -6
  124. package/dist/Metric.d.ts.map +1 -1
  125. package/dist/Metric.js +3 -5
  126. package/dist/Metric.js.map +1 -1
  127. package/dist/Newtype.d.ts +291 -0
  128. package/dist/Newtype.d.ts.map +1 -0
  129. package/dist/Newtype.js +161 -0
  130. package/dist/Newtype.js.map +1 -0
  131. package/dist/Optic.d.ts +947 -18
  132. package/dist/Optic.d.ts.map +1 -1
  133. package/dist/Optic.js +454 -5
  134. package/dist/Optic.js.map +1 -1
  135. package/dist/Option.d.ts +23 -16
  136. package/dist/Option.d.ts.map +1 -1
  137. package/dist/Option.js +15 -9
  138. package/dist/Option.js.map +1 -1
  139. package/dist/Pipeable.d.ts +17 -0
  140. package/dist/Pipeable.d.ts.map +1 -1
  141. package/dist/Pipeable.js +19 -1
  142. package/dist/Pipeable.js.map +1 -1
  143. package/dist/PlatformError.d.ts +10 -9
  144. package/dist/PlatformError.d.ts.map +1 -1
  145. package/dist/PlatformError.js +2 -2
  146. package/dist/PlatformError.js.map +1 -1
  147. package/dist/Pool.d.ts +6 -4
  148. package/dist/Pool.d.ts.map +1 -1
  149. package/dist/Pool.js +7 -5
  150. package/dist/Pool.js.map +1 -1
  151. package/dist/PubSub.d.ts +3 -2
  152. package/dist/PubSub.d.ts.map +1 -1
  153. package/dist/PubSub.js +3 -2
  154. package/dist/PubSub.js.map +1 -1
  155. package/dist/Pull.d.ts.map +1 -1
  156. package/dist/Pull.js +1 -1
  157. package/dist/Pull.js.map +1 -1
  158. package/dist/Queue.d.ts.map +1 -1
  159. package/dist/Queue.js +0 -1
  160. package/dist/Queue.js.map +1 -1
  161. package/dist/Random.d.ts +35 -1
  162. package/dist/Random.d.ts.map +1 -1
  163. package/dist/Random.js +46 -12
  164. package/dist/Random.js.map +1 -1
  165. package/dist/RcMap.d.ts +2 -2
  166. package/dist/RcMap.d.ts.map +1 -1
  167. package/dist/RcMap.js +1 -1
  168. package/dist/RcMap.js.map +1 -1
  169. package/dist/RcRef.d.ts +1 -1
  170. package/dist/RcRef.d.ts.map +1 -1
  171. package/dist/Record.d.ts +23 -120
  172. package/dist/Record.d.ts.map +1 -1
  173. package/dist/Record.js +21 -41
  174. package/dist/Record.js.map +1 -1
  175. package/dist/Reducer.d.ts +166 -7
  176. package/dist/Reducer.d.ts.map +1 -1
  177. package/dist/Reducer.js +135 -1
  178. package/dist/Reducer.js.map +1 -1
  179. package/dist/References.d.ts +9 -4
  180. package/dist/References.d.ts.map +1 -1
  181. package/dist/References.js +6 -1
  182. package/dist/References.js.map +1 -1
  183. package/dist/Request.d.ts +1 -1
  184. package/dist/Request.d.ts.map +1 -1
  185. package/dist/Request.js +2 -1
  186. package/dist/Request.js.map +1 -1
  187. package/dist/RequestResolver.d.ts +25 -45
  188. package/dist/RequestResolver.d.ts.map +1 -1
  189. package/dist/RequestResolver.js +10 -30
  190. package/dist/RequestResolver.js.map +1 -1
  191. package/dist/Result.d.ts +1 -1
  192. package/dist/Result.d.ts.map +1 -1
  193. package/dist/Result.js +1 -2
  194. package/dist/Result.js.map +1 -1
  195. package/dist/Runtime.d.ts +66 -0
  196. package/dist/Runtime.d.ts.map +1 -1
  197. package/dist/Runtime.js +79 -6
  198. package/dist/Runtime.js.map +1 -1
  199. package/dist/Schedule.d.ts +191 -102
  200. package/dist/Schedule.d.ts.map +1 -1
  201. package/dist/Schedule.js +152 -66
  202. package/dist/Schedule.js.map +1 -1
  203. package/dist/Scheduler.d.ts +9 -0
  204. package/dist/Scheduler.d.ts.map +1 -1
  205. package/dist/Scheduler.js +11 -0
  206. package/dist/Scheduler.js.map +1 -1
  207. package/dist/Schema.d.ts +2647 -224
  208. package/dist/Schema.d.ts.map +1 -1
  209. package/dist/Schema.js +1863 -209
  210. package/dist/Schema.js.map +1 -1
  211. package/dist/SchemaAST.d.ts +2 -2
  212. package/dist/SchemaAST.d.ts.map +1 -1
  213. package/dist/SchemaAST.js +131 -25
  214. package/dist/SchemaAST.js.map +1 -1
  215. package/dist/SchemaGetter.d.ts +5 -5
  216. package/dist/SchemaGetter.d.ts.map +1 -1
  217. package/dist/SchemaGetter.js +12 -14
  218. package/dist/SchemaGetter.js.map +1 -1
  219. package/dist/SchemaParser.d.ts +5 -0
  220. package/dist/SchemaParser.d.ts.map +1 -1
  221. package/dist/SchemaParser.js +10 -0
  222. package/dist/SchemaParser.js.map +1 -1
  223. package/dist/SchemaRepresentation.d.ts +46 -45
  224. package/dist/SchemaRepresentation.d.ts.map +1 -1
  225. package/dist/SchemaRepresentation.js +49 -24
  226. package/dist/SchemaRepresentation.js.map +1 -1
  227. package/dist/SchemaTransformation.d.ts +107 -3
  228. package/dist/SchemaTransformation.d.ts.map +1 -1
  229. package/dist/SchemaTransformation.js +159 -4
  230. package/dist/SchemaTransformation.js.map +1 -1
  231. package/dist/ScopedCache.d.ts +2 -2
  232. package/dist/ScopedCache.d.ts.map +1 -1
  233. package/dist/ScopedCache.js +1 -1
  234. package/dist/ScopedCache.js.map +1 -1
  235. package/dist/Semaphore.d.ts +211 -0
  236. package/dist/Semaphore.d.ts.map +1 -0
  237. package/dist/{PartitionedSemaphore.js → Semaphore.js} +97 -13
  238. package/dist/Semaphore.js.map +1 -0
  239. package/dist/ServiceMap.d.ts +41 -31
  240. package/dist/ServiceMap.d.ts.map +1 -1
  241. package/dist/ServiceMap.js +3 -3
  242. package/dist/ServiceMap.js.map +1 -1
  243. package/dist/Sink.d.ts +13 -13
  244. package/dist/Sink.d.ts.map +1 -1
  245. package/dist/Sink.js +53 -6
  246. package/dist/Sink.js.map +1 -1
  247. package/dist/Stdio.d.ts +16 -4
  248. package/dist/Stdio.d.ts.map +1 -1
  249. package/dist/Stdio.js +18 -0
  250. package/dist/Stdio.js.map +1 -1
  251. package/dist/Stream.d.ts +250 -428
  252. package/dist/Stream.d.ts.map +1 -1
  253. package/dist/Stream.js +137 -82
  254. package/dist/Stream.js.map +1 -1
  255. package/dist/Struct.d.ts +16 -0
  256. package/dist/Struct.d.ts.map +1 -1
  257. package/dist/Struct.js +22 -0
  258. package/dist/Struct.js.map +1 -1
  259. package/dist/SubscriptionRef.d.ts +2 -1
  260. package/dist/SubscriptionRef.d.ts.map +1 -1
  261. package/dist/SubscriptionRef.js +2 -1
  262. package/dist/SubscriptionRef.js.map +1 -1
  263. package/dist/SynchronizedRef.d.ts +2 -1
  264. package/dist/SynchronizedRef.d.ts.map +1 -1
  265. package/dist/SynchronizedRef.js +2 -1
  266. package/dist/SynchronizedRef.js.map +1 -1
  267. package/dist/Trie.d.ts +18 -17
  268. package/dist/Trie.d.ts.map +1 -1
  269. package/dist/Trie.js +5 -5
  270. package/dist/Trie.js.map +1 -1
  271. package/dist/TxChunk.d.ts +37 -37
  272. package/dist/TxChunk.d.ts.map +1 -1
  273. package/dist/TxChunk.js +3 -3
  274. package/dist/TxChunk.js.map +1 -1
  275. package/dist/TxDeferred.d.ts +328 -0
  276. package/dist/TxDeferred.d.ts.map +1 -0
  277. package/dist/TxDeferred.js +196 -0
  278. package/dist/TxDeferred.js.map +1 -0
  279. package/dist/TxHashMap.d.ts +84 -83
  280. package/dist/TxHashMap.d.ts.map +1 -1
  281. package/dist/TxHashMap.js +24 -24
  282. package/dist/TxHashMap.js.map +1 -1
  283. package/dist/TxHashSet.d.ts +35 -35
  284. package/dist/TxHashSet.d.ts.map +1 -1
  285. package/dist/TxHashSet.js +14 -14
  286. package/dist/TxHashSet.js.map +1 -1
  287. package/dist/TxPriorityQueue.d.ts +609 -0
  288. package/dist/TxPriorityQueue.d.ts.map +1 -0
  289. package/dist/TxPriorityQueue.js +415 -0
  290. package/dist/TxPriorityQueue.js.map +1 -0
  291. package/dist/TxPubSub.d.ts +585 -0
  292. package/dist/TxPubSub.d.ts.map +1 -0
  293. package/dist/TxPubSub.js +521 -0
  294. package/dist/TxPubSub.js.map +1 -0
  295. package/dist/TxQueue.d.ts +32 -32
  296. package/dist/TxQueue.d.ts.map +1 -1
  297. package/dist/TxQueue.js +26 -26
  298. package/dist/TxQueue.js.map +1 -1
  299. package/dist/TxReentrantLock.d.ts +523 -0
  300. package/dist/TxReentrantLock.d.ts.map +1 -0
  301. package/dist/TxReentrantLock.js +504 -0
  302. package/dist/TxReentrantLock.js.map +1 -0
  303. package/dist/TxRef.d.ts +34 -34
  304. package/dist/TxRef.d.ts.map +1 -1
  305. package/dist/TxRef.js +21 -14
  306. package/dist/TxRef.js.map +1 -1
  307. package/dist/TxSemaphore.d.ts +8 -8
  308. package/dist/TxSemaphore.d.ts.map +1 -1
  309. package/dist/TxSemaphore.js +7 -7
  310. package/dist/TxSemaphore.js.map +1 -1
  311. package/dist/TxSubscriptionRef.d.ts +508 -0
  312. package/dist/TxSubscriptionRef.d.ts.map +1 -0
  313. package/dist/TxSubscriptionRef.js +293 -0
  314. package/dist/TxSubscriptionRef.js.map +1 -0
  315. package/dist/Types.d.ts +80 -23
  316. package/dist/Types.d.ts.map +1 -1
  317. package/dist/Utils.d.ts +137 -65
  318. package/dist/Utils.d.ts.map +1 -1
  319. package/dist/Utils.js +38 -66
  320. package/dist/Utils.js.map +1 -1
  321. package/dist/index.d.ts +718 -23
  322. package/dist/index.d.ts.map +1 -1
  323. package/dist/index.js +718 -23
  324. package/dist/index.js.map +1 -1
  325. package/dist/internal/core.js +11 -3
  326. package/dist/internal/core.js.map +1 -1
  327. package/dist/internal/dateTime.js +60 -61
  328. package/dist/internal/dateTime.js.map +1 -1
  329. package/dist/internal/effect.js +265 -127
  330. package/dist/internal/effect.js.map +1 -1
  331. package/dist/internal/hashMap.js +5 -4
  332. package/dist/internal/hashMap.js.map +1 -1
  333. package/dist/internal/random.d.ts +2 -0
  334. package/dist/internal/random.d.ts.map +1 -0
  335. package/dist/internal/random.js +13 -0
  336. package/dist/internal/random.js.map +1 -0
  337. package/dist/internal/rcRef.js +3 -2
  338. package/dist/internal/rcRef.js.map +1 -1
  339. package/dist/internal/request.js +2 -2
  340. package/dist/internal/request.js.map +1 -1
  341. package/dist/internal/schema/annotations.js +2 -0
  342. package/dist/internal/schema/annotations.js.map +1 -1
  343. package/dist/internal/schema/representation.js +47 -106
  344. package/dist/internal/schema/representation.js.map +1 -1
  345. package/dist/internal/schema/schema.js +1 -0
  346. package/dist/internal/schema/schema.js.map +1 -1
  347. package/dist/internal/schema/to-codec.js +7 -10
  348. package/dist/internal/schema/to-codec.js.map +1 -1
  349. package/dist/internal/trie.js +5 -4
  350. package/dist/internal/trie.js.map +1 -1
  351. package/dist/testing/TestClock.d.ts +8 -7
  352. package/dist/testing/TestClock.d.ts.map +1 -1
  353. package/dist/testing/TestClock.js +6 -4
  354. package/dist/testing/TestClock.js.map +1 -1
  355. package/dist/testing/TestSchema.d.ts +266 -32
  356. package/dist/testing/TestSchema.d.ts.map +1 -1
  357. package/dist/testing/TestSchema.js +296 -23
  358. package/dist/testing/TestSchema.js.map +1 -1
  359. package/dist/testing/index.d.ts +64 -1
  360. package/dist/testing/index.d.ts.map +1 -1
  361. package/dist/testing/index.js +64 -1
  362. package/dist/testing/index.js.map +1 -1
  363. package/dist/unstable/ai/AiError.d.ts +134 -51
  364. package/dist/unstable/ai/AiError.d.ts.map +1 -1
  365. package/dist/unstable/ai/AiError.js +19 -16
  366. package/dist/unstable/ai/AiError.js.map +1 -1
  367. package/dist/unstable/ai/Chat.d.ts +7 -8
  368. package/dist/unstable/ai/Chat.d.ts.map +1 -1
  369. package/dist/unstable/ai/Chat.js +38 -44
  370. package/dist/unstable/ai/Chat.js.map +1 -1
  371. package/dist/unstable/ai/LanguageModel.d.ts +45 -45
  372. package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
  373. package/dist/unstable/ai/LanguageModel.js +107 -124
  374. package/dist/unstable/ai/LanguageModel.js.map +1 -1
  375. package/dist/unstable/ai/McpSchema.d.ts +183 -88
  376. package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
  377. package/dist/unstable/ai/McpSchema.js +57 -12
  378. package/dist/unstable/ai/McpSchema.js.map +1 -1
  379. package/dist/unstable/ai/McpServer.d.ts +66 -13
  380. package/dist/unstable/ai/McpServer.d.ts.map +1 -1
  381. package/dist/unstable/ai/McpServer.js +193 -51
  382. package/dist/unstable/ai/McpServer.js.map +1 -1
  383. package/dist/unstable/ai/Model.d.ts +25 -7
  384. package/dist/unstable/ai/Model.d.ts.map +1 -1
  385. package/dist/unstable/ai/Model.js +22 -6
  386. package/dist/unstable/ai/Model.js.map +1 -1
  387. package/dist/unstable/ai/Prompt.d.ts +20 -20
  388. package/dist/unstable/ai/Prompt.d.ts.map +1 -1
  389. package/dist/unstable/ai/Response.d.ts +26 -26
  390. package/dist/unstable/ai/Response.d.ts.map +1 -1
  391. package/dist/unstable/ai/Response.js +1 -1
  392. package/dist/unstable/ai/Response.js.map +1 -1
  393. package/dist/unstable/ai/Tool.d.ts +20 -4
  394. package/dist/unstable/ai/Tool.d.ts.map +1 -1
  395. package/dist/unstable/ai/Tool.js +14 -9
  396. package/dist/unstable/ai/Tool.js.map +1 -1
  397. package/dist/unstable/ai/Toolkit.d.ts +1 -1
  398. package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
  399. package/dist/unstable/ai/Toolkit.js +4 -11
  400. package/dist/unstable/ai/Toolkit.js.map +1 -1
  401. package/dist/unstable/ai/index.d.ts +1 -1
  402. package/dist/unstable/ai/index.js +1 -1
  403. package/dist/unstable/ai/internal/codec-transformer.js +0 -5
  404. package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
  405. package/dist/unstable/cli/CliError.d.ts +27 -60
  406. package/dist/unstable/cli/CliError.d.ts.map +1 -1
  407. package/dist/unstable/cli/CliError.js +25 -57
  408. package/dist/unstable/cli/CliError.js.map +1 -1
  409. package/dist/unstable/cli/CliOutput.js +59 -6
  410. package/dist/unstable/cli/CliOutput.js.map +1 -1
  411. package/dist/unstable/cli/Command.d.ts +368 -56
  412. package/dist/unstable/cli/Command.d.ts.map +1 -1
  413. package/dist/unstable/cli/Command.js +325 -64
  414. package/dist/unstable/cli/Command.js.map +1 -1
  415. package/dist/unstable/cli/Completions.d.ts +16 -0
  416. package/dist/unstable/cli/Completions.d.ts.map +1 -0
  417. package/dist/unstable/cli/Completions.js +23 -0
  418. package/dist/unstable/cli/Completions.js.map +1 -0
  419. package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
  420. package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
  421. package/dist/unstable/cli/GlobalFlag.js +118 -0
  422. package/dist/unstable/cli/GlobalFlag.js.map +1 -0
  423. package/dist/unstable/cli/HelpDoc.d.ts +70 -2
  424. package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
  425. package/dist/unstable/cli/Primitive.d.ts +1 -1
  426. package/dist/unstable/cli/Primitive.js +1 -1
  427. package/dist/unstable/cli/Prompt.js +35 -8
  428. package/dist/unstable/cli/Prompt.js.map +1 -1
  429. package/dist/unstable/cli/index.d.ts +8 -0
  430. package/dist/unstable/cli/index.d.ts.map +1 -1
  431. package/dist/unstable/cli/index.js +8 -0
  432. package/dist/unstable/cli/index.js.map +1 -1
  433. package/dist/unstable/cli/internal/command.d.ts +40 -14
  434. package/dist/unstable/cli/internal/command.d.ts.map +1 -1
  435. package/dist/unstable/cli/internal/command.js +72 -46
  436. package/dist/unstable/cli/internal/command.js.map +1 -1
  437. package/dist/unstable/cli/internal/completions/CommandDescriptor.js +7 -2
  438. package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
  439. package/dist/unstable/cli/internal/config.js +42 -0
  440. package/dist/unstable/cli/internal/config.js.map +1 -1
  441. package/dist/unstable/cli/internal/help.d.ts +33 -0
  442. package/dist/unstable/cli/internal/help.d.ts.map +1 -0
  443. package/dist/unstable/cli/internal/help.js +125 -0
  444. package/dist/unstable/cli/internal/help.js.map +1 -0
  445. package/dist/unstable/cli/internal/parser.js +55 -42
  446. package/dist/unstable/cli/internal/parser.js.map +1 -1
  447. package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
  448. package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
  449. package/dist/unstable/cluster/ClusterCron.js +1 -1
  450. package/dist/unstable/cluster/ClusterCron.js.map +1 -1
  451. package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
  452. package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -4
  453. package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
  454. package/dist/unstable/cluster/DeliverAt.js +1 -1
  455. package/dist/unstable/cluster/DeliverAt.js.map +1 -1
  456. package/dist/unstable/cluster/Entity.d.ts +7 -6
  457. package/dist/unstable/cluster/Entity.d.ts.map +1 -1
  458. package/dist/unstable/cluster/Entity.js.map +1 -1
  459. package/dist/unstable/cluster/EntityResource.d.ts +2 -2
  460. package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
  461. package/dist/unstable/cluster/Envelope.d.ts +1 -1
  462. package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
  463. package/dist/unstable/cluster/K8sHttpClient.js +4 -4
  464. package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
  465. package/dist/unstable/cluster/Message.d.ts +10 -10
  466. package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
  467. package/dist/unstable/cluster/MessageStorage.js +2 -1
  468. package/dist/unstable/cluster/MessageStorage.js.map +1 -1
  469. package/dist/unstable/cluster/Reply.d.ts +6 -6
  470. package/dist/unstable/cluster/Runner.d.ts +1 -1
  471. package/dist/unstable/cluster/Runners.d.ts.map +1 -1
  472. package/dist/unstable/cluster/Runners.js +4 -3
  473. package/dist/unstable/cluster/Runners.js.map +1 -1
  474. package/dist/unstable/cluster/Sharding.d.ts +2 -2
  475. package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
  476. package/dist/unstable/cluster/Sharding.js +9 -7
  477. package/dist/unstable/cluster/Sharding.js.map +1 -1
  478. package/dist/unstable/cluster/ShardingConfig.d.ts +21 -21
  479. package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
  480. package/dist/unstable/cluster/ShardingConfig.js +20 -20
  481. package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
  482. package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
  483. package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
  484. package/dist/unstable/cluster/internal/entityManager.js +5 -4
  485. package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
  486. package/dist/unstable/cluster/internal/entityReaper.js +2 -1
  487. package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
  488. package/dist/unstable/cluster/internal/resourceRef.js +2 -1
  489. package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
  490. package/dist/unstable/devtools/DevToolsSchema.d.ts +36 -36
  491. package/dist/unstable/encoding/Msgpack.d.ts +1 -1
  492. package/dist/unstable/encoding/Ndjson.d.ts +9 -9
  493. package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
  494. package/dist/unstable/encoding/Ndjson.js.map +1 -1
  495. package/dist/unstable/encoding/Sse.d.ts +4 -4
  496. package/dist/unstable/encoding/Sse.d.ts.map +1 -1
  497. package/dist/unstable/encoding/Sse.js +1 -1
  498. package/dist/unstable/encoding/Sse.js.map +1 -1
  499. package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
  500. package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
  501. package/dist/unstable/eventlog/EventLog.js +2 -1
  502. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  503. package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
  504. package/dist/unstable/http/Cookies.d.ts +47 -3
  505. package/dist/unstable/http/Cookies.d.ts.map +1 -1
  506. package/dist/unstable/http/Cookies.js +24 -2
  507. package/dist/unstable/http/Cookies.js.map +1 -1
  508. package/dist/unstable/http/Headers.d.ts +16 -0
  509. package/dist/unstable/http/Headers.d.ts.map +1 -1
  510. package/dist/unstable/http/Headers.js +38 -10
  511. package/dist/unstable/http/Headers.js.map +1 -1
  512. package/dist/unstable/http/HttpBody.d.ts +3 -3
  513. package/dist/unstable/http/HttpBody.d.ts.map +1 -1
  514. package/dist/unstable/http/HttpBody.js +6 -6
  515. package/dist/unstable/http/HttpBody.js.map +1 -1
  516. package/dist/unstable/http/HttpClient.d.ts +117 -15
  517. package/dist/unstable/http/HttpClient.d.ts.map +1 -1
  518. package/dist/unstable/http/HttpClient.js +189 -12
  519. package/dist/unstable/http/HttpClient.js.map +1 -1
  520. package/dist/unstable/http/HttpClientError.d.ts +7 -7
  521. package/dist/unstable/http/HttpClientRequest.d.ts +16 -11
  522. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  523. package/dist/unstable/http/HttpClientRequest.js +31 -20
  524. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  525. package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
  526. package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
  527. package/dist/unstable/http/HttpClientResponse.js +4 -0
  528. package/dist/unstable/http/HttpClientResponse.js.map +1 -1
  529. package/dist/unstable/http/HttpEffect.d.ts +7 -5
  530. package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
  531. package/dist/unstable/http/HttpEffect.js +46 -54
  532. package/dist/unstable/http/HttpEffect.js.map +1 -1
  533. package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
  534. package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
  535. package/dist/unstable/http/HttpMethod.d.ts +4 -4
  536. package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
  537. package/dist/unstable/http/HttpMethod.js +3 -3
  538. package/dist/unstable/http/HttpMethod.js.map +1 -1
  539. package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
  540. package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
  541. package/dist/unstable/http/HttpMiddleware.js +8 -17
  542. package/dist/unstable/http/HttpMiddleware.js.map +1 -1
  543. package/dist/unstable/http/HttpServerError.d.ts +20 -33
  544. package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
  545. package/dist/unstable/http/HttpServerError.js +37 -44
  546. package/dist/unstable/http/HttpServerError.js.map +1 -1
  547. package/dist/unstable/http/HttpServerRequest.d.ts +12 -1
  548. package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
  549. package/dist/unstable/http/HttpServerRequest.js +291 -1
  550. package/dist/unstable/http/HttpServerRequest.js.map +1 -1
  551. package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
  552. package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
  553. package/dist/unstable/http/HttpServerRespondable.js +5 -5
  554. package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
  555. package/dist/unstable/http/HttpServerResponse.d.ts +50 -3
  556. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  557. package/dist/unstable/http/HttpServerResponse.js +234 -1
  558. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  559. package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
  560. package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
  561. package/dist/unstable/http/HttpStaticServer.js +353 -0
  562. package/dist/unstable/http/HttpStaticServer.js.map +1 -0
  563. package/dist/unstable/http/Multipart.d.ts +3 -3
  564. package/dist/unstable/http/UrlParams.d.ts +14 -6
  565. package/dist/unstable/http/UrlParams.d.ts.map +1 -1
  566. package/dist/unstable/http/UrlParams.js +1 -1
  567. package/dist/unstable/http/UrlParams.js.map +1 -1
  568. package/dist/unstable/http/index.d.ts +4 -0
  569. package/dist/unstable/http/index.d.ts.map +1 -1
  570. package/dist/unstable/http/index.js +4 -0
  571. package/dist/unstable/http/index.js.map +1 -1
  572. package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
  573. package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
  574. package/dist/unstable/http/internal/preResponseHandler.js +10 -0
  575. package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
  576. package/dist/unstable/httpapi/HttpApi.d.ts +4 -4
  577. package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
  578. package/dist/unstable/httpapi/HttpApi.js.map +1 -1
  579. package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
  580. package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
  581. package/dist/unstable/httpapi/HttpApiBuilder.js +28 -18
  582. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  583. package/dist/unstable/httpapi/HttpApiClient.d.ts +66 -6
  584. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  585. package/dist/unstable/httpapi/HttpApiClient.js +40 -3
  586. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  587. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +41 -54
  588. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  589. package/dist/unstable/httpapi/HttpApiEndpoint.js +17 -26
  590. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  591. package/dist/unstable/httpapi/HttpApiError.d.ts +16 -14
  592. package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
  593. package/dist/unstable/httpapi/HttpApiError.js +44 -29
  594. package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
  595. package/dist/unstable/httpapi/HttpApiGroup.d.ts +4 -3
  596. package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
  597. package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
  598. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
  599. package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
  600. package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
  601. package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
  602. package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
  603. package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
  604. package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
  605. package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
  606. package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
  607. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  608. package/dist/unstable/httpapi/OpenApi.js +32 -21
  609. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  610. package/dist/unstable/observability/Otlp.d.ts +12 -12
  611. package/dist/unstable/observability/Otlp.d.ts.map +1 -1
  612. package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
  613. package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
  614. package/dist/unstable/observability/OtlpExporter.js +1 -1
  615. package/dist/unstable/observability/OtlpExporter.js.map +1 -1
  616. package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
  617. package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
  618. package/dist/unstable/observability/OtlpLogger.js +7 -4
  619. package/dist/unstable/observability/OtlpLogger.js.map +1 -1
  620. package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
  621. package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
  622. package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
  623. package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
  624. package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
  625. package/dist/unstable/persistence/KeyValueStore.js +6 -6
  626. package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
  627. package/dist/unstable/persistence/Persistable.d.ts +2 -2
  628. package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
  629. package/dist/unstable/persistence/Persistable.js +1 -1
  630. package/dist/unstable/persistence/Persistable.js.map +1 -1
  631. package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
  632. package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
  633. package/dist/unstable/persistence/PersistedCache.js +2 -1
  634. package/dist/unstable/persistence/PersistedCache.js.map +1 -1
  635. package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
  636. package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
  637. package/dist/unstable/persistence/PersistedQueue.js +12 -11
  638. package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
  639. package/dist/unstable/persistence/Persistence.d.ts +1 -1
  640. package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
  641. package/dist/unstable/persistence/Persistence.js +2 -2
  642. package/dist/unstable/persistence/Persistence.js.map +1 -1
  643. package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
  644. package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
  645. package/dist/unstable/persistence/RateLimiter.js +1 -1
  646. package/dist/unstable/persistence/RateLimiter.js.map +1 -1
  647. package/dist/unstable/process/ChildProcess.d.ts +5 -128
  648. package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
  649. package/dist/unstable/process/ChildProcess.js +1 -65
  650. package/dist/unstable/process/ChildProcess.js.map +1 -1
  651. package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
  652. package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
  653. package/dist/unstable/process/ChildProcessSpawner.js +21 -1
  654. package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
  655. package/dist/unstable/reactivity/Atom.d.ts +73 -12
  656. package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
  657. package/dist/unstable/reactivity/Atom.js +107 -20
  658. package/dist/unstable/reactivity/Atom.js.map +1 -1
  659. package/dist/unstable/reactivity/AtomHttpApi.d.ts +10 -12
  660. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  661. package/dist/unstable/reactivity/AtomHttpApi.js +42 -12
  662. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  663. package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
  664. package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
  665. package/dist/unstable/reactivity/AtomRegistry.js +50 -9
  666. package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
  667. package/dist/unstable/reactivity/AtomRpc.d.ts +9 -9
  668. package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
  669. package/dist/unstable/reactivity/AtomRpc.js +47 -21
  670. package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
  671. package/dist/unstable/reactivity/Hydration.d.ts +39 -0
  672. package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
  673. package/dist/unstable/reactivity/Hydration.js +76 -0
  674. package/dist/unstable/reactivity/Hydration.js.map +1 -0
  675. package/dist/unstable/reactivity/index.d.ts +4 -0
  676. package/dist/unstable/reactivity/index.d.ts.map +1 -1
  677. package/dist/unstable/reactivity/index.js +4 -0
  678. package/dist/unstable/reactivity/index.js.map +1 -1
  679. package/dist/unstable/rpc/Rpc.d.ts +5 -5
  680. package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
  681. package/dist/unstable/rpc/Rpc.js.map +1 -1
  682. package/dist/unstable/rpc/RpcClient.d.ts +5 -26
  683. package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
  684. package/dist/unstable/rpc/RpcClient.js +6 -13
  685. package/dist/unstable/rpc/RpcClient.js.map +1 -1
  686. package/dist/unstable/rpc/RpcGroup.d.ts +3 -5
  687. package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
  688. package/dist/unstable/rpc/RpcGroup.js.map +1 -1
  689. package/dist/unstable/rpc/RpcMiddleware.d.ts +8 -8
  690. package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
  691. package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
  692. package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
  693. package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
  694. package/dist/unstable/rpc/RpcSchema.js +14 -0
  695. package/dist/unstable/rpc/RpcSchema.js.map +1 -1
  696. package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
  697. package/dist/unstable/rpc/RpcSerialization.js +34 -9
  698. package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
  699. package/dist/unstable/rpc/RpcServer.d.ts +5 -9
  700. package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
  701. package/dist/unstable/rpc/RpcServer.js +17 -17
  702. package/dist/unstable/rpc/RpcServer.js.map +1 -1
  703. package/dist/unstable/rpc/Utils.d.ts.map +1 -1
  704. package/dist/unstable/rpc/Utils.js +3 -2
  705. package/dist/unstable/rpc/Utils.js.map +1 -1
  706. package/dist/unstable/schema/Model.d.ts +22 -1
  707. package/dist/unstable/schema/Model.d.ts.map +1 -1
  708. package/dist/unstable/schema/Model.js +15 -0
  709. package/dist/unstable/schema/Model.js.map +1 -1
  710. package/dist/unstable/schema/VariantSchema.d.ts +5 -5
  711. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  712. package/dist/unstable/schema/VariantSchema.js +6 -6
  713. package/dist/unstable/schema/VariantSchema.js.map +1 -1
  714. package/dist/unstable/socket/Socket.d.ts +4 -4
  715. package/dist/unstable/socket/Socket.d.ts.map +1 -1
  716. package/dist/unstable/socket/Socket.js +6 -5
  717. package/dist/unstable/socket/Socket.js.map +1 -1
  718. package/dist/unstable/socket/SocketServer.d.ts +3 -3
  719. package/dist/unstable/sql/Migrator.d.ts +1 -1
  720. package/dist/unstable/sql/SqlClient.d.ts +1 -1
  721. package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
  722. package/dist/unstable/sql/SqlError.d.ts +14 -14
  723. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  724. package/dist/unstable/sql/SqlError.js +9 -3
  725. package/dist/unstable/sql/SqlError.js.map +1 -1
  726. package/dist/unstable/sql/SqlModel.d.ts +2 -2
  727. package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
  728. package/dist/unstable/sql/SqlModel.js +3 -3
  729. package/dist/unstable/sql/SqlModel.js.map +1 -1
  730. package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
  731. package/dist/unstable/sql/SqlResolver.js +17 -8
  732. package/dist/unstable/sql/SqlResolver.js.map +1 -1
  733. package/dist/unstable/sql/SqlSchema.d.ts +17 -6
  734. package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
  735. package/dist/unstable/sql/SqlSchema.js +17 -7
  736. package/dist/unstable/sql/SqlSchema.js.map +1 -1
  737. package/dist/unstable/sql/Statement.js +0 -1
  738. package/dist/unstable/sql/Statement.js.map +1 -1
  739. package/dist/unstable/workers/Worker.d.ts.map +1 -1
  740. package/dist/unstable/workers/Worker.js +2 -1
  741. package/dist/unstable/workers/Worker.js.map +1 -1
  742. package/dist/unstable/workflow/DurableClock.d.ts +3 -3
  743. package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
  744. package/dist/unstable/workflow/DurableClock.js +3 -3
  745. package/dist/unstable/workflow/DurableClock.js.map +1 -1
  746. package/dist/unstable/workflow/DurableDeferred.js +2 -2
  747. package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
  748. package/dist/unstable/workflow/Workflow.d.ts +3 -3
  749. package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
  750. package/dist/unstable/workflow/Workflow.js +1 -1
  751. package/dist/unstable/workflow/Workflow.js.map +1 -1
  752. package/dist/unstable/workflow/WorkflowEngine.d.ts +12 -1
  753. package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
  754. package/dist/unstable/workflow/WorkflowEngine.js +137 -1
  755. package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
  756. package/package.json +2 -2
  757. package/src/Array.ts +192 -342
  758. package/src/Brand.ts +1 -1
  759. package/src/Cache.ts +9 -8
  760. package/src/Cause.ts +2 -2
  761. package/src/Channel.ts +557 -141
  762. package/src/Chunk.ts +81 -268
  763. package/src/Combiner.ts +280 -13
  764. package/src/Config.ts +186 -24
  765. package/src/Cron.ts +3 -3
  766. package/src/Data.ts +539 -376
  767. package/src/DateTime.ts +59 -241
  768. package/src/Duration.ts +91 -36
  769. package/src/Effect.ts +1477 -1126
  770. package/src/Encoding.ts +879 -0
  771. package/src/Equal.ts +278 -111
  772. package/src/ErrorReporter.ts +457 -0
  773. package/src/Exit.ts +24 -12
  774. package/src/Fiber.ts +10 -2
  775. package/src/FileSystem.ts +7 -8
  776. package/src/Filter.ts +52 -63
  777. package/src/Formatter.ts +253 -51
  778. package/src/Function.ts +2 -10
  779. package/src/Graph.ts +24 -11
  780. package/src/HashMap.ts +15 -14
  781. package/src/Iterable.ts +104 -50
  782. package/src/JsonSchema.ts +383 -10
  783. package/src/Latch.ts +112 -0
  784. package/src/Layer.ts +245 -150
  785. package/src/LayerMap.ts +9 -9
  786. package/src/LogLevel.ts +37 -0
  787. package/src/Logger.ts +33 -100
  788. package/src/ManagedRuntime.ts +2 -2
  789. package/src/Metric.ts +6 -8
  790. package/src/Newtype.ts +308 -0
  791. package/src/Optic.ts +948 -19
  792. package/src/Option.ts +32 -24
  793. package/src/Pipeable.ts +32 -1
  794. package/src/PlatformError.ts +5 -5
  795. package/src/Pool.ts +13 -11
  796. package/src/PubSub.ts +10 -9
  797. package/src/Pull.ts +1 -1
  798. package/src/Queue.ts +0 -1
  799. package/src/Random.ts +51 -14
  800. package/src/RcMap.ts +5 -5
  801. package/src/RcRef.ts +1 -1
  802. package/src/Record.ts +42 -152
  803. package/src/Reducer.ts +166 -7
  804. package/src/References.ts +10 -5
  805. package/src/Request.ts +3 -2
  806. package/src/RequestResolver.ts +29 -49
  807. package/src/Result.ts +2 -4
  808. package/src/Runtime.ts +102 -6
  809. package/src/Schedule.ts +462 -242
  810. package/src/Scheduler.ts +12 -0
  811. package/src/Schema.ts +3116 -312
  812. package/src/SchemaAST.ts +166 -33
  813. package/src/SchemaGetter.ts +15 -17
  814. package/src/SchemaParser.ts +11 -0
  815. package/src/SchemaRepresentation.ts +51 -26
  816. package/src/SchemaTransformation.ts +189 -4
  817. package/src/ScopedCache.ts +3 -3
  818. package/src/Semaphore.ts +356 -0
  819. package/src/ServiceMap.ts +50 -40
  820. package/src/Sink.ts +78 -26
  821. package/src/Stdio.ts +27 -4
  822. package/src/Stream.ts +586 -608
  823. package/src/Struct.ts +26 -0
  824. package/src/SubscriptionRef.ts +3 -2
  825. package/src/SynchronizedRef.ts +3 -2
  826. package/src/Trie.ts +18 -17
  827. package/src/TxChunk.ts +72 -53
  828. package/src/TxDeferred.ts +394 -0
  829. package/src/TxHashMap.ts +332 -285
  830. package/src/TxHashSet.ts +111 -116
  831. package/src/TxPriorityQueue.ts +767 -0
  832. package/src/TxPubSub.ts +789 -0
  833. package/src/TxQueue.ts +241 -251
  834. package/src/TxReentrantLock.ts +753 -0
  835. package/src/TxRef.ts +50 -38
  836. package/src/TxSemaphore.ts +29 -32
  837. package/src/TxSubscriptionRef.ts +639 -0
  838. package/src/Types.ts +73 -19
  839. package/src/Utils.ts +137 -111
  840. package/src/index.ts +728 -24
  841. package/src/internal/core.ts +12 -5
  842. package/src/internal/dateTime.ts +69 -81
  843. package/src/internal/effect.ts +775 -302
  844. package/src/internal/hashMap.ts +8 -7
  845. package/src/internal/random.ts +20 -0
  846. package/src/internal/rcRef.ts +4 -3
  847. package/src/internal/request.ts +2 -2
  848. package/src/internal/schema/annotations.ts +2 -0
  849. package/src/internal/schema/representation.ts +45 -94
  850. package/src/internal/schema/schema.ts +1 -0
  851. package/src/internal/schema/to-codec.ts +7 -17
  852. package/src/internal/trie.ts +15 -9
  853. package/src/testing/TestClock.ts +13 -11
  854. package/src/testing/TestSchema.ts +332 -35
  855. package/src/testing/index.ts +64 -1
  856. package/src/unstable/ai/AiError.ts +105 -48
  857. package/src/unstable/ai/Chat.ts +58 -74
  858. package/src/unstable/ai/LanguageModel.ts +294 -158
  859. package/src/unstable/ai/McpSchema.ts +73 -13
  860. package/src/unstable/ai/McpServer.ts +271 -61
  861. package/src/unstable/ai/Model.ts +40 -9
  862. package/src/unstable/ai/Prompt.ts +37 -37
  863. package/src/unstable/ai/Response.ts +25 -25
  864. package/src/unstable/ai/Tool.ts +20 -14
  865. package/src/unstable/ai/Toolkit.ts +5 -14
  866. package/src/unstable/ai/index.ts +1 -1
  867. package/src/unstable/ai/internal/codec-transformer.ts +0 -7
  868. package/src/unstable/cli/CliError.ts +47 -59
  869. package/src/unstable/cli/CliOutput.ts +75 -6
  870. package/src/unstable/cli/Command.ts +796 -187
  871. package/src/unstable/cli/Completions.ts +36 -0
  872. package/src/unstable/cli/GlobalFlag.ts +242 -0
  873. package/src/unstable/cli/HelpDoc.ts +80 -2
  874. package/src/unstable/cli/Primitive.ts +1 -1
  875. package/src/unstable/cli/Prompt.ts +31 -9
  876. package/src/unstable/cli/index.ts +10 -0
  877. package/src/unstable/cli/internal/command.ts +109 -63
  878. package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
  879. package/src/unstable/cli/internal/config.ts +49 -0
  880. package/src/unstable/cli/internal/help.ts +171 -0
  881. package/src/unstable/cli/internal/parser.ts +66 -61
  882. package/src/unstable/cluster/ClusterCron.ts +2 -2
  883. package/src/unstable/cluster/ClusterWorkflowEngine.ts +6 -5
  884. package/src/unstable/cluster/DeliverAt.ts +1 -1
  885. package/src/unstable/cluster/Entity.ts +11 -10
  886. package/src/unstable/cluster/EntityResource.ts +4 -4
  887. package/src/unstable/cluster/Envelope.ts +1 -1
  888. package/src/unstable/cluster/K8sHttpClient.ts +5 -5
  889. package/src/unstable/cluster/MessageStorage.ts +3 -5
  890. package/src/unstable/cluster/Runners.ts +6 -5
  891. package/src/unstable/cluster/Sharding.ts +12 -10
  892. package/src/unstable/cluster/ShardingConfig.ts +30 -31
  893. package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
  894. package/src/unstable/cluster/internal/entityManager.ts +9 -8
  895. package/src/unstable/cluster/internal/entityReaper.ts +2 -1
  896. package/src/unstable/cluster/internal/resourceRef.ts +2 -1
  897. package/src/unstable/encoding/Ndjson.ts +17 -17
  898. package/src/unstable/encoding/Sse.ts +3 -5
  899. package/src/unstable/eventlog/EventLog.ts +2 -1
  900. package/src/unstable/http/Cookies.ts +87 -3
  901. package/src/unstable/http/Headers.ts +62 -13
  902. package/src/unstable/http/HttpBody.ts +6 -6
  903. package/src/unstable/http/HttpClient.ts +374 -33
  904. package/src/unstable/http/HttpClientRequest.ts +38 -30
  905. package/src/unstable/http/HttpClientResponse.ts +9 -4
  906. package/src/unstable/http/HttpEffect.ts +54 -68
  907. package/src/unstable/http/HttpIncomingMessage.ts +1 -1
  908. package/src/unstable/http/HttpMethod.ts +16 -4
  909. package/src/unstable/http/HttpMiddleware.ts +9 -24
  910. package/src/unstable/http/HttpServerError.ts +42 -45
  911. package/src/unstable/http/HttpServerRequest.ts +391 -4
  912. package/src/unstable/http/HttpServerRespondable.ts +6 -6
  913. package/src/unstable/http/HttpServerResponse.ts +337 -4
  914. package/src/unstable/http/HttpStaticServer.ts +456 -0
  915. package/src/unstable/http/Multipart.ts +2 -2
  916. package/src/unstable/http/UrlParams.ts +20 -5
  917. package/src/unstable/http/index.ts +5 -0
  918. package/src/unstable/http/internal/preResponseHandler.ts +15 -0
  919. package/src/unstable/httpapi/HttpApi.ts +6 -6
  920. package/src/unstable/httpapi/HttpApiBuilder.ts +83 -30
  921. package/src/unstable/httpapi/HttpApiClient.ts +100 -11
  922. package/src/unstable/httpapi/HttpApiEndpoint.ts +71 -87
  923. package/src/unstable/httpapi/HttpApiError.ts +51 -28
  924. package/src/unstable/httpapi/HttpApiGroup.ts +7 -6
  925. package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
  926. package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
  927. package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
  928. package/src/unstable/httpapi/OpenApi.ts +41 -23
  929. package/src/unstable/observability/Otlp.ts +12 -12
  930. package/src/unstable/observability/OtlpExporter.ts +3 -3
  931. package/src/unstable/observability/OtlpLogger.ts +13 -9
  932. package/src/unstable/observability/OtlpMetrics.ts +4 -4
  933. package/src/unstable/observability/OtlpTracer.ts +4 -4
  934. package/src/unstable/persistence/KeyValueStore.ts +6 -6
  935. package/src/unstable/persistence/Persistable.ts +3 -3
  936. package/src/unstable/persistence/PersistedCache.ts +20 -9
  937. package/src/unstable/persistence/PersistedQueue.ts +25 -24
  938. package/src/unstable/persistence/Persistence.ts +3 -3
  939. package/src/unstable/persistence/RateLimiter.ts +4 -4
  940. package/src/unstable/process/ChildProcess.ts +6 -208
  941. package/src/unstable/process/ChildProcessSpawner.ts +75 -14
  942. package/src/unstable/reactivity/Atom.ts +211 -50
  943. package/src/unstable/reactivity/AtomHttpApi.ts +66 -31
  944. package/src/unstable/reactivity/AtomRegistry.ts +61 -9
  945. package/src/unstable/reactivity/AtomRpc.ts +51 -20
  946. package/src/unstable/reactivity/Hydration.ts +112 -0
  947. package/src/unstable/reactivity/index.ts +5 -0
  948. package/src/unstable/rpc/Rpc.ts +7 -9
  949. package/src/unstable/rpc/RpcClient.ts +12 -54
  950. package/src/unstable/rpc/RpcGroup.ts +7 -7
  951. package/src/unstable/rpc/RpcMiddleware.ts +15 -9
  952. package/src/unstable/rpc/RpcSchema.ts +17 -0
  953. package/src/unstable/rpc/RpcSerialization.ts +44 -9
  954. package/src/unstable/rpc/RpcServer.ts +28 -32
  955. package/src/unstable/rpc/Utils.ts +3 -2
  956. package/src/unstable/schema/Model.ts +31 -0
  957. package/src/unstable/schema/VariantSchema.ts +9 -9
  958. package/src/unstable/socket/Socket.ts +16 -17
  959. package/src/unstable/sql/SqlClient.ts +1 -1
  960. package/src/unstable/sql/SqlError.ts +11 -9
  961. package/src/unstable/sql/SqlModel.ts +5 -5
  962. package/src/unstable/sql/SqlResolver.ts +17 -7
  963. package/src/unstable/sql/SqlSchema.ts +42 -26
  964. package/src/unstable/sql/Statement.ts +0 -1
  965. package/src/unstable/workers/Worker.ts +2 -1
  966. package/src/unstable/workflow/DurableClock.ts +8 -8
  967. package/src/unstable/workflow/DurableDeferred.ts +2 -2
  968. package/src/unstable/workflow/Workflow.ts +6 -2
  969. package/src/unstable/workflow/WorkflowEngine.ts +185 -2
  970. package/dist/PartitionedSemaphore.d.ts +0 -52
  971. package/dist/PartitionedSemaphore.d.ts.map +0 -1
  972. package/dist/PartitionedSemaphore.js.map +0 -1
  973. package/dist/encoding/Base64.d.ts +0 -67
  974. package/dist/encoding/Base64.d.ts.map +0 -1
  975. package/dist/encoding/Base64.js +0 -146
  976. package/dist/encoding/Base64.js.map +0 -1
  977. package/dist/encoding/Base64Url.d.ts +0 -60
  978. package/dist/encoding/Base64Url.d.ts.map +0 -1
  979. package/dist/encoding/Base64Url.js +0 -89
  980. package/dist/encoding/Base64Url.js.map +0 -1
  981. package/dist/encoding/EncodingError.d.ts +0 -31
  982. package/dist/encoding/EncodingError.d.ts.map +0 -1
  983. package/dist/encoding/EncodingError.js +0 -22
  984. package/dist/encoding/EncodingError.js.map +0 -1
  985. package/dist/encoding/Hex.d.ts +0 -61
  986. package/dist/encoding/Hex.d.ts.map +0 -1
  987. package/dist/encoding/Hex.js +0 -115
  988. package/dist/encoding/Hex.js.map +0 -1
  989. package/dist/encoding/index.d.ts +0 -26
  990. package/dist/encoding/index.d.ts.map +0 -1
  991. package/dist/encoding/index.js +0 -27
  992. package/dist/encoding/index.js.map +0 -1
  993. package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
  994. package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
  995. package/dist/unstable/cli/internal/builtInFlags.js +0 -44
  996. package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
  997. package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
  998. package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
  999. package/dist/unstable/cli/internal/completions/Completions.js +0 -23
  1000. package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
  1001. package/src/PartitionedSemaphore.ts +0 -182
  1002. package/src/encoding/Base64.ts +0 -366
  1003. package/src/encoding/Base64Url.ts +0 -104
  1004. package/src/encoding/EncodingError.ts +0 -35
  1005. package/src/encoding/Hex.ts +0 -390
  1006. package/src/encoding/index.ts +0 -31
  1007. package/src/unstable/cli/internal/builtInFlags.ts +0 -78
  1008. package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Schema.d.ts CHANGED
@@ -1,9 +1,94 @@
1
1
  /**
2
+ * Define data shapes, validate unknown input, and transform values between formats.
3
+ *
4
+ * ## Mental model
5
+ *
6
+ * - **Schema** — a description of a data shape. Every schema carries a decoded
7
+ * *Type* (the value you work with) and an *Encoded* representation (the
8
+ * serialized form, e.g. JSON).
9
+ * - **Decoding** — turning unknown external data (API responses, form
10
+ * submissions, config files) into typed, validated values.
11
+ * - **Encoding** — turning typed values back into a serializable format.
12
+ * - **Codec** — a schema that tracks both Type and Encoded, so it can decode
13
+ * *and* encode. Most concrete schemas are Codecs.
14
+ * - **Check / Filter** — a constraint attached to a schema (e.g. `isMinLength`,
15
+ * `isGreaterThan`). Attach them with `.check(...)`.
16
+ * - **Transformation** — a pair of functions (decode + encode) that convert
17
+ * values between two schemas. Created with {@link decodeTo} / {@link encodeTo}.
18
+ * - **Annotation** — metadata attached to a schema (title, description, custom
19
+ * keys). Attach with `.annotate(...)`.
20
+ *
21
+ * ## Common tasks
22
+ *
23
+ * - Define a struct: {@link Struct}
24
+ * - Define a union: {@link Union}, {@link TaggedUnion}, {@link Literals}
25
+ * - Define an array: {@link Array}, {@link NonEmptyArray}
26
+ * - Define a record: {@link Record}
27
+ * - Define a tuple: {@link Tuple}, {@link TupleWithRest}
28
+ * - Validate unknown data synchronously: {@link decodeUnknownSync}
29
+ * - Validate unknown data (Effect): {@link decodeUnknownEffect}
30
+ * - Encode a value: {@link encodeUnknownSync}, {@link encodeUnknownEffect}
31
+ * - Type guard: {@link is}
32
+ * - Assertion: {@link asserts}
33
+ * - Add constraints: `.check(...)` with filters like {@link isMinLength},
34
+ * {@link isGreaterThan}, {@link isPattern}, {@link isUUID}
35
+ * - Transform between schemas: {@link decodeTo}, {@link encodeTo}
36
+ * - Add a default for missing keys: {@link withDecodingDefault}, {@link withDecodingDefaultKey}
37
+ * - Create branded types: {@link brand}
38
+ * - Define classes with validation: {@link Class}, {@link TaggedClass}
39
+ * - Define error classes: {@link ErrorClass}, {@link TaggedErrorClass}
40
+ * - Generate JSON Schema: {@link toJsonSchemaDocument}
41
+ * - Generate test data: {@link toArbitrary}
42
+ * - Derive equivalence: {@link toEquivalence}
43
+ *
44
+ * ## Gotchas
45
+ *
46
+ * - `Schema.optional` creates `T | undefined` (key can be missing *or*
47
+ * `undefined`). Use `Schema.optionalKey` for exact optional properties.
48
+ * - `decodeTo` is curried: use `from.pipe(Schema.decodeTo(to, ...))`.
49
+ * - `decodeUnknownSync` throws on failure. Use `decodeUnknownExit` or
50
+ * `decodeUnknownOption` for non-throwing alternatives.
51
+ * - Filters do not change the TypeScript type. Use {@link refine} or
52
+ * {@link brand} to narrow the type.
53
+ * - Recursive schemas require {@link suspend} to avoid infinite loops.
54
+ *
55
+ * ## Quickstart
56
+ *
57
+ * **Example** (Validate a user object)
58
+ *
59
+ * ```ts
60
+ * import { Schema } from "effect"
61
+ *
62
+ * const User = Schema.Struct({
63
+ * name: Schema.String.check(Schema.isMinLength(1)),
64
+ * age: Schema.Number.check(Schema.isGreaterThanOrEqualTo(0)),
65
+ * email: Schema.optionalKey(Schema.String)
66
+ * })
67
+ *
68
+ * // Decode unknown input — throws on failure
69
+ * const user = Schema.decodeUnknownSync(User)({
70
+ * name: "Alice",
71
+ * age: 30
72
+ * })
73
+ *
74
+ * console.log(user)
75
+ * // { name: "Alice", age: 30 }
76
+ * ```
77
+ *
78
+ * @see {@link Schema} — type-level view tracking only the decoded Type
79
+ * @see {@link Codec} — type-level view tracking both Type and Encoded
80
+ * @see {@link Struct} — define object shapes
81
+ * @see {@link decodeUnknownSync} — synchronous validation
82
+ * @see {@link decodeTo} — schema transformations
83
+ *
2
84
  * @since 4.0.0
3
85
  */
86
+ /** @effect-diagnostics schemaStructWithTag:skip-file */
4
87
  import type { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
88
+ import * as BigDecimal_ from "./BigDecimal.ts";
5
89
  import type * as Brand from "./Brand.ts";
6
90
  import * as Cause_ from "./Cause.ts";
91
+ import * as Chunk_ from "./Chunk.ts";
7
92
  import type * as Combiner from "./Combiner.ts";
8
93
  import * as DateTime from "./DateTime.ts";
9
94
  import type { Differ } from "./Differ.ts";
@@ -12,6 +97,8 @@ import * as Effect from "./Effect.ts";
12
97
  import * as Equivalence from "./Equivalence.ts";
13
98
  import * as Exit_ from "./Exit.ts";
14
99
  import type { Formatter } from "./Formatter.ts";
100
+ import * as HashMap_ from "./HashMap.ts";
101
+ import * as HashSet_ from "./HashSet.ts";
15
102
  import * as JsonPatch from "./JsonPatch.ts";
16
103
  import * as JsonSchema from "./JsonSchema.ts";
17
104
  import * as Optic_ from "./Optic.ts";
@@ -29,28 +116,42 @@ import type { Assign, Lambda, Mutable, Simplify } from "./Struct.ts";
29
116
  import * as Struct_ from "./Struct.ts";
30
117
  import * as FastCheck from "./testing/FastCheck.ts";
31
118
  import type { UnionToIntersection } from "./Types.ts";
119
+ import type { Unify } from "./Unify.ts";
32
120
  declare const TypeId = "~effect/Schema/Schema";
33
121
  /**
34
- * Is this schema required or optional?
122
+ * Whether a schema field is required or optional within a struct.
123
+ *
124
+ * @see {@link optionalKey} — mark a struct field as optional
125
+ * @see {@link optional} — mark a struct field as optional with `| undefined`
35
126
  *
36
127
  * @since 4.0.0
37
128
  */
38
129
  export type Optionality = "required" | "optional";
39
130
  /**
40
- * Is this schema read-only or mutable?
131
+ * Whether a schema field is readonly or mutable within a struct.
132
+ *
133
+ * @see {@link mutableKey} — mark a struct field as mutable
41
134
  *
42
135
  * @since 4.0.0
43
136
  */
44
137
  export type Mutability = "readonly" | "mutable";
45
138
  /**
46
- * Does the constructor of this schema supply a default value?
139
+ * Whether a schema field has a constructor default value.
140
+ *
141
+ * @see {@link withConstructorDefault} — add a default to a schema field
142
+ * @see {@link tag} — creates a literal field with a constructor default
47
143
  *
48
144
  * @since 4.0.0
49
145
  */
50
146
  export type ConstructorDefault = "no-default" | "with-default";
51
147
  /**
52
- * Configuration options for the `makeUnsafe` method, providing control over
53
- * parsing behavior and validation.
148
+ * Options for `makeUnsafe` and Class constructors.
149
+ *
150
+ * When to use:
151
+ * - Pass `disableValidation: true` to skip validation when you trust the data.
152
+ * - Pass `parseOptions` to control error reporting behavior.
153
+ *
154
+ * @see {@link Bottom.makeUnsafe}
54
155
  *
55
156
  * @since 4.0.0
56
157
  */
@@ -65,15 +166,19 @@ export interface MakeOptions {
65
166
  readonly disableValidation?: boolean | undefined;
66
167
  }
67
168
  /**
68
- * The base interface for all schemas in the Effect Schema library, exposing all
69
- * 14 type parameters that control schema behavior and type inference. Bottom
70
- * sits at the root of the schema type hierarchy and provides access to the
71
- * complete internal type information of schemas.
169
+ * The fully-parameterized base interface for all schemas. Exposes all 14 type
170
+ * parameters controlling type inference, mutability, optionality, services,
171
+ * and transformation behavior.
172
+ *
173
+ * When to use:
174
+ * - You are writing advanced generic schema utilities or performing schema
175
+ * introspection.
176
+ * - In user code, prefer {@link Schema}, {@link Codec}, {@link Decoder}, or
177
+ * {@link Encoder} instead.
72
178
  *
73
- * Bottom is primarily used for advanced type-level operations, schema
74
- * introspection, and when you need precise control over all aspects of schema
75
- * behavior including mutability, optionality, service dependencies, and
76
- * transformation characteristics.
179
+ * @see {@link Top} the existential "any schema" type (erased type params)
180
+ * @see {@link Schema} tracks only the decoded Type
181
+ * @see {@link Codec} tracks Type + Encoded
77
182
  *
78
183
  * @since 4.0.0
79
184
  */
@@ -103,71 +208,202 @@ export interface Bottom<out T, out E, out RD, out RE, out Ast extends AST.AST, o
103
208
  * @throws {Error} The issue is contained in the error cause.
104
209
  */
105
210
  makeUnsafe(input: this["~type.make.in"], options?: MakeOptions): this["Type"];
211
+ makeOption(input: this["~type.make.in"], options?: MakeOptions): Option_.Option<this["Type"]>;
106
212
  }
107
213
  /**
214
+ * The schema type returned by {@link declareConstructor}, tracking the decoded
215
+ * type `T`, the encoded type `E`, and the list of type-parameter schemas
216
+ * `TypeParameters`.
217
+ *
218
+ * @category Constructors
108
219
  * @since 4.0.0
109
220
  */
110
221
  export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<Top>, Iso = T> extends Bottom<T, E, TypeParameters[number]["DecodingServices"], TypeParameters[number]["EncodingServices"], AST.Declaration, declareConstructor<T, E, TypeParameters, Iso>, T, Iso, TypeParameters> {
111
222
  readonly "~rebuild.out": this;
112
223
  }
113
224
  /**
114
- * An API for creating schemas for parametric types.
225
+ * Creates a schema for a **parametric** type (a generic container such as
226
+ * `Array<A>`, `Option<A>`, etc.) by accepting a list of type-parameter schemas
227
+ * and a decoder factory.
228
+ *
229
+ * The outer call `declareConstructor<T, E, Iso>()` fixes the decoded type `T`,
230
+ * the encoded type `E`, and the optional iso type. The inner call receives:
231
+ * - `typeParameters` — the concrete schemas for each type variable
232
+ * - `run` — a factory that, given resolved codecs for each type parameter,
233
+ * returns a parsing function `(u, ast, options) => Effect<T, Issue>`
234
+ * - `annotations` — optional metadata
235
+ *
236
+ * @see {@link declare} for creating schemas for non-parametric types.
237
+ *
238
+ * **Example** (Schema for a parametric `Box<A>` type)
239
+ *
240
+ * ```ts
241
+ * import { Effect, Schema } from "effect"
242
+ * import * as SchemaParser from "effect/SchemaParser"
243
+ * import * as Issue from "effect/SchemaIssue"
244
+ * import * as Option from "effect/Option"
245
+ *
246
+ * interface Box<A> {
247
+ * readonly value: A
248
+ * }
249
+ *
250
+ * const isBox = (u: unknown): u is Box<unknown> =>
251
+ * typeof u === "object" && u !== null && "value" in u
252
+ *
253
+ * const Box = <A extends Schema.Top>(item: A) =>
254
+ * Schema.declareConstructor<Box<A["Type"]>, Box<A["Encoded"]>>()(
255
+ * [item],
256
+ * ([itemCodec]) =>
257
+ * (u, ast, options) => {
258
+ * if (!isBox(u)) {
259
+ * return Effect.fail(new Issue.InvalidType(ast, Option.some(u)))
260
+ * }
261
+ * return Effect.map(
262
+ * SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
263
+ * (value) => ({ value })
264
+ * )
265
+ * }
266
+ * )
115
267
  *
116
- * @see {@link declare} for creating schemas for non parametric types.
268
+ * const schema = Box(Schema.Number)
269
+ * ```
117
270
  *
118
271
  * @category Constructors
119
272
  * @since 4.0.0
120
273
  */
121
274
  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: AST.Declaration, options: AST.ParseOptions) => Effect.Effect<T, Issue.Issue>, annotations?: Annotations.Declaration<T, TypeParameters>) => declareConstructor<T, E, TypeParameters, Iso>;
122
275
  /**
276
+ * The schema type returned by {@link declare}, representing a non-parametric
277
+ * opaque type `T` with no type parameters.
278
+ *
123
279
  * @category Constructors
124
280
  * @since 4.0.0
125
281
  */
126
282
  export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [], Iso> {
127
283
  }
128
284
  /**
129
- * An API for creating schemas for non parametric types.
285
+ * Creates a schema for a **non-parametric** opaque type using a type-guard
286
+ * function. The schema accepts any unknown value and succeeds when `is` returns
287
+ * `true`, failing with an `InvalidType` issue otherwise.
288
+ *
289
+ * Use this when the type has no type parameters. For parametric types such as
290
+ * `Option<A>` or `Array<A>`, use {@link declareConstructor} instead.
291
+ *
292
+ * **Example** (Schema for a custom `UserId` branded type)
293
+ *
294
+ * ```ts
295
+ * import { Schema } from "effect"
296
+ *
297
+ * type UserId = string & { readonly _tag: "UserId" }
298
+ *
299
+ * const isUserId = (u: unknown): u is UserId =>
300
+ * typeof u === "string" && u.startsWith("user_")
301
+ *
302
+ * const UserId = Schema.declare<UserId>(isUserId, {
303
+ * title: "UserId",
304
+ * description: "A user identifier starting with 'user_'"
305
+ * })
306
+ * ```
130
307
  *
131
308
  * @see {@link declareConstructor} for creating schemas for parametric types.
132
309
  *
310
+ * @category Constructors
133
311
  * @since 4.0.0
134
312
  */
135
313
  export declare function declare<T, Iso = T>(is: (u: unknown) => u is T, annotations?: Annotations.Declaration<T> | undefined): declare<T, Iso>;
136
314
  /**
137
- * Reveals the complete Bottom interface type of a schema, exposing all 14 type
138
- * parameters.
315
+ * Widens a schema's type to the fully-parameterized {@link Bottom} interface,
316
+ * making all 14 type parameters visible to TypeScript.
317
+ *
318
+ * Normally, concrete schema interfaces (e.g. `Schema<string>`) hide most type
319
+ * parameters. `revealBottom` is useful when writing generic utilities that need
320
+ * to inspect or propagate the complete set of type parameters.
321
+ *
322
+ * **Example** (Inspecting all type parameters of a schema)
323
+ *
324
+ * ```ts
325
+ * import { Schema } from "effect"
326
+ *
327
+ * const schema = Schema.String
328
+ *
329
+ * // Widen to Bottom to access all 14 type parameters
330
+ * const bottom = Schema.revealBottom(schema)
331
+ *
332
+ * // `bottom` now exposes Type, Encoded, DecodingServices, EncodingServices,
333
+ * // ast, ~rebuild.out, ~type.make.in, Iso, ~type.parameters, etc.
334
+ * type T = typeof bottom["Type"] // string
335
+ * type E = typeof bottom["Encoded"] // string
336
+ * ```
139
337
  *
140
338
  * @since 4.0.0
141
339
  */
142
340
  export declare function revealBottom<S extends Top>(bottom: S): Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], S["~rebuild.out"], 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"]>;
143
341
  /**
144
342
  * Adds metadata annotations to a schema without changing its runtime behavior.
145
- * Annotations are used to provide additional context for documentation,
146
- * JSON schema generation, error formatting, and other tooling.
343
+ * This is the pipeable (curried) counterpart of the `.annotate` method.
344
+ *
345
+ * Annotations provide extra context used by documentation generators, JSON
346
+ * Schema converters, error formatters, and other tooling. Common keys include
347
+ * `title`, `description`, `examples`, `message`, and `identifier`.
348
+ *
349
+ * **Example** (Adding a title and description)
350
+ *
351
+ * ```ts
352
+ * import { Schema } from "effect"
353
+ *
354
+ * const Age = Schema.Number.pipe(
355
+ * Schema.annotate({
356
+ * title: "Age",
357
+ * description: "A non-negative integer representing age in years"
358
+ * })
359
+ * )
360
+ * ```
147
361
  *
148
362
  * @category Annotations
149
363
  * @since 4.0.0
150
364
  */
151
365
  export declare function annotate<S extends Top>(annotations: S["~annotate.in"]): (self: S) => S["~rebuild.out"];
152
366
  /**
153
- * Adds key-specific annotations to a schema field. This is useful for providing
154
- * custom error messages and documentation for individual fields within
155
- * structures.
367
+ * Adds key-level annotations to a schema field. This is the pipeable
368
+ * (curried) counterpart of the `.annotateKey` method.
369
+ *
370
+ * Key annotations apply to a field's position inside a `Struct` or `Tuple`
371
+ * rather than to the field's value type. They can carry a
372
+ * `messageMissingKey` to customise the error shown when the field is absent,
373
+ * as well as standard documentation fields such as `title`, `description`,
374
+ * and `examples`.
375
+ *
376
+ * **Example** (Custom missing-key message for a required field)
377
+ *
378
+ * ```ts
379
+ * import { Schema } from "effect"
380
+ *
381
+ * const schema = Schema.Struct({
382
+ * username: Schema.String.pipe(
383
+ * Schema.annotateKey({
384
+ * description: "The username used to log in",
385
+ * messageMissingKey: "Username is required"
386
+ * })
387
+ * )
388
+ * })
389
+ * ```
156
390
  *
157
391
  * @category Annotations
158
392
  * @since 4.0.0
159
393
  */
160
394
  export declare function annotateKey<S extends Top>(annotations: Annotations.Key<S["Type"]>): (self: S) => S["~rebuild.out"];
161
395
  /**
162
- * The top (most general) type for all schema-like values in this module.
396
+ * The existential "any schema" type all type parameters are erased to `unknown`.
163
397
  *
164
- * When to use:
165
- * - You are writing generic helpers and only need "some schema", without caring about its `Type` / `Encoded`.
166
- * - You need a common constraint for type-level utilities (for example in `Schema.Type` or `Codec.Encoded`).
398
+ * Use `Top` as a constraint when writing generic utilities that must accept *any*
399
+ * schema regardless of its `Type`, `Encoded`, or service requirements. It is the
400
+ * widest possible schema type and therefore gives you the least static information.
167
401
  *
168
- * Behavior:
169
- * - This is a *type-level* supertype; it does not represent a specific concrete schema.
170
- * - In user code, you usually want {@link Schema}, {@link Codec}, {@link Decoder}, or {@link Encoder} instead.
402
+ * In user code prefer the narrower interfaces:
403
+ * - {@link Schema}`<T>` when you only care about the decoded type
404
+ * - {@link Codec}`<T, E, RD, RE>` when you need the encoded type and service requirements
405
+ * - {@link Decoder}`<T, RD>` — for decode-only APIs
406
+ * - {@link Encoder}`<E, RE>` — for encode-only APIs
171
407
  *
172
408
  * @since 4.0.0
173
409
  */
@@ -175,24 +411,52 @@ export interface Top extends Bottom<unknown, unknown, unknown, unknown, AST.AST,
175
411
  unknown, Mutability, Optionality, ConstructorDefault, Mutability, Optionality> {
176
412
  }
177
413
  /**
414
+ * Namespace of type-level helpers for {@link Schema}.
415
+ *
178
416
  * @since 4.0.0
179
417
  */
180
418
  export declare namespace Schema {
181
419
  /**
420
+ * Extracts the decoded `Type` from a schema.
421
+ *
422
+ * **Example** (Extracting the decoded type)
423
+ *
424
+ * ```ts
425
+ * import { Schema } from "effect"
426
+ *
427
+ * const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })
428
+ * type Person = Schema.Schema.Type<typeof Person>
429
+ * // { readonly name: string; readonly age: number }
430
+ * ```
431
+ *
182
432
  * @since 4.0.0
183
433
  */
184
- type Type<S extends Top> = S["Type"];
434
+ type Type<S> = S extends Top ? S["Type"] : never;
185
435
  }
186
436
  /**
187
- * A typed view of a schema that tracks the decoded (output) type `T`.
437
+ * A typed view of a schema that tracks only the decoded (output) type `T`.
188
438
  *
189
- * When to use:
190
- * - You want to accept "any schema that decodes to `T`" in a function signature.
191
- * - You only care about the decoded type and do not need to talk about the encoded representation.
439
+ * Use `Schema<T>` as a constraint when you want to accept "any schema that
440
+ * decodes to `T`" and do not need to know or constrain the encoded
441
+ * representation, required services, or any other type parameters.
442
+ *
443
+ * This is a structural interface — concrete schema values are produced by the
444
+ * constructors in this module (e.g. {@link Struct}, {@link String}, {@link Number}).
445
+ * When you also need the encoded type or service requirements, use {@link Codec}.
446
+ *
447
+ * **Example** (Function that accepts any schema decoding to `string`)
448
+ *
449
+ * ```ts
450
+ * import { Schema } from "effect"
451
+ *
452
+ * declare function print(schema: Schema.Schema<string>): void
453
+ *
454
+ * print(Schema.String) // ok
455
+ * print(Schema.NonEmptyString) // ok
456
+ * ```
192
457
  *
193
- * Behavior:
194
- * - This is a structural interface used for typing; it does not by itself construct or run validation.
195
- * - If you also need the encoded type (or decoding/encoding services), use {@link Codec}.
458
+ * @see {@link Codec} — also tracks Encoded, DecodingServices, EncodingServices
459
+ * @see {@link Schema.Type} extract the decoded type at the type level
196
460
  *
197
461
  * @since 4.0.0
198
462
  */
@@ -201,22 +465,66 @@ export interface Schema<out T> extends Top {
201
465
  readonly "~rebuild.out": Schema<T>;
202
466
  }
203
467
  /**
468
+ * Namespace of type-level helpers for {@link Codec}.
469
+ *
204
470
  * @since 4.0.0
205
471
  */
206
472
  export declare namespace Codec {
207
473
  /**
474
+ * Extracts the encoded (`Encoded`) type from a schema.
475
+ *
476
+ * **Example** (Extracting the encoded type)
477
+ *
478
+ * ```ts
479
+ * import { Schema } from "effect"
480
+ *
481
+ * const schema = Schema.NumberFromString
482
+ * type Enc = Schema.Codec.Encoded<typeof schema>
483
+ * // string
484
+ * ```
485
+ *
208
486
  * @since 4.0.0
209
487
  */
210
- type Encoded<S extends Top> = S["Encoded"];
488
+ type Encoded<S> = S extends Top ? S["Encoded"] : never;
211
489
  /**
490
+ * Extracts the Effect services required during *decoding* from a schema.
491
+ *
492
+ * **Example** (Checking decoding service requirements)
493
+ *
494
+ * ```ts
495
+ * import { Schema } from "effect"
496
+ *
497
+ * const schema = Schema.String
498
+ * type RD = Schema.Codec.DecodingServices<typeof schema>
499
+ * // never
500
+ * ```
501
+ *
212
502
  * @since 4.0.0
213
503
  */
214
- type DecodingServices<S extends Top> = S["DecodingServices"];
504
+ type DecodingServices<S> = S extends Top ? S["DecodingServices"] : never;
215
505
  /**
506
+ * Extracts the Effect services required during *encoding* from a schema.
507
+ *
508
+ * **Example** (Checking encoding service requirements)
509
+ *
510
+ * ```ts
511
+ * import { Schema } from "effect"
512
+ *
513
+ * const schema = Schema.String
514
+ * type RE = Schema.Codec.EncodingServices<typeof schema>
515
+ * // never
516
+ * ```
517
+ *
216
518
  * @since 4.0.0
217
519
  */
218
- type EncodingServices<S extends Top> = S["EncodingServices"];
520
+ type EncodingServices<S> = S extends Top ? S["EncodingServices"] : never;
219
521
  /**
522
+ * Converts a schema type into an assertion function signature. The resulting
523
+ * function narrows its argument to `I & S["Type"]`. Only schemas with
524
+ * `DecodingServices: never` (i.e. no required services) can be used here.
525
+ *
526
+ * Produced by {@link asserts}.
527
+ *
220
528
  * @since 4.0.0
221
529
  */
222
530
  type ToAsserts<S extends Top & {
@@ -224,6 +532,18 @@ export declare namespace Codec {
224
532
  }> = <I>(input: I) => asserts input is I & S["Type"];
225
533
  }
226
534
  /**
535
+ * A schema that additionally supports optic (lens/prism) operations.
536
+ *
537
+ * `Optic<T, Iso>` extends {@link Schema}`<T>` with an `Iso` type that
538
+ * describes the isomorphic counterpart used by the optic layer. Crucially,
539
+ * decoding and encoding require *no* Effect services (`DecodingServices` and
540
+ * `EncodingServices` are both `never`), which means the optic can operate
541
+ * purely without an Effect runtime.
542
+ *
543
+ * Most primitive schemas (e.g. `Schema.String`, `Schema.Number`) implement
544
+ * `Optic` automatically. You normally interact with this interface through
545
+ * {@link Optic_} utilities rather than constructing it directly.
546
+ *
227
547
  * @since 4.0.0
228
548
  */
229
549
  export interface Optic<out T, out Iso> extends Schema<T> {
@@ -233,16 +553,32 @@ export interface Optic<out T, out Iso> extends Schema<T> {
233
553
  readonly "~rebuild.out": Optic<T, Iso>;
234
554
  }
235
555
  /**
236
- * A schema that tracks both the decoded type `T` and the encoded representation `E`.
556
+ * A schema that tracks the decoded type `T`, the encoded type `E`, and the
557
+ * Effect services required during decoding (`RD`) and encoding (`RE`).
237
558
  *
238
- * When to use:
239
- * - You want a schema in APIs that may both decode and encode.
240
- * - You need to preserve/describe the encoded representation (`Encoded`) in types.
241
- * - You need to model required services for decoding (`RD`) and encoding (`RE`).
559
+ * Use `Codec<T, E, RD, RE>` when you need to preserve full type information
560
+ * about a schema both what it decodes to and what it serializes from/to.
561
+ * Most concrete schemas produced by this module implement `Codec`.
562
+ *
563
+ * For APIs that only need one direction, prefer the narrower views:
564
+ * - {@link Decoder}`<T, RD>` — decode-only
565
+ * - {@link Encoder}`<E, RE>` — encode-only
566
+ * - {@link Schema}`<T>` — type-only (no encoded representation)
567
+ *
568
+ * **Example** (Accepting a codec that decodes to `number` from `string`)
569
+ *
570
+ * ```ts
571
+ * import { Schema } from "effect"
572
+ *
573
+ * declare function serialize<T>(codec: Schema.Codec<T, string>): string
574
+ *
575
+ * serialize(Schema.NumberFromString) // ok — decodes number, encoded as string
576
+ * ```
242
577
  *
243
- * Behavior:
244
- * - This is a typing surface; concrete schema values are created by the various constructors in this module.
245
- * - For decode-only or encode-only APIs, prefer {@link Decoder} or {@link Encoder}.
578
+ * @see {@link Codec.Encoded} — extract the encoded type
579
+ * @see {@link Codec.DecodingServices} extract required decoding services
580
+ * @see {@link Codec.EncodingServices} extract required encoding services
581
+ * @see {@link revealCodec} — helper to make TypeScript infer the full Codec type
246
582
  *
247
583
  * @since 4.0.0
248
584
  */
@@ -253,11 +589,22 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
253
589
  readonly "~rebuild.out": Codec<T, E, RD, RE>;
254
590
  }
255
591
  /**
256
- * A `Codec` view intended for APIs that only *decode* (parse/validate) values.
592
+ * A {@link Codec} view for APIs that only *decode* (parse/validate) values.
257
593
  *
258
- * When to use:
259
- * - You want to accept "anything that can decode to `T`", without requiring encoding support.
260
- * - You are writing helpers that should not depend on the schema’s `Encoded` representation.
594
+ * Use `Decoder<T, RD>` to accept "any schema that can decode to `T`" without
595
+ * constraining or depending on the encoded representation (`Encoded` is
596
+ * `unknown`) or encoding services.
597
+ *
598
+ * **Example** (Function that only needs to decode)
599
+ *
600
+ * ```ts
601
+ * import { Schema } from "effect"
602
+ *
603
+ * declare function validate<T>(decoder: Schema.Decoder<T>): (input: unknown) => T
604
+ *
605
+ * validate(Schema.String) // ok
606
+ * validate(Schema.NumberFromString) // ok
607
+ * ```
261
608
  *
262
609
  * @since 4.0.0
263
610
  */
@@ -265,11 +612,22 @@ export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, un
265
612
  readonly "~rebuild.out": Decoder<T, RD>;
266
613
  }
267
614
  /**
268
- * A `Codec` view intended for APIs that only *encode* values.
615
+ * A {@link Codec} view for APIs that only *encode* values.
269
616
  *
270
- * When to use:
271
- * - You want to accept "anything that can encode to `E`", without requiring decoding support.
272
- * - You are writing helpers that should not depend on the schema’s decoded `Type`.
617
+ * Use `Encoder<E, RE>` to accept "any schema that can encode to `E`" without
618
+ * constraining or depending on the decoded `Type` (`Type` is `unknown`) or
619
+ * decoding services.
620
+ *
621
+ * **Example** (Function that only needs to encode)
622
+ *
623
+ * ```ts
624
+ * import { Schema } from "effect"
625
+ *
626
+ * declare function serialize<E>(encoder: Schema.Encoder<E>): (value: unknown) => E
627
+ *
628
+ * serialize(Schema.String) // ok — encodes to string
629
+ * serialize(Schema.NumberFromString) // ok — encodes number to string
630
+ * ```
273
631
  *
274
632
  * @since 4.0.0
275
633
  */
@@ -277,17 +635,54 @@ export interface Encoder<out E, out RE = never> extends Codec<unknown, E, unknow
277
635
  readonly "~rebuild.out": Encoder<E, RE>;
278
636
  }
279
637
  /**
638
+ * Identity function that widens a value to the full {@link Codec} interface,
639
+ * prompting TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).
640
+ *
641
+ * When a schema is stored in a variable typed as `Schema<T>` or `Top`, the
642
+ * encoded type and service requirements are erased. Passing the value through
643
+ * `revealCodec` recovers those parameters without any runtime cost.
644
+ *
645
+ * **Example** (Recovering encoded type from a schema variable)
646
+ *
647
+ * ```ts
648
+ * import { Schema } from "effect"
649
+ *
650
+ * const schema: Schema.Schema<number> = Schema.NumberFromString
651
+ *
652
+ * // Without revealCodec, Encoded is unknown
653
+ * const codec = Schema.revealCodec(schema)
654
+ * type Enc = typeof codec["Encoded"] // string
655
+ * ```
656
+ *
280
657
  * @since 4.0.0
281
658
  */
282
659
  export declare function revealCodec<T, E, RD, RE>(codec: Codec<T, E, RD, RE>): Codec<T, E, RD, RE>;
283
660
  declare const SchemaErrorTypeId = "~effect/Schema/SchemaError";
284
661
  /**
285
- * A `SchemaError` is returned when schema decoding or encoding fails.
662
+ * Error thrown (or returned as the error channel value) when schema decoding
663
+ * or encoding fails.
664
+ *
665
+ * The `issue` field contains a structured {@link Issue.Issue} tree describing
666
+ * every validation failure, including the path to the problematic value,
667
+ * expected types, and actual values received. `message` renders the issue tree
668
+ * as a human-readable string.
669
+ *
670
+ * Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
671
+ *
672
+ * **Example** (Catching a SchemaError)
286
673
  *
287
- * This error extends `Data.TaggedError` and contains detailed information about
288
- * what went wrong during schema processing. The error includes an `issue` field
289
- * that provides comprehensive details about the validation failure, including
290
- * the path to the problematic data, expected types, and actual values.
674
+ * ```ts
675
+ * import { Schema } from "effect"
676
+ *
677
+ * try {
678
+ * Schema.decodeUnknownSync(Schema.Number)("not a number")
679
+ * } catch (err) {
680
+ * if (Schema.isSchemaError(err)) {
681
+ * console.log(err.message)
682
+ * // Expected number, actual "not a number"
683
+ * }
684
+ * }
685
+ * ```
291
686
  *
292
687
  * @since 4.0.0
293
688
  */
@@ -301,6 +696,22 @@ export declare class SchemaError {
301
696
  toString(): string;
302
697
  }
303
698
  /**
699
+ * Returns `true` if `u` is a {@link SchemaError}.
700
+ *
701
+ * **Example** (Type guard in a catch block)
702
+ *
703
+ * ```ts
704
+ * import { Schema } from "effect"
705
+ *
706
+ * try {
707
+ * Schema.decodeUnknownSync(Schema.Number)("oops")
708
+ * } catch (err) {
709
+ * if (Schema.isSchemaError(err)) {
710
+ * console.log(err._tag) // "SchemaError"
711
+ * }
712
+ * }
713
+ * ```
714
+ *
304
715
  * @since 4.0.0
305
716
  */
306
717
  export declare function isSchemaError(u: unknown): u is SchemaError;
@@ -450,16 +861,32 @@ export declare const is: typeof Parser.is;
450
861
  */
451
862
  export declare const asserts: typeof Parser.asserts;
452
863
  /**
864
+ * Decodes an `unknown` input against a schema, returning an `Effect` that
865
+ * succeeds with the decoded value or fails with a {@link SchemaError}. Use this
866
+ * when the input type is not statically known. Prefer {@link decodeEffect} when
867
+ * the input is already typed as the schema's `Encoded` type.
868
+ *
453
869
  * @category Decoding
454
870
  * @since 4.0.0
455
871
  */
456
872
  export declare function decodeUnknownEffect<S extends Top>(schema: S): (input: unknown, options?: AST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
457
873
  /**
874
+ * Decodes a typed input (the schema's `Encoded` type) against a schema,
875
+ * returning an `Effect` that succeeds with the decoded value or fails with a
876
+ * {@link SchemaError}. Use this when the input is already typed; for `unknown`
877
+ * input use {@link decodeUnknownEffect}.
878
+ *
458
879
  * @category Decoding
459
880
  * @since 4.0.0
460
881
  */
461
882
  export declare const decodeEffect: <S extends Top>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
462
883
  /**
884
+ * Decodes an `unknown` input against a schema synchronously, returning an
885
+ * `Exit` that is either a `Success` with the decoded value or a `Failure` with
886
+ * a {@link SchemaError}. Only usable with schemas that have no
887
+ * `DecodingServices` requirement. Prefer {@link decodeExit} when the input is
888
+ * already typed as the schema's `Encoded` type.
889
+ *
463
890
  * @category Decoding
464
891
  * @since 4.0.0
465
892
  */
@@ -467,6 +894,12 @@ export declare function decodeUnknownExit<S extends Top & {
467
894
  readonly DecodingServices: never;
468
895
  }>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
469
896
  /**
897
+ * Decodes a typed input (the schema's `Encoded` type) against a schema
898
+ * synchronously, returning an `Exit` that is either a `Success` with the
899
+ * decoded value or a `Failure` with a {@link SchemaError}. Only usable with
900
+ * schemas that have no `DecodingServices` requirement. For `unknown` input use
901
+ * {@link decodeUnknownExit}.
902
+ *
470
903
  * @category Decoding
471
904
  * @since 4.0.0
472
905
  */
@@ -474,11 +907,21 @@ export declare const decodeExit: <S extends Top & {
474
907
  readonly DecodingServices: never;
475
908
  }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
476
909
  /**
910
+ * Decodes an `unknown` input against a schema, returning an `Option` that is
911
+ * `Some` with the decoded value on success or `None` on failure. Prefer this
912
+ * over {@link decodeUnknownExit} or {@link decodeUnknownEffect} when you only
913
+ * need to know whether decoding succeeded and don't need error details. For
914
+ * typed input use {@link decodeOption}.
915
+ *
477
916
  * @category Decoding
478
917
  * @since 4.0.0
479
918
  */
480
919
  export declare const decodeUnknownOption: typeof Parser.decodeUnknownOption;
481
920
  /**
921
+ * Decodes a typed input (the schema's `Encoded` type) against a schema,
922
+ * returning an `Option` that is `Some` with the decoded value on success or
923
+ * `None` on failure. For `unknown` input use {@link decodeUnknownOption}.
924
+ *
482
925
  * @category Decoding
483
926
  * @since 4.0.0
484
927
  */
@@ -486,21 +929,58 @@ export declare const decodeOption: <S extends Top & {
486
929
  readonly DecodingServices: never;
487
930
  }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => Option_.Option<S["Type"]>;
488
931
  /**
932
+ * Decodes an `unknown` input against a schema, returning a `Promise` that
933
+ * resolves with the decoded value or rejects with a {@link SchemaError}. Useful
934
+ * for integrating with Promise-based APIs. For typed input use
935
+ * {@link decodePromise}.
936
+ *
489
937
  * @category Decoding
490
938
  * @since 4.0.0
491
939
  */
492
940
  export declare const decodeUnknownPromise: typeof Parser.decodeUnknownPromise;
493
941
  /**
942
+ * Decodes a typed input (the schema's `Encoded` type) against a schema,
943
+ * returning a `Promise` that resolves with the decoded value or rejects with a
944
+ * {@link SchemaError}. For `unknown` input use {@link decodeUnknownPromise}.
945
+ *
494
946
  * @category Decoding
495
947
  * @since 4.0.0
496
948
  */
497
949
  export declare const decodePromise: typeof Parser.decodePromise;
498
950
  /**
951
+ * Decodes an `unknown` input against a schema synchronously, throwing a
952
+ * {@link SchemaError} on failure. Use this when you want to validate data at a
953
+ * boundary and treat a schema mismatch as an unrecoverable error. For
954
+ * non-throwing alternatives see {@link decodeUnknownOption},
955
+ * {@link decodeUnknownExit}, or {@link decodeUnknownEffect}. For typed input
956
+ * use {@link decodeSync}.
957
+ *
958
+ * **Example** (Decoding with a transformation schema)
959
+ *
960
+ * ```ts
961
+ * import { Schema } from "effect"
962
+ *
963
+ * const NumberFromString = Schema.NumberFromString
964
+ *
965
+ * console.log(Schema.decodeUnknownSync(NumberFromString)("42"))
966
+ * // Output: 42
967
+ *
968
+ * Schema.decodeUnknownSync(NumberFromString)("not a number")
969
+ * // throws SchemaError: NumberFromString
970
+ * // └─ Encoded side transformation failure
971
+ * // └─ NumberFromString
972
+ * // └─ Expected a numeric string, actual "not a number"
973
+ * ```
974
+ *
499
975
  * @category Decoding
500
976
  * @since 4.0.0
501
977
  */
502
978
  export declare const decodeUnknownSync: typeof Parser.decodeUnknownSync;
503
979
  /**
980
+ * Decodes a typed input (the schema's `Encoded` type) against a schema
981
+ * synchronously, throwing a {@link SchemaError} on failure. For `unknown` input
982
+ * use {@link decodeUnknownSync}.
983
+ *
504
984
  * @category Decoding
505
985
  * @since 4.0.0
506
986
  */
@@ -508,16 +988,43 @@ export declare const decodeSync: <S extends Top & {
508
988
  readonly DecodingServices: never;
509
989
  }>(schema: S) => (input: S["Encoded"], options?: AST.ParseOptions) => S["Type"];
510
990
  /**
991
+ * Encodes an `unknown` input against a schema, returning an `Effect` that
992
+ * succeeds with the encoded value or fails with a {@link SchemaError}. Use this
993
+ * when the input type is not statically known. Prefer {@link encodeEffect} when
994
+ * the input is already typed as the schema's `Type`.
995
+ *
996
+ * **Example** (Encoding a value to a string)
997
+ *
998
+ * ```ts
999
+ * import { Effect, Schema } from "effect"
1000
+ *
1001
+ * const NumberFromString = Schema.NumberFromString
1002
+ *
1003
+ * Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42)).then(console.log)
1004
+ * // Output: "42"
1005
+ * ```
1006
+ *
511
1007
  * @category Encoding
512
1008
  * @since 4.0.0
513
1009
  */
514
1010
  export declare function encodeUnknownEffect<S extends Top>(schema: S): (input: unknown, options?: AST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
515
1011
  /**
1012
+ * Encodes a typed input (the schema's `Type`) against a schema, returning an
1013
+ * `Effect` that succeeds with the encoded value or fails with a
1014
+ * {@link SchemaError}. Use this when the input is already typed; for `unknown`
1015
+ * input use {@link encodeUnknownEffect}.
1016
+ *
516
1017
  * @category Encoding
517
1018
  * @since 4.0.0
518
1019
  */
519
1020
  export declare const encodeEffect: <S extends Top>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
520
1021
  /**
1022
+ * Encodes an `unknown` input against a schema synchronously, returning an
1023
+ * `Exit` that is either a `Success` with the encoded value or a `Failure` with
1024
+ * a {@link SchemaError}. Only usable with schemas that have no
1025
+ * `EncodingServices` requirement. Prefer {@link encodeExit} when the input is
1026
+ * already typed as the schema's `Type`.
1027
+ *
521
1028
  * @category Encoding
522
1029
  * @since 4.0.0
523
1030
  */
@@ -525,6 +1032,12 @@ export declare function encodeUnknownExit<S extends Top & {
525
1032
  readonly EncodingServices: never;
526
1033
  }>(schema: S): (input: unknown, options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
527
1034
  /**
1035
+ * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1036
+ * returning an `Exit` that is either a `Success` with the encoded value or a
1037
+ * `Failure` with a {@link SchemaError}. Only usable with schemas that have no
1038
+ * `EncodingServices` requirement. For `unknown` input use
1039
+ * {@link encodeUnknownExit}.
1040
+ *
528
1041
  * @category Encoding
529
1042
  * @since 4.0.0
530
1043
  */
@@ -532,11 +1045,21 @@ export declare const encodeExit: <S extends Top & {
532
1045
  readonly EncodingServices: never;
533
1046
  }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
534
1047
  /**
1048
+ * Encodes an `unknown` input against a schema, returning an `Option` that is
1049
+ * `Some` with the encoded value on success or `None` on failure. Prefer this
1050
+ * over {@link encodeUnknownExit} or {@link encodeUnknownEffect} when you only
1051
+ * need to know whether encoding succeeded and don't need error details. For
1052
+ * typed input use {@link encodeOption}.
1053
+ *
535
1054
  * @category Encoding
536
1055
  * @since 4.0.0
537
1056
  */
538
1057
  export declare const encodeUnknownOption: typeof Parser.encodeUnknownOption;
539
1058
  /**
1059
+ * Encodes a typed input (the schema's `Type`) against a schema, returning an
1060
+ * `Option` that is `Some` with the encoded value on success or `None` on
1061
+ * failure. For `unknown` input use {@link encodeUnknownOption}.
1062
+ *
540
1063
  * @category Encoding
541
1064
  * @since 4.0.0
542
1065
  */
@@ -544,6 +1067,11 @@ export declare const encodeOption: <S extends Top & {
544
1067
  readonly EncodingServices: never;
545
1068
  }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Option_.Option<S["Encoded"]>;
546
1069
  /**
1070
+ * Encodes an `unknown` input against a schema, returning a `Promise` that
1071
+ * resolves with the encoded value or rejects with a {@link SchemaError}. Useful
1072
+ * for integrating with Promise-based APIs. For typed input use
1073
+ * {@link encodePromise}.
1074
+ *
547
1075
  * @category Encoding
548
1076
  * @since 4.0.0
549
1077
  */
@@ -551,6 +1079,10 @@ export declare const encodeUnknownPromise: <S extends Top & {
551
1079
  readonly EncodingServices: never;
552
1080
  }>(schema: S) => (input: unknown, options?: AST.ParseOptions) => Promise<S["Encoded"]>;
553
1081
  /**
1082
+ * Encodes a typed input (the schema's `Type`) against a schema, returning a
1083
+ * `Promise` that resolves with the encoded value or rejects with a
1084
+ * {@link SchemaError}. For `unknown` input use {@link encodeUnknownPromise}.
1085
+ *
554
1086
  * @category Encoding
555
1087
  * @since 4.0.0
556
1088
  */
@@ -558,31 +1090,28 @@ export declare const encodePromise: <S extends Top & {
558
1090
  readonly EncodingServices: never;
559
1091
  }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => Promise<S["Encoded"]>;
560
1092
  /**
1093
+ * Encodes an `unknown` input against a schema synchronously, throwing a
1094
+ * {@link SchemaError} on failure. Use this when you want to serialize data at a
1095
+ * boundary and treat a schema mismatch as an unrecoverable error. For
1096
+ * non-throwing alternatives see {@link encodeUnknownOption},
1097
+ * {@link encodeUnknownExit}, or {@link encodeUnknownEffect}. For typed input
1098
+ * use {@link encodeSync}.
1099
+ *
561
1100
  * @category Encoding
562
1101
  * @since 4.0.0
563
1102
  */
564
1103
  export declare const encodeUnknownSync: typeof Parser.encodeUnknownSync;
565
1104
  /**
1105
+ * Encodes a typed input (the schema's `Type`) against a schema synchronously,
1106
+ * throwing a {@link SchemaError} on failure. For `unknown` input use
1107
+ * {@link encodeUnknownSync}.
1108
+ *
566
1109
  * @category Encoding
567
1110
  * @since 4.0.0
568
1111
  */
569
1112
  export declare const encodeSync: <S extends Top & {
570
1113
  readonly EncodingServices: never;
571
- }>(schema: S) => (input: S["Type"], options
572
- /**
573
- * The top (most general) type for all schema-like values in this module.
574
- *
575
- * When to use:
576
- * - You are writing generic helpers and only need "some schema", without caring about its `Type` / `Encoded`.
577
- * - You need a common constraint for type-level utilities (for example in `Schema.Type` or `Codec.Encoded`).
578
- *
579
- * Behavior:
580
- * - This is a *type-level* supertype; it does not represent a specific concrete schema.
581
- * - In user code, you usually want {@link Schema}, {@link Codec}, {@link Decoder}, or {@link Encoder} instead.
582
- *
583
- * @since 4.0.0
584
- */
585
- ?: AST.ParseOptions) => S["Encoded"];
1114
+ }>(schema: S) => (input: S["Type"], options?: AST.ParseOptions) => S["Encoded"];
586
1115
  /**
587
1116
  * Creates a schema from an AST (Abstract Syntax Tree) node.
588
1117
  *
@@ -607,6 +1136,10 @@ export declare const make: <S extends Top>(ast: S["ast"], options?: object) => S
607
1136
  */
608
1137
  export declare function isSchema(u: unknown): u is Top;
609
1138
  /**
1139
+ * Schema type for an exact optional struct key. The key may be absent, but
1140
+ * when present must match the wrapped schema (no implicit `undefined`).
1141
+ * Produced by {@link optionalKey}.
1142
+ *
610
1143
  * @since 4.0.0
611
1144
  */
612
1145
  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"> {
@@ -644,10 +1177,16 @@ interface requiredKeyLambda extends Lambda {
644
1177
  readonly "~lambda.out": this["~lambda.in"] extends optionalKey<Top> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for requiredKey";
645
1178
  }
646
1179
  /**
1180
+ * Reverses {@link optionalKey}, returning the inner required schema. Only
1181
+ * applicable to schemas already wrapped with `optionalKey`.
1182
+ *
647
1183
  * @since 4.0.0
648
1184
  */
649
1185
  export declare const requiredKey: requiredKeyLambda;
650
1186
  /**
1187
+ * Schema type for an optional struct key that also accepts `undefined`.
1188
+ * Equivalent to `optionalKey<UndefinedOr<S>>`. Produced by {@link optional}.
1189
+ *
651
1190
  * @since 4.0.0
652
1191
  */
653
1192
  export interface optional<S extends Top> extends optionalKey<UndefinedOr<S>> {
@@ -657,27 +1196,26 @@ interface optionalLambda extends Lambda {
657
1196
  readonly "~lambda.out": this["~lambda.in"] extends Top ? optional<this["~lambda.in"]> : never;
658
1197
  }
659
1198
  /**
660
- * Creates an optional schema field that allows both the specified type and
1199
+ * Marks a struct field as optional, allowing the key to be absent or
661
1200
  * `undefined`.
662
1201
  *
663
- * This is equivalent to `optionalKey(UndefinedOr(schema))`, creating a field
664
- * that:
665
- * - Can be omitted from the object entirely
666
- * - Can be explicitly set to `undefined`
667
- * - Can contain the specified schema type
1202
+ * explicitly set to `undefined`. Equivalent to `optionalKey(UndefinedOr(S))`.
1203
+ *
1204
+ * Use {@link optionalKey} instead if you want exact optional semantics (absent
1205
+ * only, not `undefined`).
668
1206
  *
669
- * **Example** (Creating a struct with optional)
1207
+ * **Example** (Optional field accepting undefined)
670
1208
  *
671
1209
  * ```ts
672
1210
  * import { Schema } from "effect"
673
1211
  *
674
1212
  * const schema = Schema.Struct({
675
1213
  * name: Schema.String,
676
- * age: Schema.optionalKey(Schema.Number)
1214
+ * age: Schema.optional(Schema.Number)
677
1215
  * })
678
1216
  *
679
- * // Type: { readonly name: string; readonly age?: number | undefined }
680
- * type Person = typeof schema["Type"]
1217
+ * // { readonly name: string; readonly age?: number | undefined }
1218
+ * type Person = typeof schema.Type
681
1219
  * ```
682
1220
  *
683
1221
  * @since 4.0.0
@@ -688,10 +1226,16 @@ interface requiredLambda extends Lambda {
688
1226
  readonly "~lambda.out": this["~lambda.in"] extends optional<Top> ? this["~lambda.in"]["schema"]["members"][0] : "Error: schema not eligible for required";
689
1227
  }
690
1228
  /**
1229
+ * Reverses {@link optional}, returning the inner schema (unwrapping `UndefinedOr`).
1230
+ * Only applicable to schemas already wrapped with `optional`.
1231
+ *
691
1232
  * @since 4.0.0
692
1233
  */
693
1234
  export declare const required: requiredLambda;
694
1235
  /**
1236
+ * Schema type for a mutable struct key. The key's property is writable.
1237
+ * Produced by {@link mutableKey}.
1238
+ *
695
1239
  * @since 4.0.0
696
1240
  */
697
1241
  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"]> {
@@ -703,6 +1247,9 @@ interface mutableKeyLambda extends Lambda {
703
1247
  readonly "~lambda.out": this["~lambda.in"] extends Top ? mutableKey<this["~lambda.in"]> : never;
704
1248
  }
705
1249
  /**
1250
+ * Makes a struct field mutable (removes the `readonly` modifier on the property).
1251
+ * Use {@link readonlyKey} to reverse.
1252
+ *
706
1253
  * @since 4.0.0
707
1254
  */
708
1255
  export declare const mutableKey: mutableKeyLambda;
@@ -711,10 +1258,16 @@ interface readonlyKeyLambda extends Lambda {
711
1258
  readonly "~lambda.out": this["~lambda.in"] extends mutableKey<Top> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for readonlyKey";
712
1259
  }
713
1260
  /**
1261
+ * Reverses {@link mutableKey}, returning the inner schema as readonly again.
1262
+ * Only applicable to schemas already wrapped with `mutableKey`.
1263
+ *
714
1264
  * @since 4.0.0
715
1265
  */
716
1266
  export declare const readonlyKey: readonlyKeyLambda;
717
1267
  /**
1268
+ * Schema type that collapses a transformation schema to its decoded `Type` on
1269
+ * both sides (Type = Encoded = S["Type"]). Produced by {@link toType}.
1270
+ *
718
1271
  * @since 4.0.0
719
1272
  */
720
1273
  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"]> {
@@ -725,10 +1278,16 @@ interface toTypeLambda extends Lambda {
725
1278
  readonly "~lambda.out": this["~lambda.in"] extends Top ? toType<this["~lambda.in"]> : never;
726
1279
  }
727
1280
  /**
1281
+ * Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
1282
+ * discarding the encoding transformation path.
1283
+ *
728
1284
  * @since 4.0.0
729
1285
  */
730
1286
  export declare const toType: toTypeLambda;
731
1287
  /**
1288
+ * Schema type that collapses a transformation schema to its `Encoded` side on
1289
+ * both sides (Type = Encoded = S["Encoded"]). Produced by {@link toEncoded}.
1290
+ *
732
1291
  * @since 4.0.0
733
1292
  */
734
1293
  export interface toEncoded<S extends Top> extends Bottom<S["Encoded"], S["Encoded"], never, never, AST.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"]> {
@@ -739,11 +1298,17 @@ interface toEncodedLambda extends Lambda {
739
1298
  readonly "~lambda.out": this["~lambda.in"] extends Top ? toEncoded<this["~lambda.in"]> : never;
740
1299
  }
741
1300
  /**
1301
+ * Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,
1302
+ * discarding the decoding transformation path.
1303
+ *
742
1304
  * @since 4.0.0
743
1305
  */
744
1306
  export declare const toEncoded: toEncodedLambda;
745
1307
  declare const FlipTypeId = "~effect/Schema/flip";
746
1308
  /**
1309
+ * Schema type representing a flipped schema where `Type` and `Encoded` are
1310
+ * swapped. Produced by {@link flip}.
1311
+ *
747
1312
  * @since 4.0.0
748
1313
  */
749
1314
  export interface flip<S extends Top> extends Bottom<S["Encoded"], S["Type"], S["EncodingServices"], S["DecodingServices"], AST.AST, flip<S>, S["Encoded"], S["Encoded"], ReadonlyArray<Top>, S["Encoded"], S["~encoded.mutability"], S["~encoded.optionality"], ConstructorDefault, S["~type.mutability"], S["~type.optionality"]> {
@@ -752,10 +1317,26 @@ export interface flip<S extends Top> extends Bottom<S["Encoded"], S["Type"], S["
752
1317
  readonly schema: S;
753
1318
  }
754
1319
  /**
1320
+ * Swaps the `Type` and `Encoded` of a schema, inverting the transformation
1321
+ * direction. Calling `flip` twice returns the original schema.
1322
+ *
1323
+ * **Example** (Flip a number-from-string schema)
1324
+ *
1325
+ * ```ts
1326
+ * import { Schema } from "effect"
1327
+ *
1328
+ * // NumberFromString: decodes string → number
1329
+ * const flipped = Schema.flip(Schema.NumberFromString)
1330
+ * // flipped: decodes number → string
1331
+ * ```
1332
+ *
755
1333
  * @since 4.0.0
756
1334
  */
757
1335
  export declare function flip<S extends Top>(schema: S): S extends flip<infer F> ? F["~rebuild.out"] : flip<S>;
758
1336
  /**
1337
+ * Represents a schema for a single literal value.
1338
+ *
1339
+ * @see {@link Literal} for the constructor function.
759
1340
  * @since 4.0.0
760
1341
  */
761
1342
  export interface Literal<L extends AST.LiteralValue> extends Bottom<L, L, never, never, AST.Literal, Literal<L>> {
@@ -764,6 +1345,16 @@ export interface Literal<L extends AST.LiteralValue> extends Bottom<L, L, never,
764
1345
  transform<L2 extends AST.LiteralValue>(to: L2): decodeTo<Literal<L2>, Literal<L>>;
765
1346
  }
766
1347
  /**
1348
+ * Creates a schema for a single literal value (string, number, bigint, boolean, or null).
1349
+ *
1350
+ * **Example** (String literal)
1351
+ * ```ts
1352
+ * import { Schema } from "effect"
1353
+ *
1354
+ * const schema = Schema.Literal("hello")
1355
+ * // Type: Schema.Literal<"hello">
1356
+ * ```
1357
+ *
767
1358
  * @see {@link Literals} for a schema that represents a union of literals.
768
1359
  * @see {@link tag} for a schema that represents a literal value that can be
769
1360
  * used as a discriminator field in tagged unions and has a constructor default.
@@ -771,6 +1362,8 @@ export interface Literal<L extends AST.LiteralValue> extends Bottom<L, L, never,
771
1362
  */
772
1363
  export declare function Literal<L extends AST.LiteralValue>(literal: L): Literal<L>;
773
1364
  /**
1365
+ * Namespace for {@link TemplateLiteral} helper types.
1366
+ *
774
1367
  * @since 4.0.0
775
1368
  */
776
1369
  export declare namespace TemplateLiteral {
@@ -799,6 +1392,10 @@ export declare namespace TemplateLiteral {
799
1392
  type Encoded<Parts> = Parts extends readonly [...infer Init, infer Last] ? AppendType<Encoded<Init>, Last> : ``;
800
1393
  }
801
1394
  /**
1395
+ * Represents a schema that validates strings matching a template literal pattern.
1396
+ * The encoded type is a string formed by concatenating the parts.
1397
+ *
1398
+ * @see {@link TemplateLiteral} for the constructor function.
802
1399
  * @since 4.0.0
803
1400
  */
804
1401
  export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends Bottom<TemplateLiteral.Encoded<Parts>, TemplateLiteral.Encoded<Parts>, never, never, AST.TemplateLiteral, TemplateLiteral<Parts>> {
@@ -806,10 +1403,24 @@ export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends Bo
806
1403
  readonly parts: Parts;
807
1404
  }
808
1405
  /**
1406
+ * Creates a schema that validates strings matching a template literal pattern. Each part can be
1407
+ * a literal string/number/bigint or a schema whose encoded type is a string, number, or bigint.
1408
+ *
1409
+ * **Example** (URL path pattern)
1410
+ * ```ts
1411
+ * import { Schema } from "effect"
1412
+ *
1413
+ * const schema = Schema.TemplateLiteral(["/user/", Schema.Number])
1414
+ * // matches strings like "/user/123", "/user/42", etc.
1415
+ * ```
1416
+ *
1417
+ * @see {@link TemplateLiteralParser} for a schema that also parses matched parts into a tuple.
809
1418
  * @since 4.0.0
810
1419
  */
811
1420
  export declare function TemplateLiteral<const Parts extends TemplateLiteral.Parts>(parts: Parts): TemplateLiteral<Parts>;
812
1421
  /**
1422
+ * Namespace for {@link TemplateLiteralParser} helper types.
1423
+ *
813
1424
  * @since 4.0.0
814
1425
  */
815
1426
  export declare namespace TemplateLiteralParser {
@@ -822,6 +1433,10 @@ export declare namespace TemplateLiteralParser {
822
1433
  ] : [];
823
1434
  }
824
1435
  /**
1436
+ * Represents a schema that validates strings matching a template literal pattern and decodes
1437
+ * them into a tuple of typed values, one per schema part.
1438
+ *
1439
+ * @see {@link TemplateLiteralParser} for the constructor function.
825
1440
  * @since 4.0.0
826
1441
  */
827
1442
  export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> extends Bottom<TemplateLiteralParser.Type<Parts>, TemplateLiteral.Encoded<Parts>, never, never, AST.Arrays, TemplateLiteralParser<Parts>> {
@@ -829,10 +1444,26 @@ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> exte
829
1444
  readonly parts: Parts;
830
1445
  }
831
1446
  /**
832
- * @since 4.0.0
833
- */
834
- export declare function TemplateLiteralParser<const Parts extends TemplateLiteral.Parts>(parts: Parts): TemplateLiteralParser<Parts>;
1447
+ * Like {@link TemplateLiteral} but decodes the matched string into a readonly tuple of typed values,
1448
+ * one element per schema part.
1449
+ *
1450
+ * **Example** (Parse path parameters)
1451
+ * ```ts
1452
+ * import { Schema } from "effect"
1453
+ *
1454
+ * const schema = Schema.TemplateLiteralParser(["/user/", Schema.NumberFromString])
1455
+ * // decodes "/user/42" => readonly ["/user/", 42]
1456
+ * ```
1457
+ *
1458
+ * @see {@link TemplateLiteral} for a validation-only version that keeps the string encoded.
1459
+ * @since 4.0.0
1460
+ */
1461
+ export declare function TemplateLiteralParser<const Parts extends TemplateLiteral.Parts>(parts: Parts): TemplateLiteralParser<Parts>;
835
1462
  /**
1463
+ * Represents a schema derived from a TypeScript `const enum` or a plain enum object,
1464
+ * accepting any of its values.
1465
+ *
1466
+ * @see {@link Enum} for the constructor function.
836
1467
  * @since 4.0.0
837
1468
  */
838
1469
  export interface Enum<A extends {
@@ -842,176 +1473,262 @@ export interface Enum<A extends {
842
1473
  readonly enums: A;
843
1474
  }
844
1475
  /**
1476
+ * Creates a schema from a TypeScript enum object. Validates that the input is one of the enum's values.
1477
+ *
1478
+ * **Example** (Direction enum)
1479
+ * ```ts
1480
+ * import { Schema } from "effect"
1481
+ *
1482
+ * enum Direction {
1483
+ * Up = "Up",
1484
+ * Down = "Down"
1485
+ * }
1486
+ *
1487
+ * const schema = Schema.Enum(Direction)
1488
+ * // accepts "Up" or "Down"
1489
+ * ```
1490
+ *
845
1491
  * @since 4.0.0
846
1492
  */
847
1493
  export declare function Enum<A extends {
848
1494
  [x: string]: string | number;
849
1495
  }>(enums: A): Enum<A>;
850
1496
  /**
1497
+ * Schema for the `never` type. Always fails validation.
1498
+ *
1499
+ * @see {@link Never} for the schema value.
851
1500
  * @since 4.0.0
852
1501
  */
853
1502
  export interface Never extends Bottom<never, never, never, never, AST.Never, Never> {
854
1503
  readonly "~rebuild.out": this;
855
1504
  }
856
1505
  /**
1506
+ * Schema for the `never` type. Always fails validation — no value satisfies it.
1507
+ *
857
1508
  * @since 4.0.0
858
1509
  */
859
1510
  export declare const Never: Never;
860
1511
  /**
1512
+ * Schema for the `any` type. Accepts any value without validation.
1513
+ *
1514
+ * @see {@link Any} for the schema value.
861
1515
  * @since 4.0.0
862
1516
  */
863
1517
  export interface Any extends Bottom<any, any, never, never, AST.Any, Any> {
864
1518
  readonly "~rebuild.out": this;
865
1519
  }
866
1520
  /**
1521
+ * Schema for the `any` type. Accepts any value without validation.
1522
+ *
1523
+ * @see {@link Unknown} for a safer alternative that uses `unknown`.
867
1524
  * @since 4.0.0
868
1525
  */
869
1526
  export declare const Any: Any;
870
1527
  /**
1528
+ * Schema for the `unknown` type. Accepts any value without validation.
1529
+ *
1530
+ * @see {@link Unknown} for the schema value.
871
1531
  * @since 4.0.0
872
1532
  */
873
1533
  export interface Unknown extends Bottom<unknown, unknown, never, never, AST.Unknown, Unknown> {
874
1534
  readonly "~rebuild.out": this;
875
1535
  }
876
1536
  /**
1537
+ * Schema for the `unknown` type. Accepts any value without validation.
1538
+ *
1539
+ * @see {@link Any} for the `any` variant.
877
1540
  * @since 4.0.0
878
1541
  */
879
1542
  export declare const Unknown: Unknown;
880
1543
  /**
1544
+ * Schema for the `null` literal. Validates that the input is strictly `null`.
1545
+ *
1546
+ * @see {@link Null} for the schema value.
881
1547
  * @since 4.0.0
882
1548
  */
883
1549
  export interface Null extends Bottom<null, null, never, never, AST.Null, Null> {
884
1550
  readonly "~rebuild.out": this;
885
1551
  }
886
1552
  /**
1553
+ * Schema for the `null` literal. Validates that the input is strictly `null`.
1554
+ *
1555
+ * @see {@link NullOr} for a union with another schema.
887
1556
  * @since 4.0.0
888
1557
  */
889
1558
  export declare const Null: Null;
890
1559
  /**
1560
+ * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
1561
+ *
1562
+ * @see {@link Undefined} for the schema value.
891
1563
  * @since 4.0.0
892
1564
  */
893
1565
  export interface Undefined extends Bottom<undefined, undefined, never, never, AST.Undefined, Undefined> {
894
1566
  readonly "~rebuild.out": this;
895
1567
  }
896
1568
  /**
1569
+ * Schema for the `undefined` literal. Validates that the input is strictly `undefined`.
1570
+ *
1571
+ * @see {@link UndefinedOr} for a union with another schema.
897
1572
  * @since 4.0.0
898
1573
  */
899
1574
  export declare const Undefined: Undefined;
900
1575
  /**
1576
+ * Schema for `string` values.
1577
+ *
1578
+ * @see {@link String} for the schema value.
901
1579
  * @since 4.0.0
902
1580
  */
903
1581
  export interface String extends Bottom<string, string, never, never, AST.String, String> {
904
1582
  readonly "~rebuild.out": this;
905
1583
  }
906
1584
  /**
907
- * A schema for all strings.
1585
+ * Schema for `string` values. Validates that the input is `typeof` `"string"`.
908
1586
  *
909
1587
  * @since 4.0.0
910
1588
  */
911
1589
  export declare const String: String;
912
1590
  /**
1591
+ * Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
1592
+ *
1593
+ * @see {@link Number} for the schema value.
913
1594
  * @since 4.0.0
914
1595
  */
915
1596
  export interface Number extends Bottom<number, number, never, never, AST.Number, Number> {
916
1597
  readonly "~rebuild.out": this;
917
1598
  }
918
1599
  /**
919
- * A schema for all numbers, including `NaN`, `Infinity`, and `-Infinity`.
1600
+ * Schema for `number` values, including `NaN`, `Infinity`, and `-Infinity`.
920
1601
  *
921
1602
  * **Default Json Serializer**
922
1603
  *
923
- * - If the number is finite, it is serialized as a number.
924
- * - Otherwise, it is serialized as a string ("NaN", "Infinity", or "-Infinity").
1604
+ * - Finite numbers are serialized as numbers.
1605
+ * - Non-finite values are serialized as strings (`"NaN"`, `"Infinity"`, `"-Infinity"`).
925
1606
  *
1607
+ * @see {@link Finite} for a schema that excludes non-finite values.
926
1608
  * @since 4.0.0
927
1609
  */
928
1610
  export declare const Number: Number;
929
1611
  /**
1612
+ * Schema for `boolean` values.
1613
+ *
1614
+ * @see {@link Boolean} for the schema value.
930
1615
  * @since 4.0.0
931
1616
  */
932
1617
  export interface Boolean extends Bottom<boolean, boolean, never, never, AST.Boolean, Boolean> {
933
1618
  readonly "~rebuild.out": this;
934
1619
  }
935
1620
  /**
936
- * A schema for all booleans.
1621
+ * Schema for `boolean` values. Validates that the input is `typeof` `"boolean"`.
937
1622
  *
938
1623
  * @category Boolean
939
1624
  * @since 4.0.0
940
1625
  */
941
1626
  export declare const Boolean: Boolean;
942
1627
  /**
1628
+ * Schema for `symbol` values.
1629
+ *
1630
+ * @see {@link Symbol} for the schema value.
943
1631
  * @since 4.0.0
944
1632
  */
945
1633
  export interface Symbol extends Bottom<symbol, symbol, never, never, AST.Symbol, Symbol> {
946
1634
  readonly "~rebuild.out": this;
947
1635
  }
948
1636
  /**
949
- * A schema for all symbols.
1637
+ * Schema for `symbol` values. Validates that the input is `typeof` `"symbol"`.
950
1638
  *
1639
+ * @see {@link UniqueSymbol} for a schema that matches a specific symbol.
951
1640
  * @since 4.0.0
952
1641
  */
953
1642
  export declare const Symbol: Symbol;
954
1643
  /**
1644
+ * Schema for `bigint` values.
1645
+ *
1646
+ * @see {@link BigInt} for the schema value.
955
1647
  * @since 4.0.0
956
1648
  */
957
1649
  export interface BigInt extends Bottom<bigint, bigint, never, never, AST.BigInt, BigInt> {
958
1650
  readonly "~rebuild.out": this;
959
1651
  }
960
1652
  /**
961
- * A schema for all bigints.
1653
+ * Schema for `bigint` values. Validates that the input is `typeof` `"bigint"`.
962
1654
  *
963
1655
  * @since 4.0.0
964
1656
  */
965
1657
  export declare const BigInt: BigInt;
966
1658
  /**
1659
+ * Schema for the `void` type.
1660
+ *
1661
+ * @see {@link Void} for the schema value.
967
1662
  * @since 4.0.0
968
1663
  */
969
1664
  export interface Void extends Bottom<void, void, never, never, AST.Void, Void> {
970
1665
  readonly "~rebuild.out": this;
971
1666
  }
972
1667
  /**
973
- * A schema for the `void` type.
1668
+ * Schema for the `void` type. Accepts `undefined` as the encoded value.
974
1669
  *
975
1670
  * @since 4.0.0
976
1671
  */
977
1672
  export declare const Void: Void;
978
1673
  /**
1674
+ * Schema for the `object` type keyword.
1675
+ *
1676
+ * @see {@link ObjectKeyword} for the schema value.
979
1677
  * @since 4.0.0
980
1678
  */
981
1679
  export interface ObjectKeyword extends Bottom<object, object, never, never, AST.ObjectKeyword, ObjectKeyword> {
982
1680
  readonly "~rebuild.out": this;
983
1681
  }
984
1682
  /**
985
- * A schema for the `object` type.
1683
+ * Schema for the `object` type. Validates that the input is a non-null object or function
1684
+ * (i.e. `typeof value === "object" && value !== null || typeof value === "function"`).
986
1685
  *
987
1686
  * @since 4.0.0
988
1687
  */
989
1688
  export declare const ObjectKeyword: ObjectKeyword;
990
1689
  /**
1690
+ * Represents a schema for a specific unique symbol.
1691
+ *
1692
+ * @see {@link UniqueSymbol} for the constructor function.
991
1693
  * @since 4.0.0
992
1694
  */
993
1695
  export interface UniqueSymbol<sym extends symbol> extends Bottom<sym, sym, never, never, AST.UniqueSymbol, UniqueSymbol<sym>> {
994
1696
  readonly "~rebuild.out": this;
995
1697
  }
996
1698
  /**
997
- * A schema for unique symbols.
998
- *
999
- * **Example**
1699
+ * Creates a schema for a specific symbol. Only that exact symbol satisfies the schema.
1000
1700
  *
1701
+ * **Example** (Specific symbol)
1001
1702
  * ```ts
1002
1703
  * import { Schema } from "effect"
1003
1704
  *
1004
- * const a = Symbol.for("a")
1005
- * const schema = Schema.UniqueSymbol(a)
1705
+ * const mySymbol = Symbol.for("mySymbol")
1706
+ * const schema = Schema.UniqueSymbol(mySymbol)
1006
1707
  * ```
1708
+ *
1709
+ * @see {@link Symbol} for a schema that accepts any symbol.
1007
1710
  * @since 4.0.0
1008
1711
  */
1009
1712
  export declare function UniqueSymbol<const sym extends symbol>(symbol: sym): UniqueSymbol<sym>;
1010
1713
  /**
1714
+ * Namespace for struct field type utilities.
1715
+ *
1716
+ * These types compute the decoded `Type`, encoded `Encoded`, and constructor
1717
+ * input `MakeIn` of a {@link Struct} from its field map, handling optional,
1718
+ * mutable, and other field modifiers automatically.
1719
+ *
1720
+ * - `Struct.Fields` — constraint for the field map object
1721
+ * - `Struct.Type<F>` — decoded type of the struct
1722
+ * - `Struct.Encoded<F>` — encoded type of the struct
1723
+ * - `Struct.MakeIn<F>` — constructor input (optional/defaulted fields may be omitted)
1724
+ * - `Struct.DecodingServices<F>` / `Struct.EncodingServices<F>` — required services
1725
+ *
1011
1726
  * @since 4.0.0
1012
1727
  */
1013
1728
  export declare namespace Struct {
1014
1729
  /**
1730
+ * Constraint for a struct field map: an object whose values are schemas.
1731
+ *
1015
1732
  * @since 4.0.0
1016
1733
  */
1017
1734
  type Fields = {
@@ -1108,6 +1825,27 @@ export declare namespace Struct {
1108
1825
  */
1109
1826
  export interface Struct<Fields extends Struct.Fields> extends Bottom<Simplify<Struct.Type<Fields>>, Simplify<Struct.Encoded<Fields>>, Struct.DecodingServices<Fields>, Struct.EncodingServices<Fields>, AST.Objects, Struct<Fields>, Simplify<Struct.MakeIn<Fields>>, Simplify<Struct.Iso<Fields>>> {
1110
1827
  readonly "~rebuild.out": this;
1828
+ /**
1829
+ * The field definitions of this struct. Spread them into a new struct to
1830
+ * reuse fields across schemas.
1831
+ *
1832
+ * **Example** (Reusing fields across structs)
1833
+ *
1834
+ * ```ts
1835
+ * import { Schema } from "effect"
1836
+ *
1837
+ * const Timestamped = Schema.Struct({
1838
+ * createdAt: Schema.Date,
1839
+ * updatedAt: Schema.Date
1840
+ * })
1841
+ *
1842
+ * const User = Schema.Struct({
1843
+ * ...Timestamped.fields,
1844
+ * name: Schema.String,
1845
+ * email: Schema.String
1846
+ * })
1847
+ * ```
1848
+ */
1111
1849
  readonly fields: Fields;
1112
1850
  /**
1113
1851
  * Returns a new struct with the fields modified by the provided function.
@@ -1128,6 +1866,34 @@ export interface Struct<Fields extends Struct.Fields> extends Bottom<Simplify<St
1128
1866
  } | undefined): Struct<Simplify<Readonly<To>>>;
1129
1867
  }
1130
1868
  /**
1869
+ * Defines a struct schema from a map of field schemas.
1870
+ *
1871
+ * Each field value is a schema. Use {@link optionalKey} or {@link optional} to
1872
+ * mark fields as optional, and {@link mutableKey} to mark them as mutable.
1873
+ *
1874
+ * The resulting schema's `Type` is a readonly object type with the fields'
1875
+ * decoded types. The `Encoded` form mirrors the field schemas' encoded types.
1876
+ *
1877
+ * **Example** (Basic struct)
1878
+ *
1879
+ * ```ts
1880
+ * import { Schema } from "effect"
1881
+ *
1882
+ * const Person = Schema.Struct({
1883
+ * name: Schema.String,
1884
+ * age: Schema.Number,
1885
+ * email: Schema.optionalKey(Schema.String)
1886
+ * })
1887
+ *
1888
+ * // { readonly name: string; readonly age: number; readonly email?: string }
1889
+ * type Person = typeof Person.Type
1890
+ *
1891
+ * const alice = Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 })
1892
+ * console.log(alice)
1893
+ * // { name: 'Alice', age: 30 }
1894
+ * ```
1895
+ *
1896
+ * @category Constructors
1131
1897
  * @since 4.0.0
1132
1898
  */
1133
1899
  export declare function Struct<const Fields extends Struct.Fields>(fields: Fields): Struct<Fields>;
@@ -1155,13 +1921,60 @@ interface fieldsAssign<NewFields extends Struct.Fields> extends Lambda {
1155
1921
  */
1156
1922
  export declare function fieldsAssign<const NewFields extends Struct.Fields>(fields: NewFields): fieldsAssign<NewFields>;
1157
1923
  /**
1924
+ * Renames struct keys in the encoded form without changing the decoded type.
1925
+ *
1926
+ * Takes a partial mapping `{ decodedKey: encodedKey }` and produces a
1927
+ * transformation schema that decodes from the renamed keys and encodes back to
1928
+ * the renamed keys. Keys not present in the mapping are left unchanged.
1929
+ *
1930
+ * **Example** (Rename `name` to `full_name` in the encoded form)
1931
+ *
1932
+ * ```ts
1933
+ * import { Schema } from "effect"
1934
+ *
1935
+ * const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })
1936
+ * const Encoded = Person.pipe(Schema.encodeKeys({ name: "full_name" }))
1937
+ *
1938
+ * // Decodes { full_name: "Alice", age: 30 } → { name: "Alice", age: 30 }
1939
+ * const alice = Schema.decodeUnknownSync(Encoded)({ full_name: "Alice", age: 30 })
1940
+ * console.log(alice)
1941
+ * // { name: 'Alice', age: 30 }
1942
+ * ```
1943
+ *
1158
1944
  * @category Struct transformations
1159
1945
  * @since 4.0.0
1160
1946
  */
1161
- export declare function encodeKeys<S extends Struct<Struct.Fields>, const M extends {
1947
+ export declare function encodeKeys<S extends Top & {
1948
+ readonly fields: Struct.Fields;
1949
+ }, const M extends {
1162
1950
  readonly [K in keyof S["fields"]]?: PropertyKey;
1163
1951
  }>(mapping: M): (self: S) => decodeTo<S, Struct<{ [K in keyof S["fields"] as K extends keyof M ? M[K] extends PropertyKey ? M[K] : K : K]: toEncoded<S["fields"][K]>; }>>;
1164
1952
  /**
1953
+ * Adds derived fields to a struct schema during decoding.
1954
+ *
1955
+ * Each new field is derived from the decoded struct value via a function that
1956
+ * returns `Option`. On encoding the derived fields are stripped. This allows
1957
+ * computed or enriched fields to live in the decoded type without appearing in
1958
+ * the encoded form.
1959
+ *
1960
+ * **Example** (Add a computed `fullName` field)
1961
+ *
1962
+ * ```ts
1963
+ * import { Option, Schema } from "effect"
1964
+ *
1965
+ * const Person = Schema.Struct({ first: Schema.String, last: Schema.String })
1966
+ * const Extended = Person.pipe(
1967
+ * Schema.extendTo(
1968
+ * { fullName: Schema.String },
1969
+ * { fullName: (p) => Option.some(`${p.first} ${p.last}`) }
1970
+ * )
1971
+ * )
1972
+ *
1973
+ * const alice = Schema.decodeUnknownSync(Extended)({ first: "Alice", last: "Smith" })
1974
+ * console.log(alice.fullName)
1975
+ * // Alice Smith
1976
+ * ```
1977
+ *
1165
1978
  * @since 4.0.0
1166
1979
  * @experimental
1167
1980
  */
@@ -1173,6 +1986,12 @@ derive: {
1173
1986
  readonly [K in keyof Fields]: (s: S["Type"]) => Option_.Option<Fields[K]["Type"]>;
1174
1987
  }): (self: S) => decodeTo<Struct<Simplify<{ [K in keyof S["fields"]]: toType<S["fields"][K]>; } & Fields>>, S>;
1175
1988
  /**
1989
+ * Namespace for `Record` type utilities.
1990
+ *
1991
+ * - `Record.Key` — constraint for the key schema (must encode to `PropertyKey`)
1992
+ * - `Record.Type<K, V>` — decoded type of the record
1993
+ * - `Record.Encoded<K, V>` — encoded type of the record
1994
+ *
1176
1995
  * @since 4.0.0
1177
1996
  */
1178
1997
  export declare namespace Record {
@@ -1183,10 +2002,6 @@ export declare namespace Record {
1183
2002
  readonly "~type.make": PropertyKey;
1184
2003
  readonly "Iso": PropertyKey;
1185
2004
  }
1186
- /**
1187
- * @since 4.0.0
1188
- */
1189
- type Record = Record$<Record.Key, Top>;
1190
2005
  /**
1191
2006
  * @since 4.0.0
1192
2007
  */
@@ -1269,14 +2084,35 @@ export declare namespace Record {
1269
2084
  };
1270
2085
  }
1271
2086
  /**
2087
+ * Schema type for a key-value record (map) with a typed key and value schema.
2088
+ * Produced by {@link Record}.
2089
+ *
1272
2090
  * @since 4.0.0
1273
2091
  */
1274
- 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>, AST.Objects, Record$<Key, Value>, Simplify<Record.MakeIn<Key, Value>>, Record.Iso<Key, Value>> {
2092
+ 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>, AST.Objects, $Record<Key, Value>, Simplify<Record.MakeIn<Key, Value>>, Record.Iso<Key, Value>> {
1275
2093
  readonly "~rebuild.out": this;
1276
2094
  readonly key: Key;
1277
2095
  readonly value: Value;
1278
2096
  }
1279
2097
  /**
2098
+ * Defines a record (dictionary) schema with typed keys and values.
2099
+ *
2100
+ * **Example** (String-keyed record of numbers)
2101
+ *
2102
+ * ```ts
2103
+ * import { Schema } from "effect"
2104
+ *
2105
+ * const schema = Schema.Record(Schema.String, Schema.Number)
2106
+ *
2107
+ * // { readonly [x: string]: number }
2108
+ * type R = typeof schema.Type
2109
+ *
2110
+ * const result = Schema.decodeUnknownSync(schema)({ a: 1, b: 2 })
2111
+ * console.log(result)
2112
+ * // { a: 1, b: 2 }
2113
+ * ```
2114
+ *
2115
+ * @category Constructors
1280
2116
  * @since 4.0.0
1281
2117
  */
1282
2118
  export declare function Record<Key extends Record.Key, Value extends Top>(key: Key, value: Value, options?: {
@@ -1284,8 +2120,13 @@ export declare function Record<Key extends Record.Key, Value extends Top>(key: K
1284
2120
  readonly decode?: Combiner.Combiner<readonly [Key["Type"], Value["Type"]]> | undefined;
1285
2121
  readonly encode?: Combiner.Combiner<readonly [Key["Encoded"], Value["Encoded"]]> | undefined;
1286
2122
  };
1287
- }): Record$<Key, Value>;
2123
+ }): $Record<Key, Value>;
1288
2124
  /**
2125
+ * Namespace for `StructWithRest` type utilities.
2126
+ *
2127
+ * - `StructWithRest.Type<S, R>` — decoded type (struct type intersected with record types)
2128
+ * - `StructWithRest.Encoded<S, R>` — encoded type
2129
+ *
1289
2130
  * @since 4.0.0
1290
2131
  */
1291
2132
  export declare namespace StructWithRest {
@@ -1298,7 +2139,7 @@ export declare namespace StructWithRest {
1298
2139
  /**
1299
2140
  * @since 4.0.0
1300
2141
  */
1301
- type Records = ReadonlyArray<Record.Record>;
2142
+ type Records = ReadonlyArray<$Record<Record.Key, Top>>;
1302
2143
  type MergeTuple<T extends ReadonlyArray<unknown>> = T extends readonly [infer Head, ...infer Tail] ? Head & MergeTuple<Tail> : {};
1303
2144
  /**
1304
2145
  * @since 4.0.0
@@ -1338,6 +2179,9 @@ export declare namespace StructWithRest {
1338
2179
  }>;
1339
2180
  }
1340
2181
  /**
2182
+ * Schema type for a struct combined with one or more record schemas. Produced
2183
+ * by {@link StructWithRest}.
2184
+ *
1341
2185
  * @since 4.0.0
1342
2186
  */
1343
2187
  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>, AST.Objects, StructWithRest<S, Records>, Simplify<StructWithRest.MakeIn<S, Records>>, Simplify<StructWithRest.Iso<S, Records>>> {
@@ -1346,10 +2190,35 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
1346
2190
  readonly records: Records;
1347
2191
  }
1348
2192
  /**
2193
+ * Extends a struct schema with one or more record (index-signature) schemas,
2194
+ * producing a schema whose decoded type intersects the struct and all records.
2195
+ *
2196
+ * **Example** (Struct with string-indexed extra keys)
2197
+ *
2198
+ * ```ts
2199
+ * import { Schema } from "effect"
2200
+ *
2201
+ * const schema = Schema.StructWithRest(
2202
+ * Schema.Struct({ id: Schema.Number }),
2203
+ * [Schema.Record(Schema.String, Schema.String)]
2204
+ * )
2205
+ *
2206
+ * // { readonly id: number } & { readonly [x: string]: string }
2207
+ * type T = typeof schema.Type
2208
+ * ```
2209
+ *
2210
+ * @category Constructors
1349
2211
  * @since 4.0.0
1350
2212
  */
1351
2213
  export declare function StructWithRest<const S extends StructWithRest.Objects, const Records extends StructWithRest.Records>(schema: S, records: Records): StructWithRest<S, Records>;
1352
2214
  /**
2215
+ * Namespace for `Tuple` type utilities.
2216
+ *
2217
+ * - `Tuple.Elements` — constraint for the element schema array
2218
+ * - `Tuple.Type<E>` — decoded tuple type
2219
+ * - `Tuple.Encoded<E>` — encoded tuple type
2220
+ * - `Tuple.MakeIn<E>` — constructor input tuple
2221
+ *
1353
2222
  * @since 4.0.0
1354
2223
  */
1355
2224
  export declare namespace Tuple {
@@ -1405,6 +2274,8 @@ export declare namespace Tuple {
1405
2274
  type MakeIn<E extends Elements> = MakeIn_<E>;
1406
2275
  }
1407
2276
  /**
2277
+ * Schema type for a fixed-length tuple. Produced by {@link Tuple}.
2278
+ *
1408
2279
  * @since 4.0.0
1409
2280
  */
1410
2281
  export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Type<Elements>, Tuple.Encoded<Elements>, Tuple.DecodingServices<Elements>, Tuple.EncodingServices<Elements>, AST.Arrays, Tuple<Elements>, Tuple.MakeIn<Elements>, Tuple.Iso<Elements>> {
@@ -1429,11 +2300,32 @@ export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Typ
1429
2300
  } | undefined): Tuple<Simplify<Readonly<To>>>;
1430
2301
  }
1431
2302
  /**
2303
+ * Defines a fixed-length tuple schema from an array of element schemas.
2304
+ *
2305
+ * **Example** (Pair of string and number)
2306
+ *
2307
+ * ```ts
2308
+ * import { Schema } from "effect"
2309
+ *
2310
+ * const schema = Schema.Tuple([Schema.String, Schema.Number])
2311
+ *
2312
+ * const pair = Schema.decodeUnknownSync(schema)(["hello", 42])
2313
+ * console.log(pair)
2314
+ * // [ 'hello', 42 ]
2315
+ * ```
2316
+ *
1432
2317
  * @category Constructors
1433
2318
  * @since 4.0.0
1434
2319
  */
1435
2320
  export declare function Tuple<const Elements extends ReadonlyArray<Top>>(elements: Elements): Tuple<Elements>;
1436
2321
  /**
2322
+ * Namespace for `TupleWithRest` type utilities.
2323
+ *
2324
+ * - `TupleWithRest.TupleType` — constraint for the leading tuple schema
2325
+ * - `TupleWithRest.Rest` — the rest element schema(s)
2326
+ * - `TupleWithRest.Type<T, R>` — decoded type (fixed elements + rest)
2327
+ * - `TupleWithRest.Encoded<T, R>` — encoded type
2328
+ *
1437
2329
  * @since 4.0.0
1438
2330
  */
1439
2331
  export declare namespace TupleWithRest {
@@ -1493,6 +2385,9 @@ export declare namespace TupleWithRest {
1493
2385
  ] : M;
1494
2386
  }
1495
2387
  /**
2388
+ * Schema type for a tuple with additional rest elements. Produced by
2389
+ * {@link TupleWithRest}.
2390
+ *
1496
2391
  * @since 4.0.0
1497
2392
  */
1498
2393
  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"], AST.Arrays, TupleWithRest<S, Rest>, TupleWithRest.MakeIn<S["~type.make"], Rest>, TupleWithRest.Iso<S["Iso"], Rest>> {
@@ -1501,27 +2396,65 @@ export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends T
1501
2396
  readonly rest: Rest;
1502
2397
  }
1503
2398
  /**
2399
+ * Extends a fixed-length tuple schema with rest elements, creating a variadic
2400
+ * tuple that starts with the fixed elements and ends with zero or more rest
2401
+ * elements.
2402
+ *
2403
+ * **Example** (Tuple with rest)
2404
+ *
2405
+ * ```ts
2406
+ * import { Schema } from "effect"
2407
+ *
2408
+ * // [string, number, ...boolean[]]
2409
+ * const schema = Schema.TupleWithRest(
2410
+ * Schema.Tuple([Schema.String, Schema.Number]),
2411
+ * [Schema.Boolean]
2412
+ * )
2413
+ *
2414
+ * const result = Schema.decodeUnknownSync(schema)(["hello", 1, true, false])
2415
+ * console.log(result)
2416
+ * // [ 'hello', 1, true, false ]
2417
+ * ```
2418
+ *
1504
2419
  * @category Constructors
1505
2420
  * @since 4.0.0
1506
2421
  */
1507
2422
  export declare function TupleWithRest<S extends Tuple<Tuple.Elements>, const Rest extends TupleWithRest.Rest>(schema: S, rest: Rest): TupleWithRest<S, Rest>;
1508
2423
  /**
2424
+ * Schema type for a `ReadonlyArray`. Produced by {@link Array}.
2425
+ *
1509
2426
  * @since 4.0.0
1510
2427
  */
1511
- export interface Array$<S extends Top> extends Bottom<ReadonlyArray<S["Type"]>, ReadonlyArray<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"], AST.Arrays, Array$<S>, ReadonlyArray<S["~type.make"]>, ReadonlyArray<S["Iso"]>> {
2428
+ export interface $Array<S extends Top> extends Bottom<ReadonlyArray<S["Type"]>, ReadonlyArray<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"], AST.Arrays, $Array<S>, ReadonlyArray<S["~type.make"]>, ReadonlyArray<S["Iso"]>> {
1512
2429
  readonly "~rebuild.out": this;
1513
2430
  readonly schema: S;
1514
2431
  }
1515
2432
  interface ArrayLambda extends Lambda {
1516
- <S extends Top>(self: S): Array$<S>;
1517
- readonly "~lambda.out": this["~lambda.in"] extends Top ? Array$<this["~lambda.in"]> : never;
2433
+ <S extends Top>(self: S): $Array<S>;
2434
+ readonly "~lambda.out": this["~lambda.in"] extends Top ? $Array<this["~lambda.in"]> : never;
1518
2435
  }
1519
2436
  /**
2437
+ * Defines a `ReadonlyArray` schema for a given element schema.
2438
+ *
2439
+ * **Example** (Array of strings)
2440
+ *
2441
+ * ```ts
2442
+ * import { Schema } from "effect"
2443
+ *
2444
+ * const schema = Schema.Array(Schema.String)
2445
+ *
2446
+ * const result = Schema.decodeUnknownSync(schema)(["a", "b", "c"])
2447
+ * console.log(result)
2448
+ * // [ 'a', 'b', 'c' ]
2449
+ * ```
2450
+ *
1520
2451
  * @category Constructors
1521
2452
  * @since 4.0.0
1522
2453
  */
1523
2454
  export declare const Array: ArrayLambda;
1524
2455
  /**
2456
+ * Schema type for a non-empty `ReadonlyArray`. Produced by {@link NonEmptyArray}.
2457
+ *
1525
2458
  * @since 4.0.0
1526
2459
  */
1527
2460
  export interface NonEmptyArray<S extends Top> extends Bottom<readonly [S["Type"], ...Array<S["Type"]>], readonly [S["Encoded"], ...Array<S["Encoded"]>], S["DecodingServices"], S["EncodingServices"], AST.Arrays, NonEmptyArray<S>, readonly [S["~type.make"], ...Array<S["~type.make"]>], readonly [S["Iso"], ...Array<S["Iso"]>]> {
@@ -1533,14 +2466,30 @@ interface NonEmptyArrayLambda extends Lambda {
1533
2466
  readonly "~lambda.out": this["~lambda.in"] extends Top ? NonEmptyArray<this["~lambda.in"]> : never;
1534
2467
  }
1535
2468
  /**
2469
+ * Defines a non-empty `ReadonlyArray` schema — at least one element required.
2470
+ * Type is `readonly [T, ...T[]]`.
2471
+ *
2472
+ * **Example** (Non-empty array of numbers)
2473
+ *
2474
+ * ```ts
2475
+ * import { Schema } from "effect"
2476
+ *
2477
+ * const schema = Schema.NonEmptyArray(Schema.Number)
2478
+ *
2479
+ * Schema.decodeUnknownSync(schema)([1, 2, 3]) // ok
2480
+ * Schema.decodeUnknownSync(schema)([]) // throws
2481
+ * ```
2482
+ *
1536
2483
  * @category Constructors
1537
2484
  * @since 4.0.0
1538
2485
  */
1539
2486
  export declare const NonEmptyArray: NonEmptyArrayLambda;
1540
2487
  /**
2488
+ * Schema type for an array with unique elements. Produced by {@link UniqueArray}.
2489
+ *
1541
2490
  * @since 4.0.0
1542
2491
  */
1543
- export interface UniqueArray<S extends Top> extends Array$<S> {
2492
+ export interface UniqueArray<S extends Top> extends $Array<S> {
1544
2493
  }
1545
2494
  /**
1546
2495
  * Returns a new array schema that ensures all elements are unique.
@@ -1553,6 +2502,9 @@ export interface UniqueArray<S extends Top> extends Array$<S> {
1553
2502
  */
1554
2503
  export declare function UniqueArray<S extends Top>(item: S): UniqueArray<S>;
1555
2504
  /**
2505
+ * Schema type that makes array or tuple elements mutable (removes `readonly`).
2506
+ * Produced by {@link mutable}.
2507
+ *
1556
2508
  * @since 4.0.0
1557
2509
  */
1558
2510
  export interface mutable<S extends Top & {
@@ -1570,12 +2522,25 @@ interface mutableLambda extends Lambda {
1570
2522
  } ? mutable<this["~lambda.in"]> : "Error: schema not eligible for mutable";
1571
2523
  }
1572
2524
  /**
1573
- * Makes arrays or tuples mutable.
2525
+ * Makes an array or tuple schema mutable, removing the `readonly` modifier.
2526
+ *
2527
+ * **Example** (Mutable array)
2528
+ *
2529
+ * ```ts
2530
+ * import { Schema } from "effect"
2531
+ *
2532
+ * const schema = Schema.mutable(Schema.Array(Schema.Number))
2533
+ *
2534
+ * // number[] (mutable)
2535
+ * type T = typeof schema.Type
2536
+ * ```
1574
2537
  *
1575
2538
  * @since 4.0.0
1576
2539
  */
1577
2540
  export declare const mutable: mutableLambda;
1578
2541
  /**
2542
+ * Schema type for a union of multiple schemas. Produced by {@link Union}.
2543
+ *
1579
2544
  * @since 4.0.0
1580
2545
  */
1581
2546
  export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
@@ -1614,12 +2579,23 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
1614
2579
  } | undefined): Union<Simplify<Readonly<To>>>;
1615
2580
  }
1616
2581
  /**
1617
- * Creates a schema that represents a union of multiple schemas. Members are checked in order, and the first match is returned.
2582
+ * Creates a union schema from an array of member schemas. Members are tested in
2583
+ * order; the first match is returned.
2584
+ *
2585
+ * Optionally, specify `mode`:
2586
+ * - `"anyOf"` (default) — matches if any member matches.
2587
+ * - `"oneOf"` — matches if exactly one member matches.
2588
+ *
2589
+ * **Example** (String or number union)
1618
2590
  *
1619
- * Optionally, you can specify the `mode` to be `"anyOf"` or `"oneOf"`.
2591
+ * ```ts
2592
+ * import { Schema } from "effect"
1620
2593
  *
1621
- * - `"anyOf"` - The union matches if any member matches.
1622
- * - `"oneOf"` - The union matches if exactly one member matches.
2594
+ * const schema = Schema.Union([Schema.String, Schema.Number])
2595
+ *
2596
+ * Schema.decodeUnknownSync(schema)("hello") // "hello"
2597
+ * Schema.decodeUnknownSync(schema)(42) // 42
2598
+ * ```
1623
2599
  *
1624
2600
  * @category Constructors
1625
2601
  * @since 4.0.0
@@ -1628,6 +2604,9 @@ export declare function Union<const Members extends ReadonlyArray<Top>>(members:
1628
2604
  mode?: "anyOf" | "oneOf";
1629
2605
  }): Union<Members>;
1630
2606
  /**
2607
+ * Represents a union schema of multiple literal values.
2608
+ *
2609
+ * @see {@link Literals} for the constructor function.
1631
2610
  * @since 4.0.0
1632
2611
  */
1633
2612
  export interface Literals<L extends ReadonlyArray<AST.LiteralValue>> extends Bottom<L[number], L[number], never, never, AST.Union<AST.Literal>, Literals<L>> {
@@ -1648,12 +2627,24 @@ export interface Literals<L extends ReadonlyArray<AST.LiteralValue>> extends Bot
1648
2627
  }>;
1649
2628
  }
1650
2629
  /**
2630
+ * Creates a union schema from an array of literal values.
2631
+ *
2632
+ * **Example** (Status codes)
2633
+ * ```ts
2634
+ * import { Schema } from "effect"
2635
+ *
2636
+ * const schema = Schema.Literals(["active", "inactive", "pending"])
2637
+ * // accepts "active", "inactive", or "pending"
2638
+ * ```
2639
+ *
1651
2640
  * @see {@link Literal} for a schema that represents a single literal.
1652
2641
  * @category Constructors
1653
2642
  * @since 4.0.0
1654
2643
  */
1655
2644
  export declare function Literals<const L extends ReadonlyArray<AST.LiteralValue>>(literals: L): Literals<L>;
1656
2645
  /**
2646
+ * Schema type for `S | null`. Produced by {@link NullOr}.
2647
+ *
1657
2648
  * @since 4.0.0
1658
2649
  */
1659
2650
  export interface NullOr<S extends Top> extends Union<readonly [S, Null]> {
@@ -1663,11 +2654,15 @@ interface NullOrLambda extends Lambda {
1663
2654
  readonly "~lambda.out": this["~lambda.in"] extends Top ? NullOr<this["~lambda.in"]> : never;
1664
2655
  }
1665
2656
  /**
2657
+ * Creates a union schema of `S | null`.
2658
+ *
1666
2659
  * @category Constructors
1667
2660
  * @since 4.0.0
1668
2661
  */
1669
2662
  export declare const NullOr: NullOrLambda;
1670
2663
  /**
2664
+ * Schema type for `S | undefined`. Produced by {@link UndefinedOr}.
2665
+ *
1671
2666
  * @since 4.0.0
1672
2667
  */
1673
2668
  export interface UndefinedOr<S extends Top> extends Union<readonly [S, Undefined]> {
@@ -1677,11 +2672,14 @@ interface UndefinedOrLambda extends Lambda {
1677
2672
  readonly "~lambda.out": this["~lambda.in"] extends Top ? UndefinedOr<this["~lambda.in"]> : never;
1678
2673
  }
1679
2674
  /**
2675
+ * Creates a union schema of `S | undefined`.
2676
+ *
1680
2677
  * @category Constructors
1681
2678
  * @since 4.0.0
1682
2679
  */
1683
2680
  export declare const UndefinedOr: UndefinedOrLambda;
1684
2681
  /**
2682
+ * Schema type for `S | null | undefined`. Produced by {@link NullishOr}.
1685
2683
  * @since 4.0.0
1686
2684
  */
1687
2685
  export interface NullishOr<S extends Top> extends Union<readonly [S, Null, Undefined]> {
@@ -1691,11 +2689,13 @@ interface NullishOrLambda extends Lambda {
1691
2689
  readonly "~lambda.out": this["~lambda.in"] extends Top ? NullishOr<this["~lambda.in"]> : never;
1692
2690
  }
1693
2691
  /**
2692
+ * Creates a union schema of `S | null | undefined`.
1694
2693
  * @category Constructors
1695
2694
  * @since 4.0.0
1696
2695
  */
1697
2696
  export declare const NullishOr: NullishOrLambda;
1698
2697
  /**
2698
+ * Schema type wrapping a lazily-evaluated schema. Produced by {@link suspend}.
1699
2699
  * @since 4.0.0
1700
2700
  */
1701
2701
  export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"], S["DecodingServices"], S["EncodingServices"], AST.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"]> {
@@ -1706,16 +2706,46 @@ export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"],
1706
2706
  * essential for creating recursive schemas where a schema references itself,
1707
2707
  * preventing infinite recursion during schema definition.
1708
2708
  *
2709
+ * **Example** (Recursive tree schema)
2710
+ * ```ts
2711
+ * import { Schema } from "effect"
2712
+ *
2713
+ * interface Tree {
2714
+ * readonly value: number
2715
+ * readonly children: ReadonlyArray<Tree>
2716
+ * }
2717
+ *
2718
+ * const Tree = Schema.Struct({
2719
+ * value: Schema.Number,
2720
+ * children: Schema.Array(Schema.suspend((): Schema.Codec<Tree> => Tree))
2721
+ * })
2722
+ * ```
2723
+ *
1709
2724
  * @category Constructors
1710
2725
  * @since 4.0.0
1711
2726
  */
1712
2727
  export declare function suspend<S extends Top>(f: () => S): suspend<S>;
1713
2728
  /**
2729
+ * Pipeable function that attaches one or more filter checks to a schema without
2730
+ * changing the TypeScript type.
2731
+ *
2732
+ * **Example** (Adding checks to a schema)
2733
+ * ```ts
2734
+ * import { Schema } from "effect"
2735
+ *
2736
+ * const AgeSchema = Schema.Number.pipe(
2737
+ * Schema.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(120))
2738
+ * )
2739
+ * ```
2740
+ *
1714
2741
  * @category Filtering
1715
2742
  * @since 4.0.0
1716
2743
  */
1717
2744
  export declare function check<S extends Top>(...checks: readonly [AST.Check<S["Type"]>, ...Array<AST.Check<S["Type"]>>]): (self: S) => S["~rebuild.out"];
1718
2745
  /**
2746
+ * The output type of {@link refine}, narrowing the schema's `Type` to `T` via a
2747
+ * type guard.
2748
+ *
1719
2749
  * @since 4.0.0
1720
2750
  */
1721
2751
  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"]> {
@@ -1723,12 +2753,18 @@ export interface refine<T extends S["Type"], S extends Top> extends Bottom<T, S[
1723
2753
  readonly schema: S;
1724
2754
  }
1725
2755
  /**
2756
+ * Narrows the TypeScript type of a schema's output via a type guard predicate,
2757
+ * attaching the guard as a runtime filter check.
2758
+ *
1726
2759
  * @category Filtering
1727
2760
  * @since 4.0.0
1728
2761
  */
1729
2762
  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>;
1730
2763
  type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string ? Brand.Brand<U> : never>;
1731
2764
  /**
2765
+ * The output type of {@link brand}, intersecting the schema's `Type` with one or
2766
+ * more {@link Brand.Brand} tags.
2767
+ *
1732
2768
  * @since 4.0.0
1733
2769
  */
1734
2770
  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"]> {
@@ -1737,20 +2773,30 @@ export interface brand<S extends Top, B> extends Bottom<S["Type"] & DistributeBr
1737
2773
  readonly identifier: string;
1738
2774
  }
1739
2775
  /**
1740
- * Adds a brand to a schema.
2776
+ * Adds a nominal brand to a schema, intersecting the output type with
2777
+ * `Brand.Brand<B>` to prevent accidental mixing of structurally identical types.
1741
2778
  *
1742
2779
  * @category Branding
1743
2780
  * @since 4.0.0
1744
2781
  */
1745
2782
  export declare function brand<B extends string>(identifier: B): <S extends Top>(schema: S) => brand<S["~rebuild.out"], B>;
1746
2783
  /**
1747
- * @category Constructors
2784
+ * Creates a branded schema from a {@link Brand.Constructor}, applying the
2785
+ * constructor's checks and brand tag to the underlying schema.
2786
+ *
2787
+ * @category Branding
1748
2788
  * @since 4.0.0
1749
2789
  */
1750
2790
  export declare function fromBrand<A extends Brand.Brand<any>>(identifier: string, ctor: Brand.Constructor<A>): <S extends Top & {
1751
2791
  readonly "Type": Brand.Brand.Unbranded<A>;
1752
2792
  }>(self: S) => brand<S["~rebuild.out"], Brand.Brand.Keys<A>>;
1753
2793
  /**
2794
+ * A schema that wraps another schema and intercepts its decoding pipeline.
2795
+ *
2796
+ * The interceptor receives the full decoding `Effect` and may replace, modify,
2797
+ * or augment it — including adding service requirements via `RD`.
2798
+ *
2799
+ * @see {@link middlewareDecoding} for the constructor
1754
2800
  * @since 4.0.0
1755
2801
  */
1756
2802
  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"]> {
@@ -1758,10 +2804,35 @@ export interface middlewareDecoding<S extends Top, RD> extends Bottom<S["Type"],
1758
2804
  readonly schema: S;
1759
2805
  }
1760
2806
  /**
2807
+ * Intercepts the decoding pipeline of a schema.
2808
+ *
2809
+ * The provided function receives the current decoding `Effect` and `ParseOptions`,
2810
+ * and returns a new `Effect` — potentially adding service requirements (`RD`),
2811
+ * recovering from errors, or augmenting the result.
2812
+ *
2813
+ * **Example** (Logging decode failures)
2814
+ *
2815
+ * ```ts
2816
+ * import { Effect, Schema } from "effect"
2817
+ *
2818
+ * const Logged = Schema.String.pipe(
2819
+ * Schema.middlewareDecoding((effect) =>
2820
+ * Effect.tapError(effect, (issue) => Effect.log("decode failed", issue))
2821
+ * )
2822
+ * )
2823
+ * ```
2824
+ *
2825
+ * @see {@link catchDecoding} for a simpler error-recovery variant
1761
2826
  * @since 4.0.0
1762
2827
  */
1763
2828
  export declare function middlewareDecoding<S extends Top, RD>(decode: (effect: Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, S["DecodingServices"]>, options: AST.ParseOptions) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, RD>): (schema: S) => middlewareDecoding<S, RD>;
1764
2829
  /**
2830
+ * A schema that wraps another schema and intercepts its encoding pipeline.
2831
+ *
2832
+ * The interceptor receives the full encoding `Effect` and may replace, modify,
2833
+ * or augment it — including adding service requirements via `RE`.
2834
+ *
2835
+ * @see {@link middlewareEncoding} for the constructor
1765
2836
  * @since 4.0.0
1766
2837
  */
1767
2838
  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"]> {
@@ -1769,26 +2840,77 @@ export interface middlewareEncoding<S extends Top, RE> extends Bottom<S["Type"],
1769
2840
  readonly schema: S;
1770
2841
  }
1771
2842
  /**
2843
+ * Intercepts the encoding pipeline of a schema.
2844
+ *
2845
+ * The provided function receives the current encoding `Effect` and `ParseOptions`,
2846
+ * and returns a new `Effect` — potentially adding service requirements (`RE`),
2847
+ * recovering from errors, or augmenting the result.
2848
+ *
2849
+ * **Example** (Logging encode failures)
2850
+ *
2851
+ * ```ts
2852
+ * import { Effect, Schema } from "effect"
2853
+ *
2854
+ * const Logged = Schema.String.pipe(
2855
+ * Schema.middlewareEncoding((effect) =>
2856
+ * Effect.tapError(effect, (issue) => Effect.log("encode failed", issue))
2857
+ * )
2858
+ * )
2859
+ * ```
2860
+ *
2861
+ * @see {@link catchEncoding} for a simpler error-recovery variant
1772
2862
  * @since 4.0.0
1773
2863
  */
1774
2864
  export declare function middlewareEncoding<S extends Top, RE>(encode: (effect: Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, S["EncodingServices"]>, options: AST.ParseOptions) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, RE>): (schema: S) => middlewareEncoding<S, RE>;
1775
2865
  /**
2866
+ * Recovers from a decoding error by providing a fallback value.
2867
+ *
2868
+ * The handler receives the `Issue` and returns an `Effect` that either
2869
+ * succeeds with a fallback value or re-fails with a (possibly different) issue.
2870
+ *
2871
+ * **Example** (Returning a default on decode failure)
2872
+ *
2873
+ * ```ts
2874
+ * import { Effect, Option, Schema } from "effect"
2875
+ *
2876
+ * const schema = Schema.Number.pipe(
2877
+ * Schema.catchDecoding((_issue) => Effect.succeed(Option.some(0)))
2878
+ * )
2879
+ * ```
2880
+ *
2881
+ * @see {@link catchDecodingWithContext} to add service requirements to the handler
1776
2882
  * @since 4.0.0
1777
2883
  */
1778
2884
  export declare function catchDecoding<S extends Top>(f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue>): (self: S) => S["~rebuild.out"];
1779
2885
  /**
2886
+ * Like {@link catchDecoding}, but the handler may require Effect services (`R`).
2887
+ *
1780
2888
  * @since 4.0.0
1781
2889
  */
1782
2890
  export declare function catchDecodingWithContext<S extends Top, R = never>(f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue, R>): (self: S) => middlewareDecoding<S, S["DecodingServices"] | R>;
1783
2891
  /**
2892
+ * Recovers from an encoding error by providing a fallback value.
2893
+ *
2894
+ * The handler receives the `Issue` and returns an `Effect` that either
2895
+ * succeeds with a fallback value or re-fails with a (possibly different) issue.
2896
+ *
2897
+ * @see {@link catchEncodingWithContext} to add service requirements to the handler
1784
2898
  * @since 4.0.0
1785
2899
  */
1786
2900
  export declare function catchEncoding<S extends Top>(f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue>): (self: S) => S["~rebuild.out"];
1787
2901
  /**
2902
+ * Like {@link catchEncoding}, but the handler may require Effect services (`R`).
2903
+ *
1788
2904
  * @since 4.0.0
1789
2905
  */
1790
2906
  export declare function catchEncodingWithContext<S extends Top, R = never>(f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue, R>): (self: S) => middlewareEncoding<S, S["EncodingServices"] | R>;
1791
2907
  /**
2908
+ * The type produced by {@link decodeTo} when a custom transformation is provided.
2909
+ *
2910
+ * - `Type` is `To["Type"]`, `Encoded` is `From["Encoded"]`
2911
+ * - Decoding services from both `from` and `to` are combined
2912
+ *
2913
+ * @see {@link compose} for the passthrough (no transformation) variant
1792
2914
  * @since 4.0.0
1793
2915
  */
1794
2916
  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"]> {
@@ -1797,6 +2919,12 @@ export interface decodeTo<To extends Top, From extends Top, RD = never, RE = nev
1797
2919
  readonly to: To;
1798
2920
  }
1799
2921
  /**
2922
+ * The type produced by {@link decodeTo} when called without a custom transformation (passthrough composition).
2923
+ *
2924
+ * Equivalent to {@link decodeTo} with `RD = never` and `RE = never`, meaning the schemas
2925
+ * are composed using their natural encoding/decoding chain.
2926
+ *
2927
+ * @see {@link decodeTo} for the transformation variant
1800
2928
  * @since 4.0.0
1801
2929
  */
1802
2930
  export interface compose<To extends Top, From extends Top> extends decodeTo<To, From> {
@@ -1890,6 +3018,25 @@ export declare function decode<S extends Top, RD = never, RE = never>(transforma
1890
3018
  readonly encode: Getter.Getter<S["Type"], S["Type"], RE>;
1891
3019
  }): (self: S) => decodeTo<toType<S>, S, RD, RE>;
1892
3020
  /**
3021
+ * Like {@link decodeTo} but reverses the direction: the `from` schema acts as the target (decoded type)
3022
+ * and `to` acts as the encoded source.
3023
+ *
3024
+ * `encodeTo(to)(from)` is equivalent to `to.pipe(decodeTo(from))` — useful when it reads more
3025
+ * naturally to specify the encoded schema first.
3026
+ *
3027
+ * **Example** (Encode a number back to string)
3028
+ *
3029
+ * ```ts
3030
+ * import { Schema, SchemaGetter } from "effect"
3031
+ *
3032
+ * const NumberFromString = Schema.Number.pipe(
3033
+ * Schema.encodeTo(Schema.String, {
3034
+ * decode: SchemaGetter.transform((s: string) => Number(s)),
3035
+ * encode: SchemaGetter.transform((n: number) => String(n))
3036
+ * })
3037
+ * )
3038
+ * ```
3039
+ *
1893
3040
  * @since 4.0.0
1894
3041
  */
1895
3042
  export declare function encodeTo<To extends Top>(to: To): <From extends Top>(from: From) => decodeTo<From, To>;
@@ -1898,19 +3045,45 @@ export declare function encodeTo<To extends Top, From extends Top, RD = never, R
1898
3045
  readonly encode: Getter.Getter<NoInfer<To["Type"]>, NoInfer<From["Encoded"]>, RE>;
1899
3046
  }): (from: From) => decodeTo<From, To, RD, RE>;
1900
3047
  /**
1901
- * @since 4.0.0
1902
- */
1903
- export declare function encode<S extends Top, RD = never, RE = never>(transformation: {
1904
- readonly decode: Getter.Getter<S["Encoded"], S["Encoded"], RD>;
3048
+ * Applies a transformation to a schema's encoded type, creating a new schema where encoding/decoding
3049
+ * operate on `S["Encoded"]` rather than `S["Type"]`.
3050
+ *
3051
+ * The `decode` getter maps `S["Encoded"]` → `S["Encoded"]` (applied during decoding),
3052
+ * and the `encode` getter maps `S["Encoded"]` → `S["Encoded"]` (applied during encoding).
3053
+ *
3054
+ * **Example** (Upper-casing encoded strings)
3055
+ *
3056
+ * ```ts
3057
+ * import { Schema, SchemaGetter } from "effect"
3058
+ *
3059
+ * const UpperFromLower = Schema.String.pipe(
3060
+ * Schema.encode({
3061
+ * decode: SchemaGetter.transform((s: string) => s.toLowerCase()),
3062
+ * encode: SchemaGetter.transform((s: string) => s.toUpperCase())
3063
+ * })
3064
+ * )
3065
+ * ```
3066
+ *
3067
+ * @since 4.0.0
3068
+ */
3069
+ export declare function encode<S extends Top, RD = never, RE = never>(transformation: {
3070
+ readonly decode: Getter.Getter<S["Encoded"], S["Encoded"], RD>;
1905
3071
  readonly encode: Getter.Getter<S["Encoded"], S["Encoded"], RE>;
1906
3072
  }): (self: S) => decodeTo<S, toEncoded<S>, RD, RE>;
1907
3073
  /**
3074
+ * Constraint used to ensure a schema field does not already have a constructor default.
3075
+ *
3076
+ * Only schemas that satisfy this constraint can be passed to {@link withConstructorDefault}.
3077
+ *
1908
3078
  * @since 4.0.0
1909
3079
  */
1910
3080
  export interface WithoutConstructorDefault {
1911
3081
  readonly "~type.constructor.default": "no-default";
1912
3082
  }
1913
3083
  /**
3084
+ * The type produced by {@link withConstructorDefault} — a schema with `"~type.constructor.default": "with-default"`.
3085
+ *
3086
+ * @see {@link withConstructorDefault} for the constructor
1914
3087
  * @since 4.0.0
1915
3088
  */
1916
3089
  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"]> {
@@ -1918,15 +3091,50 @@ export interface withConstructorDefault<S extends Top & WithoutConstructorDefaul
1918
3091
  readonly schema: S;
1919
3092
  }
1920
3093
  /**
3094
+ * Attaches a constructor default value to a schema field.
3095
+ *
3096
+ * The `defaultValue` function receives `Option.some(undefined)` when the field is
3097
+ * explicitly set to `undefined`, or `Option.none()` when the field is absent.
3098
+ * Return `Option.some(value)` to supply a default, or `Option.none()` to leave the
3099
+ * field required. An `Effect` may be returned for async or service-dependent defaults.
3100
+ *
3101
+ * Constructor defaults are applied only during `makeUnsafe` / `make`, not during
3102
+ * decoding or encoding.
3103
+ *
3104
+ * **Example** (Optional field with a static default)
3105
+ *
3106
+ * ```ts
3107
+ * import { Option, Schema } from "effect"
3108
+ *
3109
+ * const MySchema = Schema.Struct({
3110
+ * name: Schema.String.pipe(
3111
+ * Schema.optionalKey,
3112
+ * Schema.withConstructorDefault(() => Option.some("anonymous"))
3113
+ * )
3114
+ * })
3115
+ *
3116
+ * const value = MySchema.makeUnsafe({})
3117
+ * // value: { name: "anonymous" }
3118
+ * ```
3119
+ *
1921
3120
  * @since 4.0.0
1922
3121
  */
1923
3122
  export declare function withConstructorDefault<S extends Top & WithoutConstructorDefault>(defaultValue: (input: Option_.Option<undefined>) => Option_.Option<S["~type.make.in"]> | Effect.Effect<Option_.Option<S["~type.make.in"]>>): (schema: S) => withConstructorDefault<S>;
1924
3123
  /**
3124
+ * The type produced by {@link withDecodingDefaultKey} — a schema that decodes from an `optionalKey` encoded source.
3125
+ *
3126
+ * @see {@link withDecodingDefaultKey} for the constructor
1925
3127
  * @since 4.0.0
1926
3128
  */
1927
3129
  export interface withDecodingDefaultKey<S extends Top> extends decodeTo<S, optionalKey<toEncoded<S>>> {
1928
3130
  }
1929
3131
  /**
3132
+ * Options for {@link withDecodingDefaultKey} and {@link withDecodingDefault}.
3133
+ *
3134
+ * - `encodingStrategy`:
3135
+ * - `"passthrough"` (default): pass the value through during encoding
3136
+ * - `"omit"`: omit the key from the encoded output
3137
+ *
1930
3138
  * @since 4.0.0
1931
3139
  */
1932
3140
  export type DecodingDefaultOptions = {
@@ -1939,10 +3147,34 @@ export type DecodingDefaultOptions = {
1939
3147
  * - `passthrough`: (default) Pass the default value through to the output.
1940
3148
  * - `omit`: Omit the value from the output.
1941
3149
  *
3150
+ * Provides a default value for a missing key during decoding.
3151
+ *
3152
+ * When the key is absent from the input, `defaultValue()` is called to supply a value.
3153
+ * During encoding, the behavior is controlled by `options.encodingStrategy`:
3154
+ * - `"passthrough"` (default): include the value in the output
3155
+ * - `"omit"`: omit the key from the output
3156
+ *
3157
+ * **Example** (Default for a missing struct key)
3158
+ *
3159
+ * ```ts
3160
+ * import { Schema } from "effect"
3161
+ *
3162
+ * const MySchema = Schema.Struct({
3163
+ * name: Schema.String.pipe(Schema.withDecodingDefaultKey(() => "anonymous"))
3164
+ * })
3165
+ *
3166
+ * const result = Schema.decodeUnknownSync(MySchema)({})
3167
+ * // result: { name: "anonymous" }
3168
+ * ```
3169
+ *
3170
+ * @see {@link withDecodingDefault} for the `optional` (value-level) variant
1942
3171
  * @since 4.0.0
1943
3172
  */
1944
3173
  export declare function withDecodingDefaultKey<S extends Top>(defaultValue: () => S["Encoded"], options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultKey<S>;
1945
3174
  /**
3175
+ * The type produced by {@link withDecodingDefault} — a schema that decodes from an `optional` encoded source.
3176
+ *
3177
+ * @see {@link withDecodingDefault} for the constructor
1946
3178
  * @since 4.0.0
1947
3179
  */
1948
3180
  export interface withDecodingDefault<S extends Top> extends decodeTo<S, optional<toEncoded<S>>> {
@@ -1954,34 +3186,93 @@ export interface withDecodingDefault<S extends Top> extends decodeTo<S, optional
1954
3186
  * - `passthrough`: (default) Pass the default value through to the output.
1955
3187
  * - `omit`: Omit the value from the output.
1956
3188
  *
3189
+ * Provides a default value for an `optional` field during decoding.
3190
+ *
3191
+ * Similar to {@link withDecodingDefaultKey} but works on `optional` (value-level optional)
3192
+ * rather than `optionalKey` (key-level optional).
3193
+ *
3194
+ * When the value is `undefined` or absent, `defaultValue()` is called to supply a value.
3195
+ * During encoding, the behavior is controlled by `options.encodingStrategy`:
3196
+ * - `"passthrough"` (default): include the value in the output
3197
+ * - `"omit"`: omit the value from the output
3198
+ *
3199
+ * **Example** (Default for an optional field value)
3200
+ *
3201
+ * ```ts
3202
+ * import { Schema } from "effect"
3203
+ *
3204
+ * const MySchema = Schema.Struct({
3205
+ * name: Schema.String.pipe(Schema.optional, Schema.withDecodingDefault(() => "anonymous"))
3206
+ * })
3207
+ *
3208
+ * const result = Schema.decodeUnknownSync(MySchema)({ name: undefined })
3209
+ * // result: { name: "anonymous" }
3210
+ * ```
3211
+ *
3212
+ * @see {@link withDecodingDefaultKey} for the key-level variant
1957
3213
  * @since 4.0.0
1958
3214
  */
1959
3215
  export declare function withDecodingDefault<S extends Top>(defaultValue: () => S["Encoded"], options?: DecodingDefaultOptions): (self: S) => withDecodingDefault<S>;
1960
3216
  /**
3217
+ * The type produced by {@link tag} — a literal schema with a constructor default.
3218
+ *
3219
+ * Used as the type of the `_tag` field in {@link TaggedStruct} and related helpers.
3220
+ *
3221
+ * @see {@link tag} for the constructor
1961
3222
  * @since 4.0.0
1962
3223
  */
1963
3224
  export interface tag<Tag extends AST.LiteralValue> extends withConstructorDefault<Literal<Tag>> {
1964
3225
  }
1965
3226
  /**
1966
- * Creates a schema for a literal value and automatically provides itself as a
1967
- * default.
3227
+ * Combines a {@link Literal} schema with {@link withConstructorDefault}, making it ideal
3228
+ * for discriminator fields in tagged unions. When constructing via `makeUnsafe`, the
3229
+ * `_tag` field can be omitted and will be filled automatically.
3230
+ *
3231
+ * **Example** (Discriminated union tag)
1968
3232
  *
1969
- * The `tag` function combines a literal schema with a constructor default,
1970
- * making it perfect for discriminated unions and tagged data structures. The
1971
- * tag value is automatically provided when the field is missing during
1972
- * construction.
3233
+ * ```ts
3234
+ * import { Schema } from "effect"
3235
+ *
3236
+ * const A = Schema.Struct({ _tag: Schema.tag("A"), value: Schema.Number })
3237
+ *
3238
+ * // _tag is optional in makeUnsafe, auto-filled to "A"
3239
+ * const a = A.makeUnsafe({ value: 42 })
3240
+ * // a: { _tag: "A", value: 42 }
3241
+ * ```
1973
3242
  *
3243
+ * @see {@link tagDefaultOmit} to also omit the tag during encoding
3244
+ * @see {@link TaggedStruct} for a shorthand that adds `_tag` automatically
1974
3245
  * @since 4.0.0
1975
3246
  */
1976
3247
  export declare function tag<Tag extends AST.LiteralValue>(literal: Tag): tag<Tag>;
1977
3248
  /**
1978
- * Similar to `tag`, but provides itself as a default when decoding and omits
1979
- * the value from the output when encoding.
3249
+ * Like {@link tag}, but additionally omits the tag field from the encoded output.
3250
+ * Useful when the encoded form (e.g. JSON) does not include the discriminator key,
3251
+ * but the decoded type and constructor still need it.
3252
+ *
3253
+ * **Example** (Tag omitted during encoding)
3254
+ *
3255
+ * ```ts
3256
+ * import { Schema } from "effect"
3257
+ *
3258
+ * const A = Schema.Struct({
3259
+ * _tag: Schema.tagDefaultOmit("A"),
3260
+ * value: Schema.Number
3261
+ * })
3262
+ *
3263
+ * // Encode strips the _tag field
3264
+ * const encoded = Schema.encodeUnknownSync(A)({ _tag: "A", value: 1 })
3265
+ * // encoded: { value: 1 }
3266
+ * ```
1980
3267
  *
3268
+ * @see {@link tag} for the variant that keeps the tag during encoding
1981
3269
  * @since 4.0.0
1982
3270
  */
1983
3271
  export declare function tagDefaultOmit<Tag extends AST.LiteralValue>(literal: Tag): withDecodingDefaultKey<tag<Tag>>;
1984
3272
  /**
3273
+ * The type produced by {@link TaggedStruct} — a {@link Struct} with an extra `_tag` field of type {@link tag}.
3274
+ *
3275
+ * @see {@link TaggedStruct} for the constructor
1985
3276
  * @since 4.0.0
1986
3277
  */
1987
3278
  export type TaggedStruct<Tag extends AST.LiteralValue, Fields extends Struct.Fields> = Struct<Simplify<{
@@ -2053,15 +3344,18 @@ type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Top
2053
3344
  [M in Flattened[number] as M["Type"][Tag]]: (u: unknown) => u is M["Type"];
2054
3345
  };
2055
3346
  readonly match: {
2056
- <Output>(value: Members[number]["Type"], cases: {
2057
- [M in Flattened[number] as M["Type"][Tag]]: (value: M["Type"]) => Output;
2058
- }): Output;
2059
- <Output>(cases: {
2060
- [M in Flattened[number] as M["Type"][Tag]]: (value: M["Type"]) => Output;
2061
- }): (value: Members[number]["Type"]) => Output;
3347
+ <Cases extends {
3348
+ [M in Flattened[number] as M["Type"][Tag]]: (value: M["Type"]) => any;
3349
+ }>(value: Members[number]["Type"], cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? Unify<R> : never;
3350
+ <Cases extends {
3351
+ [M in Flattened[number] as M["Type"][Tag]]: (value: M["Type"]) => any;
3352
+ }>(cases: Cases): (value: Members[number]["Type"]) => Cases[keyof Cases] extends (value: any) => infer R ? Unify<R> : never;
2062
3353
  };
2063
3354
  };
2064
3355
  /**
3356
+ * The type produced by {@link toTaggedUnion} — a {@link Union} augmented with `cases`, `guards`, `isAnyOf`, and `match` utilities.
3357
+ *
3358
+ * @see {@link toTaggedUnion} for the constructor
2065
3359
  * @since 4.0.0
2066
3360
  * @experimental
2067
3361
  */
@@ -2071,6 +3365,26 @@ export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray
2071
3365
  };
2072
3366
  }>> = Union<Members> & TaggedUnionUtils<Tag, Members>;
2073
3367
  /**
3368
+ * Augments an existing {@link Union} of tagged structs with utility methods keyed by the discriminant field.
3369
+ *
3370
+ * **Example** (Adding tagged-union utilities to an existing union)
3371
+ *
3372
+ * ```ts
3373
+ * import { Schema } from "effect"
3374
+ *
3375
+ * const A = Schema.TaggedStruct("A", { value: Schema.Number })
3376
+ * const B = Schema.TaggedStruct("B", { name: Schema.String })
3377
+ *
3378
+ * const MyUnion = Schema.Union([A, B]).pipe(Schema.toTaggedUnion("_tag"))
3379
+ *
3380
+ * // Pattern-match on the union
3381
+ * const result = MyUnion.match({ _tag: "A", value: 1 }, {
3382
+ * A: (a) => `number: ${a.value}`,
3383
+ * B: (b) => `name: ${b.name}`
3384
+ * })
3385
+ * ```
3386
+ *
3387
+ * @see {@link TaggedUnion} for a shorthand that builds the union from scratch
2074
3388
  * @since 4.0.0
2075
3389
  * @experimental
2076
3390
  */
@@ -2078,6 +3392,10 @@ export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag):
2078
3392
  readonly Type: { readonly [K in Tag]: PropertyKey; };
2079
3393
  }>>(self: Union<Members>) => toTaggedUnion<Tag, Members>;
2080
3394
  /**
3395
+ * A union schema that exposes `cases`, `guards`, `isAnyOf`, and `match` utilities keyed by the `_tag` discriminant.
3396
+ * Produced by {@link TaggedUnion}.
3397
+ *
3398
+ * @see {@link TaggedUnion} for the constructor
2081
3399
  * @since 4.0.0
2082
3400
  * @experimental
2083
3401
  */
@@ -2101,15 +3419,37 @@ export interface TaggedUnion<Cases extends Record<string, Top>> extends Bottom<{
2101
3419
  [K in keyof Cases]: (u: unknown) => u is Cases[K]["Type"];
2102
3420
  };
2103
3421
  readonly match: {
2104
- <Output>(value: Cases[keyof Cases]["Type"], cases: {
2105
- [K in keyof Cases]: (value: Cases[K]["Type"]) => Output;
2106
- }): Output;
2107
3422
  <Output>(cases: {
2108
3423
  [K in keyof Cases]: (value: Cases[K]["Type"]) => Output;
2109
3424
  }): (value: Cases[keyof Cases]["Type"]) => Output;
3425
+ <Output>(value: Cases[keyof Cases]["Type"], cases: {
3426
+ [K in keyof Cases]: (value: Cases[K]["Type"]) => Output;
3427
+ }): Output;
2110
3428
  };
2111
3429
  }
2112
3430
  /**
3431
+ * Builds a discriminated union from a record of field sets, one per variant.
3432
+ * Each key becomes the `_tag` literal and the value is passed to {@link TaggedStruct}.
3433
+ * The result includes `cases`, `guards`, `isAnyOf`, and `match` utilities.
3434
+ *
3435
+ * **Example** (Discriminated union with pattern matching)
3436
+ *
3437
+ * ```ts
3438
+ * import { Schema } from "effect"
3439
+ *
3440
+ * const Shape = Schema.TaggedUnion({
3441
+ * Circle: { radius: Schema.Number },
3442
+ * Rectangle: { width: Schema.Number, height: Schema.Number }
3443
+ * })
3444
+ *
3445
+ * // Pattern-match on a decoded value
3446
+ * const area = Shape.match({ _tag: "Circle", radius: 5 }, {
3447
+ * Circle: (c) => Math.PI * c.radius ** 2,
3448
+ * Rectangle: (r) => r.width * r.height
3449
+ * })
3450
+ * ```
3451
+ *
3452
+ * @see {@link toTaggedUnion} to augment an existing union instead
2113
3453
  * @category Constructors
2114
3454
  * @since 4.0.0
2115
3455
  */
@@ -2117,29 +3457,69 @@ export declare function TaggedUnion<const CasesByTag extends Record<string, Stru
2117
3457
  readonly [K in keyof CasesByTag & string]: TaggedStruct<K, CasesByTag[K]>;
2118
3458
  }>;
2119
3459
  /**
3460
+ * The interface type for schemas created by {@link Opaque}.
3461
+ * Carries the same encoded/decoded shape as `S` but replaces `Type` with `Self & Brand`,
3462
+ * making the decoded value nominally distinct.
3463
+ *
3464
+ * @see {@link Opaque} for the constructor
2120
3465
  * @since 4.0.0
2121
3466
  */
2122
3467
  export interface Opaque<Self, S extends Top, Brand> extends Bottom<Self, S["Encoded"], S["DecodingServices"], S["EncodingServices"], S["ast"], S["~rebuild.out"], 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"]> {
2123
3468
  new (_: never): S["Type"] & Brand;
2124
3469
  }
2125
3470
  /**
3471
+ * Wraps a schema so that its decoded `Type` becomes a nominally distinct type `Self`.
3472
+ * Useful for creating opaque types that are structurally identical to a base schema
3473
+ * but type-incompatible with it.
3474
+ *
3475
+ * **Example** (Opaque user ID)
3476
+ *
3477
+ * ```ts
3478
+ * import { Schema } from "effect"
3479
+ *
3480
+ * type UserId = string & { readonly _tag: "UserId" }
3481
+ * const UserId = Schema.Opaque<UserId>()(Schema.String)
3482
+ *
3483
+ * // Decoded value is UserId, not plain string
3484
+ * const id = Schema.decodeUnknownSync(UserId)("abc")
3485
+ * // id: UserId
3486
+ * ```
3487
+ *
2126
3488
  * @since 4.0.0
2127
3489
  */
2128
3490
  export declare function Opaque<Self, Brand = {}>(): <S extends Top>(schema: S) => Opaque<Self, S, Brand> & Omit<S, "Type">;
2129
3491
  /**
3492
+ * The type produced by {@link instanceOf} — a declaration schema that validates class instances.
3493
+ *
3494
+ * @see {@link instanceOf} for the constructor
2130
3495
  * @since 4.0.0
2131
3496
  */
2132
3497
  export interface instanceOf<T, Iso = T> extends declare<T, Iso> {
2133
3498
  readonly "~rebuild.out": this;
2134
3499
  }
2135
3500
  /**
2136
- * Creates a schema that validates an instance of a specific class constructor.
3501
+ * Creates a schema that validates values using `instanceof`.
3502
+ * Decoding and encoding pass the value through unchanged.
3503
+ *
3504
+ * **Example** (Schema for a built-in class)
3505
+ *
3506
+ * ```ts
3507
+ * import { Schema } from "effect"
3508
+ *
3509
+ * const DateSchema = Schema.instanceOf(Date)
3510
+ *
3511
+ * const decoded = Schema.decodeUnknownSync(DateSchema)(new Date("2024-01-01"))
3512
+ * // decoded: Date
3513
+ * ```
2137
3514
  *
2138
3515
  * @category Constructors
2139
3516
  * @since 4.0.0
2140
3517
  */
2141
3518
  export declare function instanceOf<C extends abstract new (...args: any) => any, Iso = InstanceType<C>>(constructor: C, annotations?: Annotations.Declaration<InstanceType<C>> | undefined): instanceOf<InstanceType<C>, Iso>;
2142
3519
  /**
3520
+ * Constructs an `AST.Link` that describes how a value of type `T` encodes to and decodes from a `To` schema.
3521
+ * Used when building low-level AST transformations that bridge two schema types.
3522
+ *
2143
3523
  * @since 4.0.0
2144
3524
  * @experimental
2145
3525
  */
@@ -2148,6 +3528,22 @@ export declare function link<T>(): <To extends Top>(encodeTo: To, transformation
2148
3528
  readonly encode: Getter.Getter<NoInfer<To["Type"]>, T>;
2149
3529
  }) => AST.Link;
2150
3530
  /**
3531
+ * Creates a custom filter check from a predicate function. The predicate
3532
+ * receives the input value, the schema's AST, and parse options, and returns
3533
+ * `true`/`undefined` on success or a failure description on error.
3534
+ *
3535
+ * **Example** (Custom filter check)
3536
+ * ```ts
3537
+ * import { Schema } from "effect"
3538
+ *
3539
+ * // Check that a number is even
3540
+ * const isEven = Schema.makeFilter(
3541
+ * (n: number) => n % 2 === 0 || "expected an even number"
3542
+ * )
3543
+ *
3544
+ * const EvenNumber = Schema.Number.check(isEven)
3545
+ * ```
3546
+ *
2151
3547
  * @category Checks Constructors
2152
3548
  * @since 4.0.0
2153
3549
  */
@@ -2156,6 +3552,9 @@ export declare const makeFilter: <T>(filter: (input: T, ast: AST.AST, options: A
2156
3552
  readonly message: string;
2157
3553
  }, annotations?: Annotations.Filter | undefined, abort?: boolean) => AST.Filter<T>;
2158
3554
  /**
3555
+ * Groups multiple checks into a single {@link AST.FilterGroup}, applying
3556
+ * optional shared annotations to the group as a whole.
3557
+ *
2159
3558
  * @category Checks Constructors
2160
3559
  * @since 4.0.0
2161
3560
  */
@@ -2262,7 +3661,7 @@ export declare const isStringSymbol: (annotations?: Annotations.Filter) => AST.F
2262
3661
  * @category String checks
2263
3662
  * @since 4.0.0
2264
3663
  */
2265
- export declare function isUUID(version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | undefined, annotations?: Annotations.Filter): AST.Filter<string>;
3664
+ export declare function isUUID(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, annotations?: Annotations.Filter): AST.Filter<string>;
2266
3665
  /**
2267
3666
  * Validates that a string is a valid ULID (Universally Unique Lexicographically
2268
3667
  * Sortable Identifier).
@@ -2453,6 +3852,9 @@ export declare function isUncapitalized(annotations?: Annotations.Filter): AST.F
2453
3852
  */
2454
3853
  export declare function isFinite(annotations?: Annotations.Filter): AST.Filter<number>;
2455
3854
  /**
3855
+ * Generic factory for creating a "greater than" (`>`) check for any ordered
3856
+ * type by supplying an {@link Order.Order} instance.
3857
+ *
2456
3858
  * @category Order checks
2457
3859
  * @since 4.0.0
2458
3860
  */
@@ -2462,6 +3864,9 @@ export declare function makeIsGreaterThan<T>(options: {
2462
3864
  readonly formatter?: Formatter<T> | undefined;
2463
3865
  }): (exclusiveMinimum: T, annotations?: Annotations.Filter) => AST.Filter<T>;
2464
3866
  /**
3867
+ * Generic factory for creating a ">=" check for any ordered type by supplying
3868
+ * an {@link Order.Order} instance.
3869
+ *
2465
3870
  * @category Order checks
2466
3871
  * @since 4.0.0
2467
3872
  */
@@ -2471,6 +3876,9 @@ export declare function makeIsGreaterThanOrEqualTo<T>(options: {
2471
3876
  readonly formatter?: Formatter<T> | undefined;
2472
3877
  }): (minimum: T, annotations?: Annotations.Filter) => AST.Filter<T>;
2473
3878
  /**
3879
+ * Generic factory for creating a "<" check for any ordered type by supplying
3880
+ * an {@link Order.Order} instance.
3881
+ *
2474
3882
  * @category Order checks
2475
3883
  * @since 4.0.0
2476
3884
  */
@@ -2480,6 +3888,9 @@ export declare function makeIsLessThan<T>(options: {
2480
3888
  readonly formatter?: Formatter<T> | undefined;
2481
3889
  }): (exclusiveMaximum: T, annotations?: Annotations.Filter) => AST.Filter<T>;
2482
3890
  /**
3891
+ * Generic factory for creating a "<=" check for any ordered type by supplying
3892
+ * an {@link Order.Order} instance.
3893
+ *
2483
3894
  * @category Order checks
2484
3895
  * @since 4.0.0
2485
3896
  */
@@ -2489,6 +3900,9 @@ export declare function makeIsLessThanOrEqualTo<T>(options: {
2489
3900
  readonly formatter?: Formatter<T> | undefined;
2490
3901
  }): (maximum: T, annotations?: Annotations.Filter) => AST.Filter<T>;
2491
3902
  /**
3903
+ * Generic factory for creating an inclusive/exclusive range check for any
3904
+ * ordered type by supplying an {@link Order.Order} instance.
3905
+ *
2492
3906
  * @category Order checks
2493
3907
  * @since 4.0.0
2494
3908
  */
@@ -2508,6 +3922,9 @@ export declare function makeIsBetween<T>(deriveOptions: {
2508
3922
  readonly exclusiveMaximum?: boolean | undefined;
2509
3923
  }, annotations?: Annotations.Filter) => AST.Filter<T>;
2510
3924
  /**
3925
+ * Generic factory for creating a divisibility check for any numeric type by
3926
+ * supplying a remainder function and a zero value.
3927
+ *
2511
3928
  * @category Numeric checks
2512
3929
  * @since 4.0.0
2513
3930
  */
@@ -2856,6 +4273,48 @@ export declare const isBetweenBigInt: (options: {
2856
4273
  readonly exclusiveMinimum?: boolean | undefined;
2857
4274
  readonly exclusiveMaximum?: boolean | undefined;
2858
4275
  }, annotations?: Annotations.Filter) => AST.Filter<bigint>;
4276
+ /**
4277
+ * Validates that a BigDecimal is greater than the specified value (exclusive).
4278
+ *
4279
+ * @category BigDecimal checks
4280
+ * @since 4.0.0
4281
+ */
4282
+ export declare const isGreaterThanBigDecimal: (exclusiveMinimum: BigDecimal_.BigDecimal, annotations?: Annotations.Filter) => AST.Filter<BigDecimal_.BigDecimal>;
4283
+ /**
4284
+ * Validates that a BigDecimal is greater than or equal to the specified value
4285
+ * (inclusive).
4286
+ *
4287
+ * @category BigDecimal checks
4288
+ * @since 4.0.0
4289
+ */
4290
+ export declare const isGreaterThanOrEqualToBigDecimal: (minimum: BigDecimal_.BigDecimal, annotations?: Annotations.Filter) => AST.Filter<BigDecimal_.BigDecimal>;
4291
+ /**
4292
+ * Validates that a BigDecimal is less than the specified value (exclusive).
4293
+ *
4294
+ * @category BigDecimal checks
4295
+ * @since 4.0.0
4296
+ */
4297
+ export declare const isLessThanBigDecimal: (exclusiveMaximum: BigDecimal_.BigDecimal, annotations?: Annotations.Filter) => AST.Filter<BigDecimal_.BigDecimal>;
4298
+ /**
4299
+ * Validates that a BigDecimal is less than or equal to the specified value
4300
+ * (inclusive).
4301
+ *
4302
+ * @category BigDecimal checks
4303
+ * @since 4.0.0
4304
+ */
4305
+ export declare const isLessThanOrEqualToBigDecimal: (maximum: BigDecimal_.BigDecimal, annotations?: Annotations.Filter) => AST.Filter<BigDecimal_.BigDecimal>;
4306
+ /**
4307
+ * Validates that a BigDecimal is within a specified range.
4308
+ *
4309
+ * @category BigDecimal checks
4310
+ * @since 4.0.0
4311
+ */
4312
+ export declare const isBetweenBigDecimal: (options: {
4313
+ readonly minimum: BigDecimal_.BigDecimal;
4314
+ readonly maximum: BigDecimal_.BigDecimal;
4315
+ readonly exclusiveMinimum?: boolean | undefined;
4316
+ readonly exclusiveMaximum?: boolean | undefined;
4317
+ }, annotations?: Annotations.Filter) => AST.Filter<BigDecimal_.BigDecimal>;
2859
4318
  /**
2860
4319
  * Validates that a value has at least the specified length. Works with strings
2861
4320
  * and arrays.
@@ -2871,6 +4330,14 @@ export declare const isBetweenBigInt: (options: {
2871
4330
  * constraint to ensure generated strings or arrays have at least the required
2872
4331
  * length.
2873
4332
  *
4333
+ * **Example** (Minimum length check)
4334
+ * ```ts
4335
+ * import { Schema } from "effect"
4336
+ *
4337
+ * const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1))
4338
+ * const NonEmptyArraySchema = Schema.Array(Schema.Number).check(Schema.isMinLength(1))
4339
+ * ```
4340
+ *
2874
4341
  * @category Length checks
2875
4342
  * @since 4.0.0
2876
4343
  */
@@ -3086,6 +4553,7 @@ export declare function isPropertyNames(keySchema: Top, annotations?: Annotation
3086
4553
  * constraint using the provided equivalence function to ensure generated arrays
3087
4554
  * contain only unique items.
3088
4555
  *
4556
+ * @category Array checks
3089
4557
  * @since 4.0.0
3090
4558
  */
3091
4559
  export declare function isUnique<T>(annotations?: Annotations.Filter): AST.Filter<readonly T[]>;
@@ -3103,6 +4571,23 @@ export declare const NonEmptyString: String;
3103
4571
  */
3104
4572
  export declare const Char: String;
3105
4573
  /**
4574
+ * Schema for the `Option<A>` type, representing an optional value that is
4575
+ * either `None` or `Some<A>`.
4576
+ *
4577
+ * **Example** (Option schema)
4578
+ *
4579
+ * ```ts
4580
+ * import { Schema } from "effect"
4581
+ * import { Option } from "effect"
4582
+ *
4583
+ * const schema = Schema.Option(Schema.Number)
4584
+ *
4585
+ * Schema.decodeUnknownSync(schema)(Option.some(1))
4586
+ * // => Some(1)
4587
+ * Schema.decodeUnknownSync(schema)(Option.none())
4588
+ * // => None
4589
+ * ```
4590
+ *
3106
4591
  * @category Option
3107
4592
  * @since 4.0.0
3108
4593
  */
@@ -3120,11 +4605,16 @@ export type OptionIso<A extends Top> = {
3120
4605
  readonly value: A["Iso"];
3121
4606
  };
3122
4607
  /**
4608
+ * Creates a schema for `Option<A>`. See {@link Option} for details.
4609
+ *
3123
4610
  * @category Option
3124
4611
  * @since 4.0.0
3125
4612
  */
3126
4613
  export declare function Option<A extends Top>(value: A): Option<A>;
3127
4614
  /**
4615
+ * Schema type for {@link OptionFromNullOr}.
4616
+ *
4617
+ * @category Option
3128
4618
  * @since 4.0.0
3129
4619
  */
3130
4620
  export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<S>>, NullOr<S>> {
@@ -3145,6 +4635,57 @@ export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<
3145
4635
  */
3146
4636
  export declare function OptionFromNullOr<S extends Top>(schema: S): OptionFromNullOr<S>;
3147
4637
  /**
4638
+ * Schema type for {@link OptionFromUndefinedOr}.
4639
+ *
4640
+ * @category Option
4641
+ * @since 4.0.0
4642
+ */
4643
+ export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
4644
+ }
4645
+ /**
4646
+ * Decodes an undefined-or value `T` to a required `Option<T>` value.
4647
+ *
4648
+ * Decoding:
4649
+ * - `undefined` is decoded as `None`
4650
+ * - other values are decoded as `Some`
4651
+ *
4652
+ * Encoding:
4653
+ * - `None` is encoded as `undefined`
4654
+ * - `Some` is encoded as the value
4655
+ *
4656
+ * @category Option
4657
+ * @since 4.0.0
4658
+ */
4659
+ export declare function OptionFromUndefinedOr<S extends Top>(schema: S): OptionFromUndefinedOr<S>;
4660
+ /**
4661
+ * Schema type for {@link OptionFromNullishOr}.
4662
+ *
4663
+ * @category Option
4664
+ * @since 4.0.0
4665
+ */
4666
+ export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
4667
+ }
4668
+ /**
4669
+ * Decodes a nullish value `T` to a required `Option<T>` value.
4670
+ *
4671
+ * Decoding:
4672
+ * - `null` and `undefined` are decoded as `None`
4673
+ * - other values are decoded as `Some`
4674
+ *
4675
+ * Encoding:
4676
+ * - `None` is encoded as `null` or `undefined` depending on the provided `options.onNoneEncoding` (defaults to `undefined`)
4677
+ * - `Some` is encoded as the value
4678
+ *
4679
+ * @category Option
4680
+ * @since 4.0.0
4681
+ */
4682
+ export declare function OptionFromNullishOr<S extends Top>(schema: S, options?: {
4683
+ onNoneEncoding: null | undefined;
4684
+ }): OptionFromNullishOr<S>;
4685
+ /**
4686
+ * Schema type for {@link OptionFromOptionalKey}.
4687
+ *
4688
+ * @category Option
3148
4689
  * @since 4.0.0
3149
4690
  */
3150
4691
  export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
@@ -3165,6 +4706,9 @@ export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<to
3165
4706
  */
3166
4707
  export declare function OptionFromOptionalKey<S extends Top>(schema: S): OptionFromOptionalKey<S>;
3167
4708
  /**
4709
+ * Schema type for {@link OptionFromOptional}.
4710
+ *
4711
+ * @category Option
3168
4712
  * @since 4.0.0
3169
4713
  */
3170
4714
  export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toType<S>>, optional<S>> {
@@ -3187,6 +4731,9 @@ export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toTyp
3187
4731
  */
3188
4732
  export declare function OptionFromOptional<S extends Top>(schema: S): OptionFromOptional<S>;
3189
4733
  /**
4734
+ * Schema for the `Result<A, E>` type, representing a computation that either
4735
+ * succeeds with `A` or fails with `E`.
4736
+ *
3190
4737
  * @category Result
3191
4738
  * @since 4.0.0
3192
4739
  */
@@ -3206,11 +4753,16 @@ export type ResultIso<A extends Top, E extends Top> = {
3206
4753
  readonly failure: E["Iso"];
3207
4754
  };
3208
4755
  /**
4756
+ * Creates a schema for `Result<A, E>`. See {@link Result} for details.
4757
+ *
3209
4758
  * @category Result
3210
4759
  * @since 4.0.0
3211
4760
  */
3212
4761
  export declare function Result<A extends Top, E extends Top>(success: A, failure: E): Result<A, E>;
3213
4762
  /**
4763
+ * Schema for the `Redacted<A>` type, providing secure handling of sensitive
4764
+ * values. The inner value is hidden from error messages.
4765
+ *
3214
4766
  * @category Redacted
3215
4767
  * @since 4.0.0
3216
4768
  */
@@ -3244,17 +4796,26 @@ export declare function Redacted<S extends Top>(value: S, options?: {
3244
4796
  readonly label?: string | undefined;
3245
4797
  }): Redacted<S>;
3246
4798
  /**
4799
+ * Schema type for {@link RedactedFromValue}.
4800
+ *
3247
4801
  * @category Redacted
3248
4802
  * @since 4.0.0
3249
4803
  */
3250
4804
  export interface RedactedFromValue<S extends Top> extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>> {
3251
4805
  }
3252
4806
  /**
4807
+ * Middleware that wraps decoded errors in `Redacted`, preventing sensitive
4808
+ * schema details from leaking in error messages.
4809
+ *
3253
4810
  * @category Redacted
3254
4811
  * @since 4.0.0
3255
4812
  */
3256
4813
  export declare function redact<S extends Top>(schema: S): middlewareDecoding<S, S["DecodingServices"]>;
3257
4814
  /**
4815
+ * Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
4816
+ * expects the input to already be a `Redacted` instance, this schema decodes
4817
+ * the raw value and wraps it.
4818
+ *
3258
4819
  * @category Redacted
3259
4820
  * @since 4.0.0
3260
4821
  */
@@ -3262,18 +4823,22 @@ export declare function RedactedFromValue<S extends Top>(value: S, options?: {
3262
4823
  readonly label?: string | undefined;
3263
4824
  }): RedactedFromValue<S>;
3264
4825
  /**
3265
- * @category CauseFailure
4826
+ * Schema for a single `Cause.Reason<E>`, representing one reason a fiber may
4827
+ * fail: a typed error (`Fail`), an unexpected defect (`Die`), or an interrupt
4828
+ * (`Interrupt`).
4829
+ *
4830
+ * @category CauseReason
3266
4831
  * @since 4.0.0
3267
4832
  */
3268
- export interface CauseFailure<E extends Top, D extends Top> extends declareConstructor<Cause_.Reason<E["Type"]>, Cause_.Reason<E["Encoded"]>, readonly [E, D], CauseFailureIso<E, D>> {
4833
+ 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>> {
3269
4834
  readonly error: E;
3270
4835
  readonly defect: D;
3271
4836
  }
3272
4837
  /**
3273
- * @category CauseFailure
4838
+ * @category CauseReason
3274
4839
  * @since 4.0.0
3275
4840
  */
3276
- export type CauseFailureIso<E extends Top, D extends Top> = {
4841
+ export type CauseReasonIso<E extends Top, D extends Top> = {
3277
4842
  readonly _tag: "Fail";
3278
4843
  readonly error: E["Iso"];
3279
4844
  } | {
@@ -3284,11 +4849,16 @@ export type CauseFailureIso<E extends Top, D extends Top> = {
3284
4849
  readonly fiberId: number | undefined;
3285
4850
  };
3286
4851
  /**
3287
- * @category CauseFailure
4852
+ * Creates a schema for `Cause.Reason<E>`. See {@link CauseReason} for details.
4853
+ *
4854
+ * @category CauseReason
3288
4855
  * @since 4.0.0
3289
4856
  */
3290
- export declare function CauseFailure<E extends Top, D extends Top>(error: E, defect: D): CauseFailure<E, D>;
4857
+ export declare function CauseReason<E extends Top, D extends Top>(error: E, defect: D): CauseReason<E, D>;
3291
4858
  /**
4859
+ * Schema for `Cause<E>`, an ordered collection of reasons a fiber failed,
4860
+ * combining typed errors, defects, and interrupts.
4861
+ *
3292
4862
  * @category Cause
3293
4863
  * @since 4.0.0
3294
4864
  */
@@ -3300,13 +4870,18 @@ export interface Cause<E extends Top, D extends Top> extends declareConstructor<
3300
4870
  * @category Cause
3301
4871
  * @since 4.0.0
3302
4872
  */
3303
- export type CauseIso<E extends Top, D extends Top> = ReadonlyArray<CauseFailureIso<E, D>>;
4873
+ export type CauseIso<E extends Top, D extends Top> = ReadonlyArray<CauseReasonIso<E, D>>;
3304
4874
  /**
4875
+ * Creates a schema for `Cause<E>`. See {@link Cause} for details.
4876
+ *
3305
4877
  * @category Cause
3306
4878
  * @since 4.0.0
3307
4879
  */
3308
4880
  export declare function Cause<E extends Top, D extends Top>(error: E, defect: D): Cause<E, D>;
3309
4881
  /**
4882
+ * Schema type for {@link Error}.
4883
+ *
4884
+ * @category Schemas
3310
4885
  * @since 4.0.0
3311
4886
  */
3312
4887
  export interface Error extends instanceOf<globalThis.Error> {
@@ -3332,6 +4907,9 @@ export declare const Error: Error;
3332
4907
  */
3333
4908
  export declare const ErrorWithStack: Error;
3334
4909
  /**
4910
+ * Schema type for {@link Defect}.
4911
+ *
4912
+ * @category Schemas
3335
4913
  * @since 4.0.0
3336
4914
  */
3337
4915
  export interface Defect extends Union<readonly [
@@ -3359,6 +4937,9 @@ export declare const Defect: Defect;
3359
4937
  */
3360
4938
  export declare const DefectWithStack: Defect;
3361
4939
  /**
4940
+ * Schema for `Exit<A, E>`, representing the result of a fiber execution —
4941
+ * either a success with value `A` or a failure with `Cause<E>`.
4942
+ *
3362
4943
  * @category Exit
3363
4944
  * @since 4.0.0
3364
4945
  */
@@ -3379,15 +4960,19 @@ export type ExitIso<A extends Top, E extends Top, D extends Top> = {
3379
4960
  readonly cause: CauseIso<E, D>;
3380
4961
  };
3381
4962
  /**
4963
+ * Creates a schema for `Exit<A, E>`. See {@link Exit} for details.
4964
+ *
3382
4965
  * @category Exit
3383
4966
  * @since 4.0.0
3384
4967
  */
3385
4968
  export declare function Exit<A extends Top, E extends Top, D extends Top>(value: A, error: E, defect: D): Exit<A, E, D>;
3386
4969
  /**
4970
+ * Schema type for {@link ReadonlyMap}.
4971
+ *
3387
4972
  * @category ReadonlyMap
3388
4973
  * @since 4.0.0
3389
4974
  */
3390
- 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>> {
4975
+ 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>> {
3391
4976
  readonly key: Key;
3392
4977
  readonly value: Value;
3393
4978
  }
@@ -3403,50 +4988,136 @@ export type ReadonlyMapIso<Key extends Top, Value extends Top> = ReadonlyArray<r
3403
4988
  * @category ReadonlyMap
3404
4989
  * @since 4.0.0
3405
4990
  */
3406
- export declare function ReadonlyMap<Key extends Top, Value extends Top>(key: Key, value: Value): ReadonlyMap$<Key, Value>;
4991
+ export declare function ReadonlyMap<Key extends Top, Value extends Top>(key: Key, value: Value): $ReadonlyMap<Key, Value>;
3407
4992
  /**
3408
- * @category ReadonlySet
4993
+ * Schema for an Effect `HashMap` where keys and values must conform to the
4994
+ * provided schemas.
4995
+ *
4996
+ * @category HashMap
3409
4997
  * @since 4.0.0
3410
4998
  */
3411
- export interface ReadonlySet$<Value extends Top> extends declareConstructor<globalThis.ReadonlySet<Value["Type"]>, globalThis.ReadonlySet<Value["Encoded"]>, readonly [Value], ReadonlySetIso<Value>> {
4999
+ 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>> {
5000
+ readonly key: Key;
3412
5001
  readonly value: Value;
3413
5002
  }
3414
5003
  /**
3415
- * @category ReadonlySet
5004
+ * @category HashMap
3416
5005
  * @since 4.0.0
3417
5006
  */
3418
- export type ReadonlySetIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
5007
+ export type HashMapIso<Key extends Top, Value extends Top> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
3419
5008
  /**
3420
- * @category ReadonlySet
5009
+ * Creates a schema that validates a `HashMap` where keys and values must
5010
+ * conform to the provided schemas.
5011
+ *
5012
+ * @category HashMap
3421
5013
  * @since 4.0.0
3422
5014
  */
3423
- export declare function ReadonlySet<Value extends Top>(value: Value): ReadonlySet$<Value>;
5015
+ export declare function HashMap<Key extends Top, Value extends Top>(key: Key, value: Value): HashMap<Key, Value>;
3424
5016
  /**
5017
+ * Schema type for {@link ReadonlySet}.
5018
+ *
5019
+ * @category ReadonlySet
3425
5020
  * @since 4.0.0
3426
5021
  */
3427
- export interface RegExp extends instanceOf<globalThis.RegExp> {
5022
+ export interface $ReadonlySet<Value extends Top> extends declareConstructor<globalThis.ReadonlySet<Value["Type"]>, globalThis.ReadonlySet<Value["Encoded"]>, readonly [Value], ReadonlySetIso<Value>> {
5023
+ readonly value: Value;
3428
5024
  }
3429
5025
  /**
5026
+ * @category ReadonlySet
3430
5027
  * @since 4.0.0
3431
5028
  */
3432
- export declare const RegExp: RegExp;
5029
+ export type ReadonlySetIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
3433
5030
  /**
5031
+ * @category ReadonlySet
3434
5032
  * @since 4.0.0
3435
5033
  */
3436
- export interface URL extends instanceOf<globalThis.URL> {
3437
- }
5034
+ export declare function ReadonlySet<Value extends Top>(value: Value): $ReadonlySet<Value>;
3438
5035
  /**
3439
- * A schema for JavaScript `URL` objects.
3440
- *
3441
- * **Default JSON serializer**
3442
- *
3443
- * - encodes `URL` as a `string`
5036
+ * Schema for an Effect `HashSet` where values must conform to the provided
5037
+ * schema.
3444
5038
  *
5039
+ * @category HashSet
3445
5040
  * @since 4.0.0
3446
- * @category URL
3447
5041
  */
3448
- export declare const URL: URL;
5042
+ export interface HashSet<Value extends Top> extends declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, readonly [Value], HashSetIso<Value>> {
5043
+ readonly value: Value;
5044
+ }
3449
5045
  /**
5046
+ * @category HashSet
5047
+ * @since 4.0.0
5048
+ */
5049
+ export type HashSetIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
5050
+ /**
5051
+ * Creates a schema that validates a `HashSet` where values must conform to the
5052
+ * provided schema.
5053
+ *
5054
+ * @category HashSet
5055
+ * @since 4.0.0
5056
+ */
5057
+ export declare function HashSet<Value extends Top>(value: Value): HashSet<Value>;
5058
+ /**
5059
+ * Schema for an Effect `Chunk` (immutable array-like collection) where values
5060
+ * must conform to the provided schema.
5061
+ *
5062
+ * @category Chunk
5063
+ * @since 4.0.0
5064
+ */
5065
+ export interface Chunk<Value extends Top> extends declareConstructor<Chunk_.Chunk<Value["Type"]>, Chunk_.Chunk<Value["Encoded"]>, readonly [Value], ChunkIso<Value>> {
5066
+ readonly value: Value;
5067
+ }
5068
+ /**
5069
+ * @category Chunk
5070
+ * @since 4.0.0
5071
+ */
5072
+ export type ChunkIso<Value extends Top> = ReadonlyArray<Value["Iso"]>;
5073
+ /**
5074
+ * Creates a schema that validates a `Chunk` where values must conform to the
5075
+ * provided schema.
5076
+ *
5077
+ * @category Chunk
5078
+ * @since 4.0.0
5079
+ */
5080
+ export declare function Chunk<Value extends Top>(value: Value): Chunk<Value>;
5081
+ /**
5082
+ * Schema type for {@link RegExp}.
5083
+ *
5084
+ * @category Schemas
5085
+ * @since 4.0.0
5086
+ */
5087
+ export interface RegExp extends instanceOf<globalThis.RegExp> {
5088
+ }
5089
+ /**
5090
+ * Schema for JavaScript `RegExp` objects.
5091
+ *
5092
+ * The default JSON serializer encodes a `RegExp` as `{ source, flags }`.
5093
+ *
5094
+ * @category Schemas
5095
+ * @since 4.0.0
5096
+ */
5097
+ export declare const RegExp: RegExp;
5098
+ /**
5099
+ * Schema type for {@link URL}.
5100
+ *
5101
+ * @category URL
5102
+ * @since 4.0.0
5103
+ */
5104
+ export interface URL extends instanceOf<globalThis.URL> {
5105
+ }
5106
+ /**
5107
+ * A schema for JavaScript `URL` objects.
5108
+ *
5109
+ * **Default JSON serializer**
5110
+ *
5111
+ * - encodes `URL` as a `string`
5112
+ *
5113
+ * @since 4.0.0
5114
+ * @category URL
5115
+ */
5116
+ export declare const URL: URL;
5117
+ /**
5118
+ * Schema type for {@link URLFromString}.
5119
+ *
5120
+ * @category URL
3450
5121
  * @since 4.0.0
3451
5122
  */
3452
5123
  export interface URLFromString extends decodeTo<URL, String> {
@@ -3465,6 +5136,9 @@ export interface URLFromString extends decodeTo<URL, String> {
3465
5136
  */
3466
5137
  export declare const URLFromString: URLFromString;
3467
5138
  /**
5139
+ * Schema type for {@link Date}.
5140
+ *
5141
+ * @category Schemas
3468
5142
  * @since 4.0.0
3469
5143
  */
3470
5144
  export interface Date extends instanceOf<globalThis.Date> {
@@ -3473,12 +5147,26 @@ export interface Date extends instanceOf<globalThis.Date> {
3473
5147
  * A schema for JavaScript `Date` objects.
3474
5148
  *
3475
5149
  * This schema accepts any `Date` instance, including invalid dates (e.g., `new
3476
- * Date("invalid")`). For validating only valid dates, use `ValidDate` instead.
5150
+ * Date("invalid")`). For validating only valid dates, use {@link DateValid}
5151
+ * instead. The default JSON serializer encodes `Date` as an ISO 8601 string.
5152
+ *
5153
+ * **Example** (Date schema)
5154
+ *
5155
+ * ```ts
5156
+ * import { Schema } from "effect"
5157
+ *
5158
+ * Schema.decodeUnknownSync(Schema.Date)(new Date("2024-01-01"))
5159
+ * // => Date { 2024-01-01T00:00:00.000Z }
5160
+ * ```
3477
5161
  *
5162
+ * @category Schemas
3478
5163
  * @since 4.0.0
3479
5164
  */
3480
5165
  export declare const Date: Date;
3481
5166
  /**
5167
+ * Schema type for {@link DateValid}.
5168
+ *
5169
+ * @category Schemas
3482
5170
  * @since 4.0.0
3483
5171
  */
3484
5172
  export interface DateValid extends Date {
@@ -3493,6 +5181,9 @@ export interface DateValid extends Date {
3493
5181
  */
3494
5182
  export declare const DateValid: Date;
3495
5183
  /**
5184
+ * Schema type for {@link Duration}.
5185
+ *
5186
+ * @category Duration
3496
5187
  * @since 4.0.0
3497
5188
  */
3498
5189
  export interface Duration extends declare<Duration_.Duration> {
@@ -3500,14 +5191,28 @@ export interface Duration extends declare<Duration_.Duration> {
3500
5191
  /**
3501
5192
  * A schema for `Duration` values.
3502
5193
  *
3503
- * **Default JSON serializer**
5194
+ * The default JSON serializer encodes `Duration` as a tagged object with the
5195
+ * duration type and value.
3504
5196
  *
3505
- * - encodes `Duration` as a `string`
5197
+ * **Example** (Duration schema)
5198
+ *
5199
+ * ```ts
5200
+ * import { Schema } from "effect"
5201
+ * import { Duration } from "effect"
5202
+ *
5203
+ * Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
5204
+ * // => Duration(5s)
5205
+ * ```
5206
+ *
5207
+ * @category Duration
3506
5208
  *
3507
5209
  * @since 4.0.0
3508
5210
  */
3509
5211
  export declare const Duration: Duration;
3510
5212
  /**
5213
+ * Schema type for {@link DurationFromNanos}.
5214
+ *
5215
+ * @category Duration
3511
5216
  * @since 4.0.0
3512
5217
  */
3513
5218
  export interface DurationFromNanos extends decodeTo<Duration, BigInt> {
@@ -3527,6 +5232,9 @@ export interface DurationFromNanos extends decodeTo<Duration, BigInt> {
3527
5232
  */
3528
5233
  export declare const DurationFromNanos: DurationFromNanos;
3529
5234
  /**
5235
+ * Schema type for {@link DurationFromMillis}.
5236
+ *
5237
+ * @category Duration
3530
5238
  * @since 4.0.0
3531
5239
  */
3532
5240
  export interface DurationFromMillis extends decodeTo<Duration, Number> {
@@ -3549,6 +5257,27 @@ export interface DurationFromMillis extends decodeTo<Duration, Number> {
3549
5257
  */
3550
5258
  export declare const DurationFromMillis: DurationFromMillis;
3551
5259
  /**
5260
+ * Schema type for {@link BigDecimal}.
5261
+ *
5262
+ * @category Schemas
5263
+ * @since 4.0.0
5264
+ */
5265
+ export interface BigDecimal extends declare<BigDecimal_.BigDecimal> {
5266
+ }
5267
+ /**
5268
+ * A schema for `BigDecimal` values.
5269
+ *
5270
+ * **Default JSON serializer**
5271
+ *
5272
+ * - encodes `BigDecimal` as a `string`
5273
+ *
5274
+ * @since 4.0.0
5275
+ */
5276
+ export declare const BigDecimal: BigDecimal;
5277
+ /**
5278
+ * Schema type for {@link UnknownFromJsonString}.
5279
+ *
5280
+ * @category JSON
3552
5281
  * @since 4.0.0
3553
5282
  */
3554
5283
  export interface UnknownFromJsonString extends fromJsonString<Unknown> {
@@ -3577,6 +5306,9 @@ export interface UnknownFromJsonString extends fromJsonString<Unknown> {
3577
5306
  */
3578
5307
  export declare const UnknownFromJsonString: fromJsonString<Unknown>;
3579
5308
  /**
5309
+ * Schema type for {@link fromJsonString}.
5310
+ *
5311
+ * @category JSON
3580
5312
  * @since 4.0.0
3581
5313
  */
3582
5314
  export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
@@ -3646,24 +5378,45 @@ export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
3646
5378
  */
3647
5379
  export declare function fromJsonString<S extends Top>(schema: S): fromJsonString<S>;
3648
5380
  /**
5381
+ * Schema type for {@link File}.
5382
+ *
5383
+ * @category Schemas
3649
5384
  * @since 4.0.0
3650
5385
  */
3651
5386
  export interface File extends instanceOf<globalThis.File> {
3652
5387
  }
3653
5388
  /**
5389
+ * Schema for JavaScript `File` objects.
5390
+ *
5391
+ * The default JSON serializer encodes a `File` as `{ data, type, name, lastModified }`
5392
+ * where `data` is base64-encoded.
5393
+ *
5394
+ * @category Schemas
3654
5395
  * @since 4.0.0
3655
5396
  */
3656
5397
  export declare const File: File;
3657
5398
  /**
5399
+ * Schema type for {@link FormData}.
5400
+ *
5401
+ * @category Schemas
3658
5402
  * @since 4.0.0
3659
5403
  */
3660
5404
  export interface FormData extends instanceOf<globalThis.FormData> {
3661
5405
  }
3662
5406
  /**
5407
+ * Schema for JavaScript `FormData` objects.
5408
+ *
5409
+ * The default JSON serializer encodes a `FormData` as an array of `[key, entry]`
5410
+ * pairs where each entry is tagged as `"String"` or `"File"`.
5411
+ *
5412
+ * @category Schemas
3663
5413
  * @since 4.0.0
3664
5414
  */
3665
5415
  export declare const FormData: FormData;
3666
5416
  /**
5417
+ * Schema type for {@link fromFormData}.
5418
+ *
5419
+ * @category Schemas
3667
5420
  * @since 4.0.0
3668
5421
  */
3669
5422
  export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
@@ -3753,15 +5506,26 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
3753
5506
  */
3754
5507
  export declare function fromFormData<S extends Top>(schema: S): fromFormData<S>;
3755
5508
  /**
5509
+ * Schema type for {@link URLSearchParams}.
5510
+ *
5511
+ * @category Schemas
3756
5512
  * @since 4.0.0
3757
5513
  */
3758
5514
  export interface URLSearchParams extends instanceOf<globalThis.URLSearchParams> {
3759
5515
  }
3760
5516
  /**
5517
+ * Schema for JavaScript `URLSearchParams` objects.
5518
+ *
5519
+ * The default JSON serializer encodes a `URLSearchParams` as a query string.
5520
+ *
5521
+ * @category Schemas
3761
5522
  * @since 4.0.0
3762
5523
  */
3763
5524
  export declare const URLSearchParams: URLSearchParams;
3764
5525
  /**
5526
+ * Schema type for {@link fromURLSearchParams}.
5527
+ *
5528
+ * @category Schemas
3765
5529
  * @since 4.0.0
3766
5530
  */
3767
5531
  export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearchParams> {
@@ -3842,6 +5606,9 @@ export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearc
3842
5606
  */
3843
5607
  export declare function fromURLSearchParams<S extends Top>(schema: S): fromURLSearchParams<S>;
3844
5608
  /**
5609
+ * Schema type for {@link Finite}.
5610
+ *
5611
+ * @category Schemas
3845
5612
  * @since 4.0.0
3846
5613
  */
3847
5614
  export interface Finite extends Number {
@@ -3853,6 +5620,9 @@ export interface Finite extends Number {
3853
5620
  */
3854
5621
  export declare const Finite: Finite;
3855
5622
  /**
5623
+ * Schema type for {@link Int}.
5624
+ *
5625
+ * @category Schemas
3856
5626
  * @since 4.0.0
3857
5627
  */
3858
5628
  export interface Int extends Number {
@@ -3864,6 +5634,9 @@ export interface Int extends Number {
3864
5634
  */
3865
5635
  export declare const Int: Int;
3866
5636
  /**
5637
+ * Schema type for {@link NumberFromString}.
5638
+ *
5639
+ * @category Schemas
3867
5640
  * @since 4.0.0
3868
5641
  */
3869
5642
  export interface NumberFromString extends decodeTo<Finite, String> {
@@ -3881,6 +5654,9 @@ export interface NumberFromString extends decodeTo<Finite, String> {
3881
5654
  */
3882
5655
  export declare const NumberFromString: NumberFromString;
3883
5656
  /**
5657
+ * Schema type for {@link FiniteFromString}.
5658
+ *
5659
+ * @category Schemas
3884
5660
  * @since 4.0.0
3885
5661
  */
3886
5662
  export interface FiniteFromString extends decodeTo<Finite, String> {
@@ -3899,6 +5675,9 @@ export interface FiniteFromString extends decodeTo<Finite, String> {
3899
5675
  */
3900
5676
  export declare const FiniteFromString: FiniteFromString;
3901
5677
  /**
5678
+ * Schema type for {@link Trimmed}.
5679
+ *
5680
+ * @category Schemas
3902
5681
  * @since 4.0.0
3903
5682
  */
3904
5683
  export interface Trimmed extends String {
@@ -3910,6 +5689,9 @@ export interface Trimmed extends String {
3910
5689
  */
3911
5690
  export declare const Trimmed: Trimmed;
3912
5691
  /**
5692
+ * Schema type for {@link Trim}.
5693
+ *
5694
+ * @category Schemas
3913
5695
  * @since 4.0.0
3914
5696
  */
3915
5697
  export interface Trim extends decodeTo<Trimmed, String> {
@@ -3927,6 +5709,9 @@ export interface Trim extends decodeTo<Trimmed, String> {
3927
5709
  */
3928
5710
  export declare const Trim: Trim;
3929
5711
  /**
5712
+ * A union schema for JavaScript property keys: `number | symbol | string`.
5713
+ *
5714
+ * @category Schemas
3930
5715
  * @since 4.0.0
3931
5716
  */
3932
5717
  export declare const PropertyKey: Union<readonly [Finite, Symbol, String]>;
@@ -3934,14 +5719,17 @@ export declare const PropertyKey: Union<readonly [Finite, Symbol, String]>;
3934
5719
  * @since 4.0.0
3935
5720
  */
3936
5721
  export declare const StandardSchemaV1FailureResult: Struct<{
3937
- readonly issues: Array$<Struct<{
5722
+ readonly issues: $Array<Struct<{
3938
5723
  readonly message: String;
3939
- readonly path: optional<Array$<Union<readonly [Union<readonly [Finite, Symbol, String]>, Struct<{
5724
+ readonly path: optional<$Array<Union<readonly [Union<readonly [Finite, Symbol, String]>, Struct<{
3940
5725
  readonly key: Union<readonly [Finite, Symbol, String]>;
3941
5726
  }>]>>>;
3942
5727
  }>>;
3943
5728
  }>;
3944
5729
  /**
5730
+ * Schema type for {@link BooleanFromBit}.
5731
+ *
5732
+ * @category Schemas
3945
5733
  * @since 4.0.0
3946
5734
  */
3947
5735
  export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0, 1]>> {
@@ -3954,6 +5742,9 @@ export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0,
3954
5742
  */
3955
5743
  export declare const BooleanFromBit: BooleanFromBit;
3956
5744
  /**
5745
+ * Schema type for {@link Uint8Array}.
5746
+ *
5747
+ * @category Schemas
3957
5748
  * @since 4.0.0
3958
5749
  */
3959
5750
  export interface Uint8Array extends instanceOf<globalThis.Uint8Array<ArrayBufferLike>> {
@@ -3970,6 +5761,9 @@ export interface Uint8Array extends instanceOf<globalThis.Uint8Array<ArrayBuffer
3970
5761
  */
3971
5762
  export declare const Uint8Array: Uint8Array;
3972
5763
  /**
5764
+ * Schema type for {@link Uint8ArrayFromBase64}.
5765
+ *
5766
+ * @category Schemas
3973
5767
  * @since 4.0.0
3974
5768
  */
3975
5769
  export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
@@ -3989,6 +5783,9 @@ export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
3989
5783
  */
3990
5784
  export declare const Uint8ArrayFromBase64: Uint8ArrayFromBase64;
3991
5785
  /**
5786
+ * Schema type for {@link Uint8ArrayFromBase64Url}.
5787
+ *
5788
+ * @category Schemas
3992
5789
  * @since 4.0.0
3993
5790
  */
3994
5791
  export interface Uint8ArrayFromBase64Url extends decodeTo<Uint8Array, String> {
@@ -4008,6 +5805,9 @@ export interface Uint8ArrayFromBase64Url extends decodeTo<Uint8Array, String> {
4008
5805
  */
4009
5806
  export declare const Uint8ArrayFromBase64Url: Uint8ArrayFromBase64Url;
4010
5807
  /**
5808
+ * Schema type for {@link Uint8ArrayFromHex}.
5809
+ *
5810
+ * @category Schemas
4011
5811
  * @since 4.0.0
4012
5812
  */
4013
5813
  export interface Uint8ArrayFromHex extends decodeTo<Uint8Array, String> {
@@ -4027,6 +5827,9 @@ export interface Uint8ArrayFromHex extends decodeTo<Uint8Array, String> {
4027
5827
  */
4028
5828
  export declare const Uint8ArrayFromHex: Uint8ArrayFromHex;
4029
5829
  /**
5830
+ * Schema type for {@link DateTimeUtc}.
5831
+ *
5832
+ * @category DateTime
4030
5833
  * @since 4.0.0
4031
5834
  */
4032
5835
  export interface DateTimeUtc extends declare<DateTime.Utc> {
@@ -4043,6 +5846,9 @@ export interface DateTimeUtc extends declare<DateTime.Utc> {
4043
5846
  */
4044
5847
  export declare const DateTimeUtc: DateTimeUtc;
4045
5848
  /**
5849
+ * Schema type for {@link DateTimeUtcFromDate}.
5850
+ *
5851
+ * @category DateTime
4046
5852
  * @since 4.0.0
4047
5853
  */
4048
5854
  export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
@@ -4061,6 +5867,9 @@ export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
4061
5867
  */
4062
5868
  export declare const DateTimeUtcFromDate: DateTimeUtcFromDate;
4063
5869
  /**
5870
+ * Schema type for {@link DateTimeUtcFromString}.
5871
+ *
5872
+ * @category DateTime
4064
5873
  * @since 4.0.0
4065
5874
  */
4066
5875
  export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
@@ -4081,6 +5890,9 @@ export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
4081
5890
  */
4082
5891
  export declare const DateTimeUtcFromString: DateTimeUtcFromString;
4083
5892
  /**
5893
+ * Schema type for {@link DateTimeUtcFromMillis}.
5894
+ *
5895
+ * @category DateTime
4084
5896
  * @since 4.0.0
4085
5897
  */
4086
5898
  export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>, Number> {
@@ -4099,12 +5911,98 @@ export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>
4099
5911
  */
4100
5912
  export declare const DateTimeUtcFromMillis: DateTimeUtcFromMillis;
4101
5913
  /**
5914
+ * Schema type for {@link TimeZoneOffset}.
5915
+ *
5916
+ * @category DateTime
5917
+ * @since 4.0.0
5918
+ */
5919
+ export interface TimeZoneOffset extends declare<DateTime.TimeZone.Offset> {
5920
+ }
5921
+ /**
5922
+ * A schema for `DateTime.TimeZone.Offset` values.
5923
+ *
5924
+ * **Default JSON serializer**
5925
+ *
5926
+ * - encodes `DateTime.TimeZone.Offset` as a number (offset in milliseconds)
5927
+ *
5928
+ * @category DateTime
5929
+ * @since 4.0.0
5930
+ */
5931
+ export declare const TimeZoneOffset: TimeZoneOffset;
5932
+ /**
5933
+ * Schema type for {@link TimeZoneNamed}.
5934
+ *
5935
+ * @category DateTime
5936
+ * @since 4.0.0
5937
+ */
5938
+ export interface TimeZoneNamed extends declare<DateTime.TimeZone.Named> {
5939
+ }
5940
+ /**
5941
+ * A schema for `DateTime.TimeZone.Named` values.
5942
+ *
5943
+ * **Default JSON serializer**
5944
+ *
5945
+ * - encodes `DateTime.TimeZone.Named` as a string (IANA time zone identifier)
5946
+ *
5947
+ * @category DateTime
5948
+ * @since 4.0.0
5949
+ */
5950
+ export declare const TimeZoneNamed: TimeZoneNamed;
5951
+ /**
5952
+ * Schema type for {@link TimeZone}.
5953
+ *
5954
+ * @category DateTime
5955
+ * @since 4.0.0
5956
+ */
5957
+ export interface TimeZone extends declare<DateTime.TimeZone> {
5958
+ }
5959
+ /**
5960
+ * A schema for `DateTime.TimeZone` values.
5961
+ *
5962
+ * **Default JSON serializer**
5963
+ *
5964
+ * - encodes `DateTime.TimeZone` as a string (IANA identifier or offset like
5965
+ * `+03:00`)
5966
+ *
5967
+ * @category DateTime
5968
+ * @since 4.0.0
5969
+ */
5970
+ export declare const TimeZone: TimeZone;
5971
+ /**
5972
+ * Schema type for {@link DateTimeZoned}.
5973
+ *
5974
+ * @category DateTime
5975
+ * @since 4.0.0
5976
+ */
5977
+ export interface DateTimeZoned extends declare<DateTime.Zoned> {
5978
+ }
5979
+ /**
5980
+ * A schema for `DateTime.Zoned` values.
5981
+ *
5982
+ * **Default JSON serializer**
5983
+ *
5984
+ * - encodes `DateTime.Zoned` as a string in the format
5985
+ * `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`
5986
+ *
5987
+ * @category DateTime
5988
+ * @since 4.0.0
5989
+ */
5990
+ export declare const DateTimeZoned: DateTimeZoned;
5991
+ /**
5992
+ * Interface for schema-backed classes created with {@link Class}.
5993
+ *
5994
+ * A `Class` is a TypeScript class whose constructor validates its input
5995
+ * against a {@link Struct} schema. Instances are always structurally valid.
5996
+ *
5997
+ * The interface exposes the schema's `fields`, an `identifier` string, and
5998
+ * helpers such as `mapFields`, `annotate`, `check`, and `extend`.
5999
+ *
4102
6000
  * @since 4.0.0
4103
6001
  */
4104
6002
  export interface Class<Self, S extends Top & {
4105
6003
  readonly fields: Struct.Fields;
4106
6004
  }, Inherited> extends Bottom<Self, S["Encoded"], S["DecodingServices"], S["EncodingServices"], AST.Declaration, decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>, 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"]> {
4107
- new (props: S["~type.make.in"], options?: MakeOptions): S["Type"] & Inherited;
6005
+ new (...args: {} extends S["~type.make.in"] ? [props?: S["~type.make.in"], options?: MakeOptions] : [props: S["~type.make.in"], options?: MakeOptions]): S["Type"] & Inherited;
4108
6006
  readonly identifier: string;
4109
6007
  readonly fields: S["fields"];
4110
6008
  /**
@@ -4127,6 +6025,10 @@ export interface Class<Self, S extends Top & {
4127
6025
  }
4128
6026
  type AddStaticMembers<C, Static> = C & Pick<Static, Exclude<keyof Static, keyof C>>;
4129
6027
  /**
6028
+ * A {@link Class} that additionally exposes an `extend` method, allowing
6029
+ * subclasses to be derived with extra fields while inheriting all parent
6030
+ * fields and validation.
6031
+ *
4130
6032
  * @since 4.0.0
4131
6033
  */
4132
6034
  export interface ExtendableClass<Self, S extends Top & {
@@ -4135,21 +6037,181 @@ export interface ExtendableClass<Self, S extends Top & {
4135
6037
  extend<Extended, Static = {}, Brand = {}>(identifier: string): <NewFields extends Struct.Fields>(fields: NewFields, annotations?: Annotations.Declaration<Extended, readonly [Struct<Simplify<Assign<S["fields"], NewFields>>>]>) => AddStaticMembers<ExtendableClass<Extended, Struct<Simplify<Assign<S["fields"], NewFields>>>, Self & Brand>, Static>;
4136
6038
  }
4137
6039
  /**
6040
+ * Creates a schema-backed class whose constructor validates input against a
6041
+ * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6042
+ * input (unless `disableValidation` is set in the options).
6043
+ *
6044
+ * Pass the desired class type as the first type parameter. The second optional
6045
+ * type parameter can be used to add nominal brands.
6046
+ *
6047
+ * **Example** (Basic class)
6048
+ *
6049
+ * ```ts
6050
+ * import { Schema } from "effect"
6051
+ *
6052
+ * class Person extends Schema.Class<Person>("Person")({
6053
+ * name: Schema.String,
6054
+ * age: Schema.Number
6055
+ * }) {}
6056
+ *
6057
+ * const alice = new Person({ name: "Alice", age: 30 })
6058
+ * console.log(alice.name) // "Alice"
6059
+ * console.log(`${alice}`) // "Person({ name: Alice, age: 30 })"
6060
+ * ```
6061
+ *
6062
+ * **Example** (Extending a class)
6063
+ *
6064
+ * ```ts
6065
+ * import { Schema } from "effect"
6066
+ *
6067
+ * class Animal extends Schema.Class<Animal>("Animal")({
6068
+ * name: Schema.String
6069
+ * }) {}
6070
+ *
6071
+ * class Dog extends Animal.extend<Dog>("Dog")({
6072
+ * breed: Schema.String
6073
+ * }) {}
6074
+ *
6075
+ * const dog = new Dog({ name: "Rex", breed: "Labrador" })
6076
+ * console.log(dog.name) // "Rex"
6077
+ * console.log(dog.breed) // "Labrador"
6078
+ * ```
6079
+ *
4138
6080
  * @category Constructors
4139
6081
  * @since 4.0.0
4140
6082
  */
4141
6083
  export declare const Class: {
4142
6084
  /**
6085
+ * Creates a schema-backed class whose constructor validates input against a
6086
+ * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6087
+ * input (unless `disableValidation` is set in the options).
6088
+ *
6089
+ * Pass the desired class type as the first type parameter. The second optional
6090
+ * type parameter can be used to add nominal brands.
6091
+ *
6092
+ * **Example** (Basic class)
6093
+ *
6094
+ * ```ts
6095
+ * import { Schema } from "effect"
6096
+ *
6097
+ * class Person extends Schema.Class<Person>("Person")({
6098
+ * name: Schema.String,
6099
+ * age: Schema.Number
6100
+ * }) {}
6101
+ *
6102
+ * const alice = new Person({ name: "Alice", age: 30 })
6103
+ * console.log(alice.name) // "Alice"
6104
+ * console.log(`${alice}`) // "Person({ name: Alice, age: 30 })"
6105
+ * ```
6106
+ *
6107
+ * **Example** (Extending a class)
6108
+ *
6109
+ * ```ts
6110
+ * import { Schema } from "effect"
6111
+ *
6112
+ * class Animal extends Schema.Class<Animal>("Animal")({
6113
+ * name: Schema.String
6114
+ * }) {}
6115
+ *
6116
+ * class Dog extends Animal.extend<Dog>("Dog")({
6117
+ * breed: Schema.String
6118
+ * }) {}
6119
+ *
6120
+ * const dog = new Dog({ name: "Rex", breed: "Labrador" })
6121
+ * console.log(dog.name) // "Rex"
6122
+ * console.log(dog.breed) // "Labrador"
6123
+ * ```
6124
+ *
4143
6125
  * @category Constructors
4144
6126
  * @since 4.0.0
4145
6127
  */
4146
6128
  <Self, Brand = {}>(identifier: string): {
4147
6129
  /**
6130
+ * Creates a schema-backed class whose constructor validates input against a
6131
+ * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6132
+ * input (unless `disableValidation` is set in the options).
6133
+ *
6134
+ * Pass the desired class type as the first type parameter. The second optional
6135
+ * type parameter can be used to add nominal brands.
6136
+ *
6137
+ * **Example** (Basic class)
6138
+ *
6139
+ * ```ts
6140
+ * import { Schema } from "effect"
6141
+ *
6142
+ * class Person extends Schema.Class<Person>("Person")({
6143
+ * name: Schema.String,
6144
+ * age: Schema.Number
6145
+ * }) {}
6146
+ *
6147
+ * const alice = new Person({ name: "Alice", age: 30 })
6148
+ * console.log(alice.name) // "Alice"
6149
+ * console.log(`${alice}`) // "Person({ name: Alice, age: 30 })"
6150
+ * ```
6151
+ *
6152
+ * **Example** (Extending a class)
6153
+ *
6154
+ * ```ts
6155
+ * import { Schema } from "effect"
6156
+ *
6157
+ * class Animal extends Schema.Class<Animal>("Animal")({
6158
+ * name: Schema.String
6159
+ * }) {}
6160
+ *
6161
+ * class Dog extends Animal.extend<Dog>("Dog")({
6162
+ * breed: Schema.String
6163
+ * }) {}
6164
+ *
6165
+ * const dog = new Dog({ name: "Rex", breed: "Labrador" })
6166
+ * console.log(dog.name) // "Rex"
6167
+ * console.log(dog.breed) // "Labrador"
6168
+ * ```
6169
+ *
4148
6170
  * @category Constructors
4149
6171
  * @since 4.0.0
4150
6172
  */
4151
6173
  <const Fields extends Struct.Fields>(fields: Fields, annotations?: Annotations.Declaration<Self, readonly [Struct<Fields>]>): ExtendableClass<Self, Struct<Fields>, Brand>;
4152
6174
  /**
6175
+ * Creates a schema-backed class whose constructor validates input against a
6176
+ * {@link Struct} schema. Construction throws a {@link SchemaError} on invalid
6177
+ * input (unless `disableValidation` is set in the options).
6178
+ *
6179
+ * Pass the desired class type as the first type parameter. The second optional
6180
+ * type parameter can be used to add nominal brands.
6181
+ *
6182
+ * **Example** (Basic class)
6183
+ *
6184
+ * ```ts
6185
+ * import { Schema } from "effect"
6186
+ *
6187
+ * class Person extends Schema.Class<Person>("Person")({
6188
+ * name: Schema.String,
6189
+ * age: Schema.Number
6190
+ * }) {}
6191
+ *
6192
+ * const alice = new Person({ name: "Alice", age: 30 })
6193
+ * console.log(alice.name) // "Alice"
6194
+ * console.log(`${alice}`) // "Person({ name: Alice, age: 30 })"
6195
+ * ```
6196
+ *
6197
+ * **Example** (Extending a class)
6198
+ *
6199
+ * ```ts
6200
+ * import { Schema } from "effect"
6201
+ *
6202
+ * class Animal extends Schema.Class<Animal>("Animal")({
6203
+ * name: Schema.String
6204
+ * }) {}
6205
+ *
6206
+ * class Dog extends Animal.extend<Dog>("Dog")({
6207
+ * breed: Schema.String
6208
+ * }) {}
6209
+ *
6210
+ * const dog = new Dog({ name: "Rex", breed: "Labrador" })
6211
+ * console.log(dog.name) // "Rex"
6212
+ * console.log(dog.breed) // "Labrador"
6213
+ * ```
6214
+ *
4153
6215
  * @category Constructors
4154
6216
  * @since 4.0.0
4155
6217
  */
@@ -4157,21 +6219,105 @@ export declare const Class: {
4157
6219
  };
4158
6220
  };
4159
6221
  /**
6222
+ * Like {@link Class} but automatically adds a `_tag` literal field set to the
6223
+ * given `tag` value. This makes instances compatible with tagged union
6224
+ * discrimination patterns.
6225
+ *
6226
+ * The optional `identifier` parameter overrides the schema identifier;
6227
+ * it defaults to the `tag` value.
6228
+ *
6229
+ * **Example** (Tagged class)
6230
+ *
6231
+ * ```ts
6232
+ * import { Schema } from "effect"
6233
+ *
6234
+ * class Circle extends Schema.TaggedClass<Circle>()("Circle", {
6235
+ * radius: Schema.Number
6236
+ * }) {}
6237
+ *
6238
+ * const c = new Circle({ radius: 5 })
6239
+ * console.log(c._tag) // "Circle"
6240
+ * console.log(c.radius) // 5
6241
+ * ```
6242
+ *
4160
6243
  * @category Constructors
4161
6244
  * @since 4.0.0
4162
6245
  */
4163
6246
  export declare const TaggedClass: {
4164
6247
  /**
6248
+ * Like {@link Class} but automatically adds a `_tag` literal field set to the
6249
+ * given `tag` value. This makes instances compatible with tagged union
6250
+ * discrimination patterns.
6251
+ *
6252
+ * The optional `identifier` parameter overrides the schema identifier;
6253
+ * it defaults to the `tag` value.
6254
+ *
6255
+ * **Example** (Tagged class)
6256
+ *
6257
+ * ```ts
6258
+ * import { Schema } from "effect"
6259
+ *
6260
+ * class Circle extends Schema.TaggedClass<Circle>()("Circle", {
6261
+ * radius: Schema.Number
6262
+ * }) {}
6263
+ *
6264
+ * const c = new Circle({ radius: 5 })
6265
+ * console.log(c._tag) // "Circle"
6266
+ * console.log(c.radius) // 5
6267
+ * ```
6268
+ *
4165
6269
  * @category Constructors
4166
6270
  * @since 4.0.0
4167
6271
  */
4168
6272
  <Self, Brand = {}>(identifier?: string): {
4169
6273
  /**
6274
+ * Like {@link Class} but automatically adds a `_tag` literal field set to the
6275
+ * given `tag` value. This makes instances compatible with tagged union
6276
+ * discrimination patterns.
6277
+ *
6278
+ * The optional `identifier` parameter overrides the schema identifier;
6279
+ * it defaults to the `tag` value.
6280
+ *
6281
+ * **Example** (Tagged class)
6282
+ *
6283
+ * ```ts
6284
+ * import { Schema } from "effect"
6285
+ *
6286
+ * class Circle extends Schema.TaggedClass<Circle>()("Circle", {
6287
+ * radius: Schema.Number
6288
+ * }) {}
6289
+ *
6290
+ * const c = new Circle({ radius: 5 })
6291
+ * console.log(c._tag) // "Circle"
6292
+ * console.log(c.radius) // 5
6293
+ * ```
6294
+ *
4170
6295
  * @category Constructors
4171
6296
  * @since 4.0.0
4172
6297
  */
4173
6298
  <Tag extends string, const Fields extends Struct.Fields>(tag: Tag, fields: Fields, annotations?: Annotations.Declaration<Self, readonly [TaggedStruct<Tag, Fields>]>): ExtendableClass<Self, TaggedStruct<Tag, Fields>, Brand>;
4174
6299
  /**
6300
+ * Like {@link Class} but automatically adds a `_tag` literal field set to the
6301
+ * given `tag` value. This makes instances compatible with tagged union
6302
+ * discrimination patterns.
6303
+ *
6304
+ * The optional `identifier` parameter overrides the schema identifier;
6305
+ * it defaults to the `tag` value.
6306
+ *
6307
+ * **Example** (Tagged class)
6308
+ *
6309
+ * ```ts
6310
+ * import { Schema } from "effect"
6311
+ *
6312
+ * class Circle extends Schema.TaggedClass<Circle>()("Circle", {
6313
+ * radius: Schema.Number
6314
+ * }) {}
6315
+ *
6316
+ * const c = new Circle({ radius: 5 })
6317
+ * console.log(c._tag) // "Circle"
6318
+ * console.log(c.radius) // 5
6319
+ * ```
6320
+ *
4175
6321
  * @category Constructors
4176
6322
  * @since 4.0.0
4177
6323
  */
@@ -4183,6 +6329,10 @@ export declare const TaggedClass: {
4183
6329
  };
4184
6330
  };
4185
6331
  /**
6332
+ * Interface for schema-backed error classes created with {@link ErrorClass}.
6333
+ * Extends {@link ExtendableClass} and is also a `YieldableError`, so instances
6334
+ * can be yielded inside `Effect.gen` as failures.
6335
+ *
4186
6336
  * @since 4.0.0
4187
6337
  */
4188
6338
  export interface ErrorClass<Self, S extends Top & {
@@ -4190,21 +6340,97 @@ export interface ErrorClass<Self, S extends Top & {
4190
6340
  }, Inherited> extends ExtendableClass<Self, S, Inherited> {
4191
6341
  }
4192
6342
  /**
6343
+ * Creates a schema-backed error class that can be used as a typed,
6344
+ * yieldable error in Effect programs. Combines {@link Class} validation with
6345
+ * the `YieldableError` interface so instances can be yielded directly inside
6346
+ * `Effect.gen`.
6347
+ *
6348
+ * **Example** (Schema-backed error)
6349
+ *
6350
+ * ```ts
6351
+ * import { Effect, Schema } from "effect"
6352
+ *
6353
+ * class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
6354
+ * id: Schema.Number
6355
+ * }) {}
6356
+ *
6357
+ * const program = Effect.gen(function*() {
6358
+ * yield* new NotFound({ id: 1 })
6359
+ * })
6360
+ * ```
6361
+ *
4193
6362
  * @category Constructors
4194
6363
  * @since 4.0.0
4195
6364
  */
4196
6365
  export declare const ErrorClass: {
4197
6366
  /**
6367
+ * Creates a schema-backed error class that can be used as a typed,
6368
+ * yieldable error in Effect programs. Combines {@link Class} validation with
6369
+ * the `YieldableError` interface so instances can be yielded directly inside
6370
+ * `Effect.gen`.
6371
+ *
6372
+ * **Example** (Schema-backed error)
6373
+ *
6374
+ * ```ts
6375
+ * import { Effect, Schema } from "effect"
6376
+ *
6377
+ * class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
6378
+ * id: Schema.Number
6379
+ * }) {}
6380
+ *
6381
+ * const program = Effect.gen(function*() {
6382
+ * yield* new NotFound({ id: 1 })
6383
+ * })
6384
+ * ```
6385
+ *
4198
6386
  * @category Constructors
4199
6387
  * @since 4.0.0
4200
6388
  */
4201
6389
  <Self, Brand = {}>(identifier: string): {
4202
6390
  /**
6391
+ * Creates a schema-backed error class that can be used as a typed,
6392
+ * yieldable error in Effect programs. Combines {@link Class} validation with
6393
+ * the `YieldableError` interface so instances can be yielded directly inside
6394
+ * `Effect.gen`.
6395
+ *
6396
+ * **Example** (Schema-backed error)
6397
+ *
6398
+ * ```ts
6399
+ * import { Effect, Schema } from "effect"
6400
+ *
6401
+ * class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
6402
+ * id: Schema.Number
6403
+ * }) {}
6404
+ *
6405
+ * const program = Effect.gen(function*() {
6406
+ * yield* new NotFound({ id: 1 })
6407
+ * })
6408
+ * ```
6409
+ *
4203
6410
  * @category Constructors
4204
6411
  * @since 4.0.0
4205
6412
  */
4206
6413
  <const Fields extends Struct.Fields>(fields: Fields, annotations?: Annotations.Declaration<Self, readonly [Struct<Fields>]>): ErrorClass<Self, Struct<Fields>, Cause_.YieldableError & Brand>;
4207
6414
  /**
6415
+ * Creates a schema-backed error class that can be used as a typed,
6416
+ * yieldable error in Effect programs. Combines {@link Class} validation with
6417
+ * the `YieldableError` interface so instances can be yielded directly inside
6418
+ * `Effect.gen`.
6419
+ *
6420
+ * **Example** (Schema-backed error)
6421
+ *
6422
+ * ```ts
6423
+ * import { Effect, Schema } from "effect"
6424
+ *
6425
+ * class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
6426
+ * id: Schema.Number
6427
+ * }) {}
6428
+ *
6429
+ * const program = Effect.gen(function*() {
6430
+ * yield* new NotFound({ id: 1 })
6431
+ * })
6432
+ * ```
6433
+ *
4208
6434
  * @category Constructors
4209
6435
  * @since 4.0.0
4210
6436
  */
@@ -4212,21 +6438,93 @@ export declare const ErrorClass: {
4212
6438
  };
4213
6439
  };
4214
6440
  /**
6441
+ * Like {@link ErrorClass} but automatically adds a `_tag` literal field. The
6442
+ * resulting class is both a schema-validated, yieldable error and a tagged
6443
+ * union member.
6444
+ *
6445
+ * **Example** (Tagged error class)
6446
+ *
6447
+ * ```ts
6448
+ * import { Effect, Schema } from "effect"
6449
+ *
6450
+ * class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
6451
+ * id: Schema.Number
6452
+ * }) {}
6453
+ *
6454
+ * const program = Effect.gen(function*() {
6455
+ * yield* new NotFound({ id: 42 })
6456
+ * })
6457
+ * ```
6458
+ *
4215
6459
  * @category Constructors
4216
6460
  * @since 4.0.0
4217
6461
  */
4218
6462
  export declare const TaggedErrorClass: {
4219
6463
  /**
6464
+ * Like {@link ErrorClass} but automatically adds a `_tag` literal field. The
6465
+ * resulting class is both a schema-validated, yieldable error and a tagged
6466
+ * union member.
6467
+ *
6468
+ * **Example** (Tagged error class)
6469
+ *
6470
+ * ```ts
6471
+ * import { Effect, Schema } from "effect"
6472
+ *
6473
+ * class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
6474
+ * id: Schema.Number
6475
+ * }) {}
6476
+ *
6477
+ * const program = Effect.gen(function*() {
6478
+ * yield* new NotFound({ id: 42 })
6479
+ * })
6480
+ * ```
6481
+ *
4220
6482
  * @category Constructors
4221
6483
  * @since 4.0.0
4222
6484
  */
4223
6485
  <Self, Brand = {}>(identifier?: string): {
4224
6486
  /**
6487
+ * Like {@link ErrorClass} but automatically adds a `_tag` literal field. The
6488
+ * resulting class is both a schema-validated, yieldable error and a tagged
6489
+ * union member.
6490
+ *
6491
+ * **Example** (Tagged error class)
6492
+ *
6493
+ * ```ts
6494
+ * import { Effect, Schema } from "effect"
6495
+ *
6496
+ * class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
6497
+ * id: Schema.Number
6498
+ * }) {}
6499
+ *
6500
+ * const program = Effect.gen(function*() {
6501
+ * yield* new NotFound({ id: 42 })
6502
+ * })
6503
+ * ```
6504
+ *
4225
6505
  * @category Constructors
4226
6506
  * @since 4.0.0
4227
6507
  */
4228
6508
  <Tag extends string, const Fields extends Struct.Fields>(tag: Tag, fields: Fields, annotations?: Annotations.Declaration<Self, readonly [TaggedStruct<Tag, Fields>]>): ErrorClass<Self, TaggedStruct<Tag, Fields>, Cause_.YieldableError & Brand>;
4229
6509
  /**
6510
+ * Like {@link ErrorClass} but automatically adds a `_tag` literal field. The
6511
+ * resulting class is both a schema-validated, yieldable error and a tagged
6512
+ * union member.
6513
+ *
6514
+ * **Example** (Tagged error class)
6515
+ *
6516
+ * ```ts
6517
+ * import { Effect, Schema } from "effect"
6518
+ *
6519
+ * class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
6520
+ * id: Schema.Number
6521
+ * }) {}
6522
+ *
6523
+ * const program = Effect.gen(function*() {
6524
+ * yield* new NotFound({ id: 42 })
6525
+ * })
6526
+ * ```
6527
+ *
4230
6528
  * @category Constructors
4231
6529
  * @since 4.0.0
4232
6530
  */
@@ -4238,16 +6536,43 @@ export declare const TaggedErrorClass: {
4238
6536
  };
4239
6537
  };
4240
6538
  /**
6539
+ * A thunk that, given the `fast-check` module, returns an `Arbitrary<T>`.
6540
+ * Use this type when you need to defer instantiation of the arbitrary, for
6541
+ * example to support recursive schemas.
6542
+ *
4241
6543
  * @category Arbitrary
4242
6544
  * @since 4.0.0
4243
6545
  */
4244
6546
  export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>;
4245
6547
  /**
6548
+ * Derives a {@link LazyArbitrary} from a schema. The result is memoized so
6549
+ * repeated calls with the same schema are cheap.
6550
+ *
6551
+ * Prefer {@link toArbitrary} when you just need the arbitrary directly.
6552
+ *
4246
6553
  * @category Arbitrary
4247
6554
  * @since 4.0.0
4248
6555
  */
4249
6556
  export declare function toArbitraryLazy<S extends Top>(schema: S): LazyArbitrary<S["Type"]>;
4250
6557
  /**
6558
+ * Derives a `fast-check` `Arbitrary` from a schema for property-based
6559
+ * testing. The derived arbitrary generates values that satisfy the schema.
6560
+ *
6561
+ * **Example** (Generating arbitrary values)
6562
+ *
6563
+ * ```ts
6564
+ * import { Schema } from "effect"
6565
+ * import * as FastCheck from "fast-check"
6566
+ *
6567
+ * const PersonArb = Schema.toArbitrary(
6568
+ * Schema.Struct({ name: Schema.String, age: Schema.Number })
6569
+ * )
6570
+ *
6571
+ * // Sample a random value
6572
+ * const sample = FastCheck.sample(PersonArb, 1)[0]
6573
+ * console.log(typeof sample.name) // "string"
6574
+ * ```
6575
+ *
4251
6576
  * @category Arbitrary
4252
6577
  * @since 4.0.0
4253
6578
  */
@@ -4263,6 +6588,13 @@ export declare function toArbitrary<S extends Top>(schema: S): FastCheck.Arbitra
4263
6588
  */
4264
6589
  export declare function overrideToFormatter<S extends Top>(toFormatter: () => Formatter<S["Type"]>): (self: S) => S["~rebuild.out"];
4265
6590
  /**
6591
+ * Derives a string formatter function from a schema. The formatter converts
6592
+ * a value to its human-readable string representation, recursing into structs,
6593
+ * arrays, and unions.
6594
+ *
6595
+ * The optional `onBefore` hook lets you intercept specific AST nodes before
6596
+ * the default formatting logic runs.
6597
+ *
4266
6598
  * @category Formatter
4267
6599
  * @since 4.0.0
4268
6600
  */
@@ -4270,26 +6602,46 @@ export declare function toFormatter<T>(schema: Schema<T>, options?: {
4270
6602
  readonly onBefore?: ((ast: AST.AST, recur: (ast: AST.AST) => Formatter<any>) => Formatter<any> | undefined) | undefined;
4271
6603
  }): Formatter<T>;
4272
6604
  /**
4273
- * **Technical Note**
4274
- *
4275
- * This annotation cannot be added to `Annotations.Bottom` because it would make
4276
- * the schema invariant.
6605
+ * Overrides the equivalence derivation for a schema by supplying a custom
6606
+ * `Equivalence`. Use this when the default structural equivalence derived by
6607
+ * {@link toEquivalence} is not appropriate for a type.
4277
6608
  *
4278
6609
  * @category Equivalence
4279
6610
  * @since 4.0.0
4280
6611
  */
4281
6612
  export declare function overrideToEquivalence<S extends Top>(toEquivalence: () => Equivalence.Equivalence<S["Type"]>): (self: S) => S["~rebuild.out"];
4282
6613
  /**
6614
+ * Derives an `Equivalence` from a schema. Two values are considered equal when
6615
+ * every field (and nested field) compares equal according to the schema
6616
+ * structure.
6617
+ *
6618
+ * **Example** (Struct equivalence)
6619
+ *
6620
+ * ```ts
6621
+ * import { Schema } from "effect"
6622
+ *
6623
+ * const eq = Schema.toEquivalence(Schema.Struct({ id: Schema.Number, name: Schema.String }))
6624
+ *
6625
+ * console.log(eq({ id: 1, name: "Alice" }, { id: 1, name: "Alice" })) // true
6626
+ * console.log(eq({ id: 1, name: "Alice" }, { id: 2, name: "Alice" })) // false
6627
+ * ```
6628
+ *
4283
6629
  * @category Equivalence
4284
6630
  * @since 4.0.0
4285
6631
  */
4286
6632
  export declare function toEquivalence<T>(schema: Schema<T>): Equivalence.Equivalence<T>;
4287
6633
  /**
6634
+ * Derives an intermediate `SchemaRepresentation.Document` from a schema. This
6635
+ * document is used internally by {@link toJsonSchemaDocument} and related
6636
+ * functions to produce JSON Schema output.
6637
+ *
4288
6638
  * @category Representation
4289
6639
  * @since 4.0.0
4290
6640
  */
4291
6641
  export declare function toRepresentation(schema: Top): SchemaRepresentation.Document;
4292
6642
  /**
6643
+ * Options for {@link toJsonSchemaDocument}.
6644
+ *
4293
6645
  * @since 4.0.0
4294
6646
  */
4295
6647
  export interface ToJsonSchemaOptions {
@@ -4319,22 +6671,31 @@ export interface ToJsonSchemaOptions {
4319
6671
  */
4320
6672
  export declare function toJsonSchemaDocument(schema: Top, options?: ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
4321
6673
  /**
4322
- * @category Serializer
6674
+ * Derives a canonical JSON codec from a schema. The encoded form is `unknown`
6675
+ * (any JSON-compatible value), decoded to the schema's `Type`.
6676
+ *
6677
+ * @category Canonical Codecs
4323
6678
  * @since 4.0.0
4324
6679
  */
4325
- export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, unknown, RD, RE>;
6680
+ export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, Json, RD, RE>;
4326
6681
  /**
4327
- * @category Serializer
6682
+ * Derives an isomorphism codec from a schema. The encoded form is the
6683
+ * schema's `Iso` type — the intermediate representation used for round-tripping.
6684
+ *
6685
+ * @category Canonical Codecs
4328
6686
  * @since 4.0.0
4329
6687
  */
4330
6688
  export declare function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S["Iso"]>;
4331
6689
  /**
4332
- * @category Serializer
6690
+ * A {@link Tree} of `string | undefined` nodes. Leaf values are either a
6691
+ * string representation or `undefined` for opaque/declaration types.
6692
+ *
6693
+ * @category Canonical Codecs
4333
6694
  * @since 4.0.0
4334
6695
  */
4335
6696
  export type StringTree = Tree<string | undefined>;
4336
6697
  /**
4337
- * The StringTree serializer converts **every leaf value to a string**, while
6698
+ * The StringTree canonical codec converts **every leaf value to a string**, while
4338
6699
  * preserving the original structure.
4339
6700
  *
4340
6701
  * Declarations are converted to `undefined` (unless they have a
@@ -4348,7 +6709,7 @@ export type StringTree = Tree<string | undefined>;
4348
6709
  *
4349
6710
  * Defaults to `false`.
4350
6711
  *
4351
- * @category Serializer
6712
+ * @category Canonical Codecs
4352
6713
  * @since 4.0.0
4353
6714
  */
4354
6715
  export declare function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>): Codec<T, StringTree, RD, RE>;
@@ -4368,26 +6729,40 @@ type XmlEncoderOptions = {
4368
6729
  readonly sortKeys?: boolean | undefined;
4369
6730
  };
4370
6731
  /**
4371
- * @category Serializer
6732
+ * Derives an XML encoder from a codec. Encodes a value to an XML string by
6733
+ * first converting it through {@link toCodecStringTree}, then serializing the
6734
+ * resulting tree to XML.
6735
+ *
6736
+ * @category Canonical Codecs
4372
6737
  * @since 4.0.0
4373
6738
  */
4374
6739
  export declare function toEncoderXml<T, E, RD, RE>(codec: Codec<T, E, RD, RE>, options?: XmlEncoderOptions): (t: T) => Effect.Effect<string, SchemaError, RE>;
4375
6740
  /**
6741
+ * Derives an `Iso` optic from a schema that isomorphically converts between
6742
+ * the schema's `Type` and its `Iso` (intermediate / serialized form).
6743
+ *
4376
6744
  * @category Optic
4377
6745
  * @since 4.0.0
4378
6746
  */
4379
6747
  export declare function toIso<S extends Top>(schema: S): Optic_.Iso<S["Type"], S["Iso"]>;
4380
6748
  /**
6749
+ * Returns an identity `Iso` over the schema's source (`Type`) side.
6750
+ *
4381
6751
  * @category Optic
4382
6752
  * @since 4.0.0
4383
6753
  */
4384
6754
  export declare function toIsoSource<S extends Top>(_: S): Optic_.Iso<S["Type"], S["Type"]>;
4385
6755
  /**
6756
+ * Returns an identity `Iso` over the schema's focus (`Iso`) side.
6757
+ *
4386
6758
  * @category Optic
4387
6759
  * @since 4.0.0
4388
6760
  */
4389
6761
  export declare function toIsoFocus<S extends Top>(_: S): Optic_.Iso<S["Iso"], S["Iso"]>;
4390
6762
  /**
6763
+ * The schema type returned by {@link overrideToCodecIso}. Carries a custom
6764
+ * `Iso` type parameter and exposes the original `schema`.
6765
+ *
4391
6766
  * @category Optic
4392
6767
  * @since 4.0.0
4393
6768
  */
@@ -4396,10 +6771,11 @@ export interface overrideToCodecIso<S extends Top, Iso> extends Bottom<S["Type"]
4396
6771
  readonly schema: S;
4397
6772
  }
4398
6773
  /**
4399
- * **Technical Note**
4400
- *
4401
- * This annotation cannot be added to `Annotations.Bottom` because it changes
4402
- * the schema type.
6774
+ * Overrides the ISO codec derivation for a schema by providing a target codec
6775
+ * and explicit `decode`/`encode` getters. The resulting schema carries a
6776
+ * custom `Iso` type, which changes the schema's type parameter — use
6777
+ * {@link overrideToCodecIso} when the default ISO transformation is not
6778
+ * appropriate.
4403
6779
  *
4404
6780
  * @category Optic
4405
6781
  * @since 4.0.0
@@ -4409,6 +6785,10 @@ export declare function overrideToCodecIso<S extends Top, Iso>(to: Codec<Iso>, t
4409
6785
  readonly encode: Getter.Getter<Iso, S["Type"]>;
4410
6786
  }): (schema: S) => overrideToCodecIso<S, Iso>;
4411
6787
  /**
6788
+ * Derives a JSON Patch differ from a codec. Serializes values to JSON (via
6789
+ * {@link toCodecJson}), computes RFC 6902 JSON Patch operations between old
6790
+ * and new values, and can apply patches back to the typed value.
6791
+ *
4412
6792
  * @category JsonPatch
4413
6793
  * @since 4.0.0
4414
6794
  */
@@ -4417,53 +6797,47 @@ export declare function toDifferJsonPatch<T, E>(schema: Codec<T, E>): Differ<T,
4417
6797
  * @category Tree
4418
6798
  * @since 4.0.0
4419
6799
  */
4420
- export type Tree<Node> = Node | TreeObject<Node> | ReadonlyArray<Tree<Node>>;
6800
+ export type Tree<Node> = Node | TreeRecord<Node> | ReadonlyArray<Tree<Node>>;
4421
6801
  /**
6802
+ * A record node in a {@link Tree}: an object mapping string keys to child
6803
+ * `Tree` nodes.
6804
+ *
4422
6805
  * @category Tree
4423
6806
  * @since 4.0.0
4424
6807
  */
4425
- export interface TreeObject<A> {
6808
+ export interface TreeRecord<A> {
4426
6809
  readonly [x: string]: Tree<A>;
4427
6810
  }
4428
6811
  /**
6812
+ * Creates a recursive schema for a {@link Tree} of values described by `node`.
6813
+ * The resulting schema accepts a single node value, an array of trees, or an
6814
+ * object whose values are trees.
6815
+ *
4429
6816
  * @category Tree
4430
6817
  * @since 4.0.0
4431
6818
  */
4432
- 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"]>>>]>;
4433
- /**
4434
- * @category Tree
4435
- * @since 4.0.0
4436
- */
4437
- export type MutableTree<A> = A | MutableTreeRecord<A> | Array<MutableTree<A>>;
4438
- /**
4439
- * @category Tree
4440
- * @since 4.0.0
4441
- */
4442
- export interface MutableTreeRecord<A> {
4443
- [x: string]: MutableTree<A>;
4444
- }
4445
- /**
4446
- * @category Tree
4447
- * @since 4.0.0
4448
- */
4449
- export declare function MutableTree<S extends Top>(node: S): Union<readonly [S, mutable<Array$<suspend<Codec<MutableTree<S["Type"]>, MutableTree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>>, Record$<String, mutableKey<suspend<Codec<MutableTree<S["Type"]>, MutableTree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>>]>;
6819
+ 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"]>>>]>;
4450
6820
  /**
6821
+ * Recursive TypeScript type for any valid immutable JSON value: `null`,
6822
+ * `number`, `boolean`, `string`, a readonly array of `Json` values, or a
6823
+ * readonly record of `string → Json`. For the corresponding schema, see the
6824
+ * {@link Json} const.
6825
+ *
4451
6826
  * @category JSON
4452
6827
  * @since 4.0.0
4453
6828
  */
4454
6829
  export type Json = null | number | boolean | string | JsonArray | JsonObject;
4455
6830
  /**
4456
- * @category JSON
4457
- * @since 4.0.0
4458
- */
4459
- export declare const Json: Codec<Json>;
4460
- /**
6831
+ * A readonly array of {@link Json} values.
6832
+ *
4461
6833
  * @category JSON
4462
6834
  * @since 4.0.0
4463
6835
  */
4464
6836
  export interface JsonArray extends ReadonlyArray<Json> {
4465
6837
  }
4466
6838
  /**
6839
+ * A readonly record whose values are {@link Json} values.
6840
+ *
4467
6841
  * @category JSON
4468
6842
  * @since 4.0.0
4469
6843
  */
@@ -4471,28 +6845,51 @@ export interface JsonObject {
4471
6845
  readonly [x: string]: Json;
4472
6846
  }
4473
6847
  /**
6848
+ * Schema that accepts and validates any immutable JSON-compatible value.
6849
+ *
6850
+ * **Example** (Validating a JSON value)
6851
+ *
6852
+ * ```ts
6853
+ * import { Schema } from "effect"
6854
+ *
6855
+ * const result = Schema.decodeUnknownOption(Schema.Json)({ key: [1, true, null] })
6856
+ * console.log(result._tag) // "Some"
6857
+ * ```
6858
+ *
4474
6859
  * @category JSON
4475
6860
  * @since 4.0.0
4476
6861
  */
4477
- export type MutableJson = null | number | boolean | string | MutableJsonArray | MutableJsonObject;
6862
+ export declare const Json: Codec<Json>;
4478
6863
  /**
4479
6864
  * @category JSON
4480
6865
  * @since 4.0.0
4481
6866
  */
4482
- export declare const MutableJson: Codec<MutableJson>;
6867
+ export type MutableJson = null | number | boolean | string | MutableJsonArray | MutableJsonObject;
4483
6868
  /**
6869
+ * A mutable array of {@link MutableJson} values.
6870
+ *
4484
6871
  * @category JSON
4485
6872
  * @since 4.0.0
4486
6873
  */
4487
6874
  export interface MutableJsonArray extends Array<MutableJson> {
4488
6875
  }
4489
6876
  /**
6877
+ * A mutable record whose values are {@link MutableJson} values.
6878
+ *
4490
6879
  * @category JSON
4491
6880
  * @since 4.0.0
4492
6881
  */
4493
6882
  export interface MutableJsonObject {
4494
6883
  [x: string]: MutableJson;
4495
6884
  }
6885
+ /**
6886
+ * Schema that accepts any mutable JSON-compatible value. See {@link Json} for
6887
+ * the immutable variant.
6888
+ *
6889
+ * @category JSON
6890
+ * @since 4.0.0
6891
+ */
6892
+ export declare const MutableJson: Codec<MutableJson>;
4496
6893
  /**
4497
6894
  * Return all the typed annotations from the schema.
4498
6895
  *
@@ -4501,6 +6898,13 @@ export interface MutableJsonObject {
4501
6898
  */
4502
6899
  export declare function resolveInto<S extends Top>(schema: S): S["~annotate.in"] | undefined;
4503
6900
  /**
6901
+ * The `Annotations` namespace groups all annotation interfaces used to attach
6902
+ * metadata to schemas. Annotations control documentation, validation messages,
6903
+ * JSON Schema generation, equivalence, arbitrary generation, and more.
6904
+ *
6905
+ * Use {@link resolveInto} to read the annotations attached to a schema at
6906
+ * runtime.
6907
+ *
4504
6908
  * @since 4.0.0
4505
6909
  */
4506
6910
  export declare namespace Annotations {
@@ -4549,6 +6953,9 @@ export declare namespace Annotations {
4549
6953
  readonly [x: string]: unknown;
4550
6954
  }
4551
6955
  /**
6956
+ * Annotations shared by all schema nodes. These map to common JSON Schema /
6957
+ * OpenAPI fields: `title`, `description`, `format`, etc.
6958
+ *
4552
6959
  * @since 4.0.0
4553
6960
  */
4554
6961
  interface Augment extends Annotations {
@@ -4563,6 +6970,8 @@ export declare namespace Annotations {
4563
6970
  readonly contentMediaType?: string | undefined;
4564
6971
  }
4565
6972
  /**
6973
+ * Extends {@link Augment} with type-parametric `default` and `examples` fields.
6974
+ *
4566
6975
  * @since 4.0.0
4567
6976
  */
4568
6977
  interface Documentation<T> extends Augment {
@@ -4570,6 +6979,10 @@ export declare namespace Annotations {
4570
6979
  readonly examples?: ReadonlyArray<T> | undefined;
4571
6980
  }
4572
6981
  /**
6982
+ * Annotations for struct property schemas. Extends {@link Documentation}
6983
+ * with an optional `messageMissingKey` to override the error message when
6984
+ * the property key is absent during decoding.
6985
+ *
4573
6986
  * @category Model
4574
6987
  * @since 4.0.0
4575
6988
  */
@@ -4580,6 +6993,11 @@ export declare namespace Annotations {
4580
6993
  readonly messageMissingKey?: string | undefined;
4581
6994
  }
4582
6995
  /**
6996
+ * Base annotations shared by all composite schema nodes. Extends
6997
+ * {@link Documentation} with error messages, branding, parse options, and
6998
+ * arbitrary generation hooks. {@link Declaration} and other annotation
6999
+ * interfaces build on top of this.
7000
+ *
4583
7001
  * @category Model
4584
7002
  * @since 4.0.0
4585
7003
  */
@@ -4622,6 +7040,12 @@ export declare namespace Annotations {
4622
7040
  };
4623
7041
  }
4624
7042
  /**
7043
+ * Full annotation set for `Declaration` schema nodes — used when defining
7044
+ * custom, opaque schema types via `Schema.declare`. Extends {@link Bottom}
7045
+ * with optional codec, arbitrary, equivalence, and formatter hooks so that
7046
+ * derived capabilities (JSON encoding, property testing, etc.) can be
7047
+ * provided for the custom type.
7048
+ *
4625
7049
  * @category Model
4626
7050
  * @since 4.0.0
4627
7051
  */
@@ -4643,10 +7067,9 @@ export declare namespace Annotations {
4643
7067
  } | undefined;
4644
7068
  }
4645
7069
  /**
4646
- * **Technical Note**
4647
- *
4648
- * This annotation group is not parametric since it would make the filters
4649
- * invariant
7070
+ * Annotations for filter schema nodes (created via `Schema.filter`). Extends
7071
+ * {@link Augment} with an optional error message, identifier, and metadata.
7072
+ * Filters are intentionally non-parametric to keep them covariant.
4650
7073
  *
4651
7074
  * @category Model
4652
7075
  * @since 4.0.0