effect 4.0.0-beta.45 → 4.0.0-beta.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Schema.ts CHANGED
@@ -135,7 +135,7 @@ import * as Transformation from "./SchemaTransformation.ts"
135
135
  import type { Assign, Lambda, Mutable, Simplify } from "./Struct.ts"
136
136
  import * as Struct_ from "./Struct.ts"
137
137
  import * as FastCheck from "./testing/FastCheck.ts"
138
- import type { UnionToIntersection } from "./Types.ts"
138
+ import type { RequiredKeys, UnionToIntersection } from "./Types.ts"
139
139
  import type { Unify } from "./Unify.ts"
140
140
 
141
141
  const TypeId = InternalSchema.TypeId
@@ -215,7 +215,7 @@ export interface Bottom<
215
215
  out RD,
216
216
  out RE,
217
217
  out Ast extends AST.AST,
218
- out RebuildOut extends Top,
218
+ out Rebuild extends Top,
219
219
  out TypeMakeIn = T,
220
220
  out Iso = T,
221
221
  in out TypeParameters extends ReadonlyArray<Top> = readonly [],
@@ -228,8 +228,8 @@ export interface Bottom<
228
228
  > extends Pipeable.Pipeable {
229
229
  readonly [TypeId]: typeof TypeId
230
230
 
231
- readonly ast: Ast
232
- readonly "~rebuild.out": RebuildOut
231
+ readonly "ast": Ast
232
+ readonly "Rebuild": Rebuild
233
233
  readonly "~type.parameters": TypeParameters
234
234
 
235
235
  readonly "Type": T
@@ -247,10 +247,10 @@ export interface Bottom<
247
247
  readonly "~encoded.mutability": EncodedMutability
248
248
  readonly "~encoded.optionality": EncodedOptionality
249
249
 
250
- annotate(annotations: Annotations.Bottom<this["Type"], this["~type.parameters"]>): this["~rebuild.out"]
251
- annotateKey(annotations: Annotations.Key<this["Type"]>): this["~rebuild.out"]
252
- check(...checks: readonly [AST.Check<this["Type"]>, ...Array<AST.Check<this["Type"]>>]): this["~rebuild.out"]
253
- rebuild(ast: this["ast"]): this["~rebuild.out"]
250
+ annotate(annotations: Annotations.Bottom<this["Type"], this["~type.parameters"]>): this["Rebuild"]
251
+ annotateKey(annotations: Annotations.Key<this["Type"]>): this["Rebuild"]
252
+ check(...checks: readonly [AST.Check<this["Type"]>, ...Array<AST.Check<this["Type"]>>]): this["Rebuild"]
253
+ rebuild(ast: this["ast"]): this["Rebuild"]
254
254
  /**
255
255
  * @throws {Error} The issue is contained in the error cause.
256
256
  */
@@ -359,7 +359,7 @@ export function declareConstructor<T, E = T, Iso = T>() {
359
359
  * @since 4.0.0
360
360
  */
361
361
  export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [], Iso> {
362
- readonly "~rebuild.out": declare<T, Iso>
362
+ readonly "Rebuild": declare<T, Iso>
363
363
  }
364
364
 
365
365
  /**
@@ -424,7 +424,7 @@ export function declare<T, Iso = T>(
424
424
  * const bottom = Schema.revealBottom(schema)
425
425
  *
426
426
  * // `bottom` now exposes Type, Encoded, DecodingServices, EncodingServices,
427
- * // ast, ~rebuild.out, ~type.make.in, Iso, ~type.parameters, etc.
427
+ * // ast, Rebuild, ~type.make.in, Iso, ~type.parameters, etc.
428
428
  * type T = typeof bottom["Type"] // string
429
429
  * type E = typeof bottom["Encoded"] // string
430
430
  * ```
@@ -439,7 +439,7 @@ export function revealBottom<S extends Top>(
439
439
  S["DecodingServices"],
440
440
  S["EncodingServices"],
441
441
  S["ast"],
442
- S["~rebuild.out"],
442
+ S["Rebuild"],
443
443
  S["~type.make.in"],
444
444
  S["Iso"],
445
445
  S["~type.parameters"],
@@ -474,13 +474,45 @@ export function revealBottom<S extends Top>(
474
474
  * )
475
475
  * ```
476
476
  *
477
+ * @see {@link annotateEncoded} to annotate the encoded side instead.
478
+ *
477
479
  * @category Annotations
478
480
  * @since 4.0.0
479
481
  */
480
482
  export function annotate<S extends Top>(annotations: Annotations.Bottom<S["Type"], S["~type.parameters"]>) {
481
- return (self: S): S["~rebuild.out"] => {
482
- return self.annotate(annotations)
483
- }
483
+ return (self: S) => self.annotate(annotations)
484
+ }
485
+
486
+ /**
487
+ * Adds metadata annotations to the **encoded** side of a schema without
488
+ * changing its runtime behavior. This is the encoded-side counterpart of
489
+ * `annotate`, which targets the decoded (Type) side.
490
+ *
491
+ * Internally the schema is flipped so that `Encoded` becomes `Type`,
492
+ * annotated, and then flipped back.
493
+ *
494
+ * **Example** (Adding a title to the encoded representation)
495
+ *
496
+ * ```ts
497
+ * import { Schema } from "effect"
498
+ *
499
+ * const schema = Schema.NumberFromString.pipe(
500
+ * Schema.annotateEncoded({
501
+ * title: "my title"
502
+ * })
503
+ * )
504
+ *
505
+ * console.log(Schema.toEncoded(schema).ast.annotations?.title)
506
+ * // "my title"
507
+ * ```
508
+ *
509
+ * @see {@link annotate} to annotate the type side instead.
510
+ *
511
+ * @category Annotations
512
+ * @since 4.0.0
513
+ */
514
+ export function annotateEncoded<S extends Top>(annotations: Annotations.Bottom<S["Encoded"], readonly []>) {
515
+ return (self: S): S["Rebuild"] => flip(flip(self).annotate(annotations))
484
516
  }
485
517
 
486
518
  /**
@@ -512,7 +544,7 @@ export function annotate<S extends Top>(annotations: Annotations.Bottom<S["Type"
512
544
  * @since 4.0.0
513
545
  */
514
546
  export function annotateKey<S extends Top>(annotations: Annotations.Key<S["Type"]>) {
515
- return (self: S): S["~rebuild.out"] => {
547
+ return (self: S): S["Rebuild"] => {
516
548
  return self.rebuild(AST.annotateKey(self.ast, annotations))
517
549
  }
518
550
  }
@@ -605,7 +637,7 @@ export declare namespace Schema {
605
637
  */
606
638
  export interface Schema<out T> extends Top {
607
639
  readonly "Type": T
608
- readonly "~rebuild.out": Schema<T>
640
+ readonly "Rebuild": Schema<T>
609
641
  }
610
642
 
611
643
  /**
@@ -693,7 +725,7 @@ export interface Optic<out T, out Iso> extends Schema<T> {
693
725
  readonly "Iso": Iso
694
726
  readonly "DecodingServices": never
695
727
  readonly "EncodingServices": never
696
- readonly "~rebuild.out": Optic<T, Iso>
728
+ readonly "Rebuild": Optic<T, Iso>
697
729
  }
698
730
 
699
731
  /**
@@ -730,7 +762,7 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
730
762
  readonly "Encoded": E
731
763
  readonly "DecodingServices": RD
732
764
  readonly "EncodingServices": RE
733
- readonly "~rebuild.out": Codec<T, E, RD, RE>
765
+ readonly "Rebuild": Codec<T, E, RD, RE>
734
766
  }
735
767
 
736
768
  /**
@@ -754,7 +786,7 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
754
786
  * @since 4.0.0
755
787
  */
756
788
  export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, unknown> {
757
- readonly "~rebuild.out": Decoder<T, RD>
789
+ readonly "Rebuild": Decoder<T, RD>
758
790
  }
759
791
 
760
792
  /**
@@ -778,7 +810,7 @@ export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, un
778
810
  * @since 4.0.0
779
811
  */
780
812
  export interface Encoder<out E, out RE = never> extends Codec<unknown, E, unknown, RE> {
781
- readonly "~rebuild.out": Encoder<E, RE>
813
+ readonly "Rebuild": Encoder<E, RE>
782
814
  }
783
815
 
784
816
  /**
@@ -1541,7 +1573,7 @@ export const requiredKey = Struct_.lambda<requiredKeyLambda>((self) => self.sche
1541
1573
  * @since 4.0.0
1542
1574
  */
1543
1575
  export interface optional<S extends Top> extends optionalKey<UndefinedOr<S>> {
1544
- readonly "~rebuild.out": optional<S>
1576
+ readonly "Rebuild": optional<S>
1545
1577
  }
1546
1578
 
1547
1579
  interface optionalLambda extends Lambda {
@@ -1774,7 +1806,7 @@ function isFlip$(schema: Top): schema is flip<any> {
1774
1806
  *
1775
1807
  * @since 4.0.0
1776
1808
  */
1777
- export function flip<S extends Top>(schema: S): S extends flip<infer F> ? F["~rebuild.out"] : flip<S>
1809
+ export function flip<S extends Top>(schema: S): S extends flip<infer F> ? F["Rebuild"] : flip<S>
1778
1810
  export function flip<S extends Top>(schema: S): flip<S> {
1779
1811
  if (isFlip$(schema)) {
1780
1812
  return schema.schema.rebuild(AST.flip(schema.ast))
@@ -3272,7 +3304,7 @@ export const NonEmptyArray = Struct_.lambda<NonEmptyArrayLambda>((schema) =>
3272
3304
  * @since 4.0.0
3273
3305
  */
3274
3306
  export interface ArrayEnsure<S extends Top> extends decodeTo<$Array<toType<S>>, Union<readonly [S, $Array<S>]>> {
3275
- readonly "~rebuild.out": ArrayEnsure<S>
3307
+ readonly "Rebuild": ArrayEnsure<S>
3276
3308
  }
3277
3309
 
3278
3310
  /**
@@ -3305,7 +3337,7 @@ export function ArrayEnsure<S extends Top>(schema: S): ArrayEnsure<S> {
3305
3337
  * @since 4.0.0
3306
3338
  */
3307
3339
  export interface UniqueArray<S extends Top> extends $Array<S> {
3308
- readonly "~rebuild.out": UniqueArray<S>
3340
+ readonly "Rebuild": UniqueArray<S>
3309
3341
  }
3310
3342
 
3311
3343
  /**
@@ -3533,7 +3565,7 @@ export function Literals<const L extends ReadonlyArray<AST.LiteralValue>>(litera
3533
3565
  * @since 4.0.0
3534
3566
  */
3535
3567
  export interface NullOr<S extends Top> extends Union<readonly [S, Null]> {
3536
- readonly "~rebuild.out": NullOr<S>
3568
+ readonly "Rebuild": NullOr<S>
3537
3569
  }
3538
3570
 
3539
3571
  interface NullOrLambda extends Lambda {
@@ -3555,7 +3587,7 @@ export const NullOr = Struct_.lambda<NullOrLambda>((self) => Union([self, Null])
3555
3587
  * @since 4.0.0
3556
3588
  */
3557
3589
  export interface UndefinedOr<S extends Top> extends Union<readonly [S, Undefined]> {
3558
- readonly "~rebuild.out": UndefinedOr<S>
3590
+ readonly "Rebuild": UndefinedOr<S>
3559
3591
  }
3560
3592
 
3561
3593
  interface UndefinedOrLambda extends Lambda {
@@ -3576,7 +3608,7 @@ export const UndefinedOr = Struct_.lambda<UndefinedOrLambda>((self) => Union([se
3576
3608
  * @since 4.0.0
3577
3609
  */
3578
3610
  export interface NullishOr<S extends Top> extends Union<readonly [S, Null, Undefined]> {
3579
- readonly "~rebuild.out": NullishOr<S>
3611
+ readonly "Rebuild": NullishOr<S>
3580
3612
  }
3581
3613
 
3582
3614
  interface NullishOrLambda extends Lambda {
@@ -3659,7 +3691,7 @@ export function suspend<S extends Top>(f: () => S): suspend<S> {
3659
3691
  * @since 4.0.0
3660
3692
  */
3661
3693
  export function check<S extends Top>(...checks: readonly [AST.Check<S["Type"]>, ...Array<AST.Check<S["Type"]>>]) {
3662
- return (self: S): S["~rebuild.out"] => self.check(...checks)
3694
+ return (self: S): S["Rebuild"] => self.check(...checks)
3663
3695
  }
3664
3696
 
3665
3697
  /**
@@ -3744,7 +3776,7 @@ export interface brand<S extends Top, B> extends
3744
3776
  * @since 4.0.0
3745
3777
  */
3746
3778
  export function brand<B extends string>(identifier: B) {
3747
- return <S extends Top>(schema: S): brand<S["~rebuild.out"], B> =>
3779
+ return <S extends Top>(schema: S): brand<S["Rebuild"], B> =>
3748
3780
  make(AST.brand(schema.ast, identifier), { schema, identifier })
3749
3781
  }
3750
3782
 
@@ -3758,7 +3790,7 @@ export function brand<B extends string>(identifier: B) {
3758
3790
  export function fromBrand<A extends Brand.Brand<any>>(identifier: string, ctor: Brand.Constructor<A>) {
3759
3791
  return <S extends Top & { readonly "Type": Brand.Brand.Unbranded<A> }>(
3760
3792
  self: S
3761
- ): brand<S["~rebuild.out"], Brand.Brand.Keys<A>> => {
3793
+ ): brand<S["Rebuild"], Brand.Brand.Keys<A>> => {
3762
3794
  return (ctor.checks ? self.check(...ctor.checks) : self).pipe(brand(identifier))
3763
3795
  }
3764
3796
  }
@@ -3916,7 +3948,7 @@ export function middlewareEncoding<S extends Top, RE>(
3916
3948
  */
3917
3949
  export function catchDecoding<S extends Top>(
3918
3950
  f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, Issue.Issue>
3919
- ): (self: S) => S["~rebuild.out"] {
3951
+ ): (self: S) => S["Rebuild"] {
3920
3952
  return catchDecodingWithContext(f)
3921
3953
  }
3922
3954
 
@@ -3943,7 +3975,7 @@ export function catchDecodingWithContext<S extends Top, R = never>(
3943
3975
  */
3944
3976
  export function catchEncoding<S extends Top>(
3945
3977
  f: (issue: Issue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, Issue.Issue>
3946
- ): (self: S) => S["~rebuild.out"] {
3978
+ ): (self: S) => S["Rebuild"] {
3947
3979
  return catchEncodingWithContext(f)
3948
3980
  }
3949
3981
 
@@ -4270,13 +4302,14 @@ export function withConstructorDefault<S extends Top & WithoutConstructorDefault
4270
4302
  }
4271
4303
 
4272
4304
  /**
4273
- * The type produced by {@link withDecodingDefaultKey} a schema that decodes from an `optionalKey` encoded source.
4305
+ * The type produced by {@link withDecodingDefaultKey}: a schema whose `Encoded`
4306
+ * side is `optionalKey` and that fills in a default `Encoded` value during decoding.
4274
4307
  *
4275
4308
  * @see {@link withDecodingDefaultKey} for the constructor
4276
4309
  * @since 4.0.0
4277
4310
  */
4278
4311
  export interface withDecodingDefaultKey<S extends Top> extends decodeTo<S, optionalKey<toEncoded<S>>> {
4279
- readonly "~rebuild.out": withDecodingDefaultKey<S>
4312
+ readonly "Rebuild": withDecodingDefaultKey<S>
4280
4313
  }
4281
4314
 
4282
4315
  /**
@@ -4293,18 +4326,18 @@ export type DecodingDefaultOptions = {
4293
4326
  }
4294
4327
 
4295
4328
  /**
4296
- * **Options**
4329
+ * Makes a struct key optional on the `Encoded` side and provides a default
4330
+ * `Encoded` value when the key is missing during decoding.
4297
4331
  *
4298
- * - `encodingStrategy`: The strategy to use when encoding.
4299
- * - `passthrough`: (default) Pass the default value through to the output.
4300
- * - `omit`: Omit the value from the output.
4332
+ * The key uses `optionalKey` on the encoded side, so it may be absent from the
4333
+ * input object but **not** `undefined`. The default value is specified in terms
4334
+ * of the `Encoded` type (before any decoding transformations).
4301
4335
  *
4302
- * Provides a default value for a missing key during decoding.
4336
+ * **Options**
4303
4337
  *
4304
- * When the key is absent from the input, `defaultValue()` is called to supply a value.
4305
- * During encoding, the behavior is controlled by `options.encodingStrategy`:
4306
- * - `"passthrough"` (default): include the value in the output
4307
- * - `"omit"`: omit the key from the output
4338
+ * - `encodingStrategy`:
4339
+ * - `"passthrough"` (default): include the value in the encoded output.
4340
+ * - `"omit"`: omit the key from the encoded output.
4308
4341
  *
4309
4342
  * **Example** (Default for a missing struct key)
4310
4343
  *
@@ -4319,7 +4352,8 @@ export type DecodingDefaultOptions = {
4319
4352
  * // result: { name: "anonymous" }
4320
4353
  * ```
4321
4354
  *
4322
- * @see {@link withDecodingDefault} for the `optional` (value-level) variant
4355
+ * @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)
4356
+ * @see {@link withDecodingDefaultTypeKey} for the variant where the default is a `Type` value
4323
4357
  * @since 4.0.0
4324
4358
  */
4325
4359
  export function withDecodingDefaultKey<S extends Top>(
@@ -4336,31 +4370,74 @@ export function withDecodingDefaultKey<S extends Top>(
4336
4370
  }
4337
4371
 
4338
4372
  /**
4339
- * The type produced by {@link withDecodingDefault} a schema that decodes from an `optional` encoded source.
4373
+ * The type produced by {@link withDecodingDefaultTypeKey}: a schema whose
4374
+ * `Encoded` side is `optionalKey` and that fills in a default `Type` value
4375
+ * during decoding.
4340
4376
  *
4341
- * @see {@link withDecodingDefault} for the constructor
4377
+ * @see {@link withDecodingDefaultTypeKey} for the constructor
4342
4378
  * @since 4.0.0
4343
4379
  */
4344
- export interface withDecodingDefault<S extends Top> extends decodeTo<S, optional<toEncoded<S>>> {
4345
- readonly "~rebuild.out": withDecodingDefault<S>
4380
+ export interface withDecodingDefaultTypeKey<S extends Top>
4381
+ extends decodeTo<withDecodingDefaultKey<toType<S>>, optionalKey<S>>
4382
+ {
4383
+ readonly "Rebuild": withDecodingDefaultTypeKey<S>
4346
4384
  }
4347
4385
 
4348
4386
  /**
4387
+ * Makes a struct key optional on the `Encoded` side (`optionalKey`, so the
4388
+ * key may be absent but **not** `undefined`) and provides a default `Type`
4389
+ * value when the key is missing during decoding.
4390
+ *
4391
+ * Unlike {@link withDecodingDefaultKey}, the default value is specified in
4392
+ * terms of the `Type` (decoded) representation, so it does not need to go
4393
+ * through the decoding transformation.
4394
+ *
4349
4395
  * **Options**
4350
4396
  *
4351
- * - `encodingStrategy`: The strategy to use when encoding.
4352
- * - `passthrough`: (default) Pass the default value through to the output.
4353
- * - `omit`: Omit the value from the output.
4397
+ * - `encodingStrategy`:
4398
+ * - `"passthrough"` (default): include the value in the encoded output.
4399
+ * - `"omit"`: omit the key from the encoded output.
4400
+ *
4401
+ * @see {@link withDecodingDefaultKey} for the variant where the default is an `Encoded` value
4402
+ * @see {@link withDecodingDefaultType} for the value-level variant
4403
+ * @since 4.0.0
4404
+ */
4405
+ export function withDecodingDefaultTypeKey<S extends Top>(
4406
+ defaultValue: Effect.Effect<S["Type"]>,
4407
+ options?: DecodingDefaultOptions
4408
+ ) {
4409
+ return (self: S): withDecodingDefaultTypeKey<S> => {
4410
+ return toType(self).pipe(
4411
+ withDecodingDefaultKey<toType<S>>(defaultValue, options),
4412
+ encodeTo(optionalKey(self))
4413
+ )
4414
+ }
4415
+ }
4416
+
4417
+ /**
4418
+ * The type produced by {@link withDecodingDefault}: a schema whose `Encoded`
4419
+ * side is `optional` and that fills in a default `Encoded` value during decoding.
4420
+ *
4421
+ * @see {@link withDecodingDefault} for the constructor
4422
+ * @since 4.0.0
4423
+ */
4424
+ export interface withDecodingDefault<S extends Top> extends decodeTo<S, optional<toEncoded<S>>> {
4425
+ readonly "Rebuild": withDecodingDefault<S>
4426
+ }
4427
+
4428
+ /**
4429
+ * Wraps the `Encoded` side with `optional` (key absent **or** `undefined`)
4430
+ * and provides a default `Encoded` value when the field is missing or
4431
+ * `undefined` during decoding.
4354
4432
  *
4355
- * Provides a default value for an `optional` field during decoding.
4433
+ * The default value is specified in terms of the `Encoded` type (before any
4434
+ * decoding transformations).
4356
4435
  *
4357
- * Similar to {@link withDecodingDefaultKey} but works on `optional` (value-level optional)
4358
- * rather than `optionalKey` (key-level optional).
4436
+ * **Options**
4359
4437
  *
4360
- * When the value is `undefined` or absent, `defaultValue()` is called to supply a value.
4361
- * During encoding, the behavior is controlled by `options.encodingStrategy`:
4362
- * - `"passthrough"` (default): include the value in the output
4363
- * - `"omit"`: omit the value from the output
4438
+ * - `encodingStrategy`:
4439
+ * - `"passthrough"` (default): include the value in the encoded output.
4440
+ * - `"omit"`: omit the key from the encoded output.
4364
4441
  *
4365
4442
  * **Example** (Default for an optional field value)
4366
4443
  *
@@ -4375,7 +4452,8 @@ export interface withDecodingDefault<S extends Top> extends decodeTo<S, optional
4375
4452
  * // result: { name: "anonymous" }
4376
4453
  * ```
4377
4454
  *
4378
- * @see {@link withDecodingDefaultKey} for the key-level variant
4455
+ * @see {@link withDecodingDefaultKey} for the key-level variant (key absent only, not `undefined`)
4456
+ * @see {@link withDecodingDefaultType} for the variant where the default is a `Type` value
4379
4457
  * @since 4.0.0
4380
4458
  */
4381
4459
  export function withDecodingDefault<S extends Top>(
@@ -4391,6 +4469,49 @@ export function withDecodingDefault<S extends Top>(
4391
4469
  }
4392
4470
  }
4393
4471
 
4472
+ /**
4473
+ * The type produced by {@link withDecodingDefaultType}: a schema whose
4474
+ * `Encoded` side is `optional` and that fills in a default `Type` value during
4475
+ * decoding.
4476
+ *
4477
+ * @see {@link withDecodingDefaultType} for the constructor
4478
+ * @since 4.0.0
4479
+ */
4480
+ export interface withDecodingDefaultType<S extends Top> extends decodeTo<withDecodingDefault<toType<S>>, optional<S>> {
4481
+ readonly "Rebuild": withDecodingDefaultType<S>
4482
+ }
4483
+
4484
+ /**
4485
+ * Wraps the `Encoded` side with `optional` (key absent **or** `undefined`)
4486
+ * and provides a default `Type` value when the field is missing or
4487
+ * `undefined` during decoding.
4488
+ *
4489
+ * Unlike {@link withDecodingDefault}, the default value is specified in terms
4490
+ * of the `Type` (decoded) representation, so it does not need to go through
4491
+ * the decoding transformation.
4492
+ *
4493
+ * **Options**
4494
+ *
4495
+ * - `encodingStrategy`:
4496
+ * - `"passthrough"` (default): include the value in the encoded output.
4497
+ * - `"omit"`: omit the key from the encoded output.
4498
+ *
4499
+ * @see {@link withDecodingDefault} for the variant where the default is an `Encoded` value
4500
+ * @see {@link withDecodingDefaultTypeKey} for the key-level variant
4501
+ * @since 4.0.0
4502
+ */
4503
+ export function withDecodingDefaultType<S extends Top>(
4504
+ defaultValue: Effect.Effect<S["Type"]>,
4505
+ options?: DecodingDefaultOptions
4506
+ ) {
4507
+ return (self: S): withDecodingDefaultType<S> => {
4508
+ return toType(self).pipe(
4509
+ withDecodingDefault<toType<S>>(defaultValue, options),
4510
+ encodeTo(optional(self))
4511
+ )
4512
+ }
4513
+ }
4514
+
4394
4515
  /**
4395
4516
  * The type produced by {@link tag} — a literal schema with a constructor default.
4396
4517
  *
@@ -4723,7 +4844,7 @@ export interface Opaque<Self, S extends Top, Brand> extends
4723
4844
  S["DecodingServices"],
4724
4845
  S["EncodingServices"],
4725
4846
  S["ast"],
4726
- S["~rebuild.out"],
4847
+ S["Rebuild"],
4727
4848
  S["~type.make.in"],
4728
4849
  S["Iso"],
4729
4850
  S["~type.parameters"],
@@ -4776,7 +4897,7 @@ export function Opaque<Self, Brand = {}>() {
4776
4897
  * @since 4.0.0
4777
4898
  */
4778
4899
  export interface instanceOf<T, Iso = T> extends declare<T, Iso> {
4779
- readonly "~rebuild.out": instanceOf<T, Iso>
4900
+ readonly "Rebuild": instanceOf<T, Iso>
4780
4901
  }
4781
4902
 
4782
4903
  /**
@@ -6758,7 +6879,7 @@ export function isUnique<T>(annotations?: Annotations.Filter) {
6758
6879
  * @since 4.0.0
6759
6880
  */
6760
6881
  export interface NonEmptyString extends String {
6761
- readonly "~rebuild.out": NonEmptyString
6882
+ readonly "Rebuild": NonEmptyString
6762
6883
  }
6763
6884
 
6764
6885
  /**
@@ -6777,7 +6898,7 @@ export const NonEmptyString: NonEmptyString = String.check(isNonEmpty())
6777
6898
  * @since 4.0.0
6778
6899
  */
6779
6900
  export interface Char extends String {
6780
- readonly "~rebuild.out": Char
6901
+ readonly "Rebuild": Char
6781
6902
  }
6782
6903
 
6783
6904
  /**
@@ -6817,7 +6938,7 @@ export interface Option<A extends Top> extends
6817
6938
  OptionIso<A>
6818
6939
  >
6819
6940
  {
6820
- readonly "~rebuild.out": Option<A>
6941
+ readonly "Rebuild": Option<A>
6821
6942
  readonly value: A
6822
6943
  }
6823
6944
 
@@ -6903,7 +7024,7 @@ export function Option<A extends Top>(value: A): Option<A> {
6903
7024
  * @since 4.0.0
6904
7025
  */
6905
7026
  export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<S>>, NullOr<S>> {
6906
- readonly "~rebuild.out": OptionFromNullOr<S>
7027
+ readonly "Rebuild": OptionFromNullOr<S>
6907
7028
  }
6908
7029
 
6909
7030
  /**
@@ -6934,7 +7055,7 @@ export function OptionFromNullOr<S extends Top>(schema: S): OptionFromNullOr<S>
6934
7055
  * @since 4.0.0
6935
7056
  */
6936
7057
  export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
6937
- readonly "~rebuild.out": OptionFromUndefinedOr<S>
7058
+ readonly "Rebuild": OptionFromUndefinedOr<S>
6938
7059
  }
6939
7060
 
6940
7061
  /**
@@ -6965,7 +7086,7 @@ export function OptionFromUndefinedOr<S extends Top>(schema: S): OptionFromUndef
6965
7086
  * @since 4.0.0
6966
7087
  */
6967
7088
  export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
6968
- readonly "~rebuild.out": OptionFromNullishOr<S>
7089
+ readonly "Rebuild": OptionFromNullishOr<S>
6969
7090
  }
6970
7091
 
6971
7092
  /**
@@ -7001,7 +7122,7 @@ export function OptionFromNullishOr<S extends Top>(
7001
7122
  * @since 4.0.0
7002
7123
  */
7003
7124
  export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
7004
- readonly "~rebuild.out": OptionFromOptionalKey<S>
7125
+ readonly "Rebuild": OptionFromOptionalKey<S>
7005
7126
  }
7006
7127
 
7007
7128
  /**
@@ -7032,7 +7153,7 @@ export function OptionFromOptionalKey<S extends Top>(schema: S): OptionFromOptio
7032
7153
  * @since 4.0.0
7033
7154
  */
7034
7155
  export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toType<S>>, optional<S>> {
7035
- readonly "~rebuild.out": OptionFromOptional<S>
7156
+ readonly "Rebuild": OptionFromOptional<S>
7036
7157
  }
7037
7158
 
7038
7159
  /**
@@ -7065,7 +7186,7 @@ export function OptionFromOptional<S extends Top>(schema: S): OptionFromOptional
7065
7186
  * @since 4.0.0
7066
7187
  */
7067
7188
  export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option<toType<S>>, optional<NullOr<S>>> {
7068
- readonly "~rebuild.out": OptionFromOptionalNullOr<S>
7189
+ readonly "Rebuild": OptionFromOptionalNullOr<S>
7069
7190
  }
7070
7191
 
7071
7192
  /**
@@ -7123,7 +7244,7 @@ export interface Result<A extends Top, E extends Top> extends
7123
7244
  ResultIso<A, E>
7124
7245
  >
7125
7246
  {
7126
- readonly "~rebuild.out": Result<A, E>
7247
+ readonly "Rebuild": Result<A, E>
7127
7248
  readonly success: A
7128
7249
  readonly failure: E
7129
7250
  }
@@ -7226,7 +7347,7 @@ export interface Redacted<S extends Top> extends
7226
7347
  readonly [S]
7227
7348
  >
7228
7349
  {
7229
- readonly "~rebuild.out": Redacted<S>
7350
+ readonly "Rebuild": Redacted<S>
7230
7351
  readonly value: S
7231
7352
  }
7232
7353
 
@@ -7326,7 +7447,7 @@ export function Redacted<S extends Top>(value: S, options?: {
7326
7447
  export interface RedactedFromValue<S extends Top>
7327
7448
  extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>>
7328
7449
  {
7329
- readonly "~rebuild.out": RedactedFromValue<S>
7450
+ readonly "Rebuild": RedactedFromValue<S>
7330
7451
  }
7331
7452
 
7332
7453
  /**
@@ -7378,7 +7499,7 @@ export interface CauseReason<E extends Top, D extends Top> extends
7378
7499
  CauseReasonIso<E, D>
7379
7500
  >
7380
7501
  {
7381
- readonly "~rebuild.out": CauseReason<E, D>
7502
+ readonly "Rebuild": CauseReason<E, D>
7382
7503
  readonly error: E
7383
7504
  readonly defect: D
7384
7505
  }
@@ -7526,7 +7647,7 @@ export interface Cause<E extends Top, D extends Top> extends
7526
7647
  CauseIso<E, D>
7527
7648
  >
7528
7649
  {
7529
- readonly "~rebuild.out": Cause<E, D>
7650
+ readonly "Rebuild": Cause<E, D>
7530
7651
  readonly error: E
7531
7652
  readonly defect: D
7532
7653
  }
@@ -7607,7 +7728,7 @@ function causeToFormatter<E>(error: Formatter<E>, defect: Formatter<unknown>) {
7607
7728
  * @since 4.0.0
7608
7729
  */
7609
7730
  export interface Error extends instanceOf<globalThis.Error> {
7610
- readonly "~rebuild.out": Error
7731
+ readonly "Rebuild": Error
7611
7732
  }
7612
7733
 
7613
7734
  const ErrorJsonEncoded = Struct({
@@ -7687,7 +7808,7 @@ export interface Defect extends
7687
7808
  ]
7688
7809
  >
7689
7810
  {
7690
- readonly "~rebuild.out": Defect
7811
+ readonly "Rebuild": Defect
7691
7812
  }
7692
7813
 
7693
7814
  const defectTransformation = new Transformation.Transformation(
@@ -7756,7 +7877,7 @@ export interface Exit<A extends Top, E extends Top, D extends Top> extends
7756
7877
  ExitIso<A, E, D>
7757
7878
  >
7758
7879
  {
7759
- readonly "~rebuild.out": Exit<A, E, D>
7880
+ readonly "Rebuild": Exit<A, E, D>
7760
7881
  readonly value: A
7761
7882
  readonly error: E
7762
7883
  readonly defect: D
@@ -7888,7 +8009,7 @@ export interface $ReadonlyMap<Key extends Top, Value extends Top> extends
7888
8009
  ReadonlyMapIso<Key, Value>
7889
8010
  >
7890
8011
  {
7891
- readonly "~rebuild.out": $ReadonlyMap<Key, Value>
8012
+ readonly "Rebuild": $ReadonlyMap<Key, Value>
7892
8013
  readonly key: Key
7893
8014
  readonly value: Value
7894
8015
  }
@@ -7982,7 +8103,7 @@ export interface HashMap<Key extends Top, Value extends Top> extends
7982
8103
  HashMapIso<Key, Value>
7983
8104
  >
7984
8105
  {
7985
- readonly "~rebuild.out": HashMap<Key, Value>
8106
+ readonly "Rebuild": HashMap<Key, Value>
7986
8107
  readonly key: Key
7987
8108
  readonly value: Value
7988
8109
  }
@@ -8076,7 +8197,7 @@ export interface $ReadonlySet<Value extends Top> extends
8076
8197
  ReadonlySetIso<Value>
8077
8198
  >
8078
8199
  {
8079
- readonly "~rebuild.out": $ReadonlySet<Value>
8200
+ readonly "Rebuild": $ReadonlySet<Value>
8080
8201
  readonly value: Value
8081
8202
  }
8082
8203
 
@@ -8166,7 +8287,7 @@ export interface HashSet<Value extends Top> extends
8166
8287
  HashSetIso<Value>
8167
8288
  >
8168
8289
  {
8169
- readonly "~rebuild.out": HashSet<Value>
8290
+ readonly "Rebuild": HashSet<Value>
8170
8291
  readonly value: Value
8171
8292
  }
8172
8293
 
@@ -8259,7 +8380,7 @@ export interface Chunk<Value extends Top> extends
8259
8380
  ChunkIso<Value>
8260
8381
  >
8261
8382
  {
8262
- readonly "~rebuild.out": Chunk<Value>
8383
+ readonly "Rebuild": Chunk<Value>
8263
8384
  readonly value: Value
8264
8385
  }
8265
8386
 
@@ -8344,7 +8465,7 @@ export function Chunk<Value extends Top>(value: Value): Chunk<Value> {
8344
8465
  * @since 4.0.0
8345
8466
  */
8346
8467
  export interface RegExp extends instanceOf<globalThis.RegExp> {
8347
- readonly "~rebuild.out": RegExp
8468
+ readonly "Rebuild": RegExp
8348
8469
  }
8349
8470
 
8350
8471
  /**
@@ -8418,7 +8539,7 @@ export const RegExp: RegExp = instanceOf(
8418
8539
  * @since 4.0.0
8419
8540
  */
8420
8541
  export interface URL extends instanceOf<globalThis.URL> {
8421
- readonly "~rebuild.out": URL
8542
+ readonly "Rebuild": URL
8422
8543
  }
8423
8544
 
8424
8545
  const URLString = String.annotate({ expected: "a string that will be decoded as a URL" })
@@ -8461,7 +8582,7 @@ export const URL: URL = instanceOf(
8461
8582
  * @since 4.0.0
8462
8583
  */
8463
8584
  export interface URLFromString extends decodeTo<URL, String> {
8464
- readonly "~rebuild.out": URLFromString
8585
+ readonly "Rebuild": URLFromString
8465
8586
  }
8466
8587
 
8467
8588
  /**
@@ -8485,7 +8606,7 @@ export const URLFromString: URLFromString = URLString.pipe(decodeTo(URL, Transfo
8485
8606
  * @since 4.0.0
8486
8607
  */
8487
8608
  export interface Date extends instanceOf<globalThis.Date> {
8488
- readonly "~rebuild.out": Date
8609
+ readonly "Rebuild": Date
8489
8610
  }
8490
8611
 
8491
8612
  const DateString = String.annotate({ expected: "a string in ISO 8601 format that will be decoded as a Date" })
@@ -8536,7 +8657,7 @@ export const Date: Date = instanceOf(
8536
8657
  * @since 4.0.0
8537
8658
  */
8538
8659
  export interface DateFromString extends decodeTo<Date, String> {
8539
- readonly "~rebuild.out": DateFromString
8660
+ readonly "Rebuild": DateFromString
8540
8661
  }
8541
8662
 
8542
8663
  /**
@@ -8560,7 +8681,7 @@ export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, Tra
8560
8681
  * @since 4.0.0
8561
8682
  */
8562
8683
  export interface DateValid extends Date {
8563
- readonly "~rebuild.out": DateValid
8684
+ readonly "Rebuild": DateValid
8564
8685
  }
8565
8686
 
8566
8687
  /**
@@ -8581,7 +8702,7 @@ export const DateValid: DateValid = Date.check(isDateValid())
8581
8702
  * @since 4.0.0
8582
8703
  */
8583
8704
  export interface Duration extends declare<Duration_.Duration> {
8584
- readonly "~rebuild.out": Duration
8705
+ readonly "Rebuild": Duration
8585
8706
  }
8586
8707
 
8587
8708
  /**
@@ -8670,7 +8791,7 @@ export const Duration: Duration = declare(
8670
8791
  * @since 4.0.0
8671
8792
  */
8672
8793
  export interface DurationFromNanos extends decodeTo<Duration, BigInt> {
8673
- readonly "~rebuild.out": DurationFromNanos
8794
+ readonly "Rebuild": DurationFromNanos
8674
8795
  }
8675
8796
 
8676
8797
  /**
@@ -8697,7 +8818,7 @@ export const DurationFromNanos: DurationFromNanos = BigInt.check(isGreaterThanOr
8697
8818
  * @since 4.0.0
8698
8819
  */
8699
8820
  export interface DurationFromMillis extends decodeTo<Duration, Number> {
8700
- readonly "~rebuild.out": DurationFromMillis
8821
+ readonly "Rebuild": DurationFromMillis
8701
8822
  }
8702
8823
 
8703
8824
  /**
@@ -8727,7 +8848,7 @@ export const DurationFromMillis: DurationFromMillis = Number.check(isGreaterThan
8727
8848
  * @since 4.0.0
8728
8849
  */
8729
8850
  export interface BigDecimal extends declare<BigDecimal_.BigDecimal> {
8730
- readonly "~rebuild.out": BigDecimal
8851
+ readonly "Rebuild": BigDecimal
8731
8852
  }
8732
8853
 
8733
8854
  const BigDecimalString = String.annotate({ expected: "a string that will be decoded as a BigDecimal" })
@@ -8774,7 +8895,7 @@ export const BigDecimal: BigDecimal = declare(
8774
8895
  * @since 4.0.0
8775
8896
  */
8776
8897
  export interface BigDecimalFromString extends decodeTo<BigDecimal, String> {
8777
- readonly "~rebuild.out": BigDecimalFromString
8898
+ readonly "Rebuild": BigDecimalFromString
8778
8899
  }
8779
8900
 
8780
8901
  /**
@@ -8800,7 +8921,7 @@ export const BigDecimalFromString: BigDecimalFromString = BigDecimalString.pipe(
8800
8921
  * @since 4.0.0
8801
8922
  */
8802
8923
  export interface UnknownFromJsonString extends fromJsonString<Unknown> {
8803
- readonly "~rebuild.out": UnknownFromJsonString
8924
+ readonly "Rebuild": UnknownFromJsonString
8804
8925
  }
8805
8926
 
8806
8927
  /**
@@ -8835,7 +8956,7 @@ export const UnknownFromJsonString: UnknownFromJsonString = fromJsonString(Unkno
8835
8956
  * @since 4.0.0
8836
8957
  */
8837
8958
  export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
8838
- readonly "~rebuild.out": fromJsonString<S>
8959
+ readonly "Rebuild": fromJsonString<S>
8839
8960
  }
8840
8961
 
8841
8962
  /**
@@ -8917,7 +9038,7 @@ export function fromJsonString<S extends Top>(schema: S): fromJsonString<S> {
8917
9038
  * @since 4.0.0
8918
9039
  */
8919
9040
  export interface File extends instanceOf<globalThis.File> {
8920
- readonly "~rebuild.out": File
9041
+ readonly "Rebuild": File
8921
9042
  }
8922
9043
 
8923
9044
  /**
@@ -8989,7 +9110,7 @@ export const File: File = instanceOf(globalThis.File, {
8989
9110
  * @since 4.0.0
8990
9111
  */
8991
9112
  export interface FormData extends instanceOf<globalThis.FormData> {
8992
- readonly "~rebuild.out": FormData
9113
+ readonly "Rebuild": FormData
8993
9114
  }
8994
9115
 
8995
9116
  /**
@@ -9051,7 +9172,7 @@ export const FormData: FormData = instanceOf(globalThis.FormData, {
9051
9172
  * @since 4.0.0
9052
9173
  */
9053
9174
  export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
9054
- readonly "~rebuild.out": fromFormData<S>
9175
+ readonly "Rebuild": fromFormData<S>
9055
9176
  }
9056
9177
 
9057
9178
  /**
@@ -9148,7 +9269,7 @@ export function fromFormData<S extends Top>(schema: S): fromFormData<S> {
9148
9269
  * @since 4.0.0
9149
9270
  */
9150
9271
  export interface URLSearchParams extends instanceOf<globalThis.URLSearchParams> {
9151
- readonly "~rebuild.out": URLSearchParams
9272
+ readonly "Rebuild": URLSearchParams
9152
9273
  }
9153
9274
 
9154
9275
  /**
@@ -9185,7 +9306,7 @@ export const URLSearchParams: URLSearchParams = instanceOf(globalThis.URLSearchP
9185
9306
  * @since 4.0.0
9186
9307
  */
9187
9308
  export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearchParams> {
9188
- readonly "~rebuild.out": fromURLSearchParams<S>
9309
+ readonly "Rebuild": fromURLSearchParams<S>
9189
9310
  }
9190
9311
 
9191
9312
  /**
@@ -9273,7 +9394,7 @@ export function fromURLSearchParams<S extends Top>(schema: S): fromURLSearchPara
9273
9394
  * @since 4.0.0
9274
9395
  */
9275
9396
  export interface Finite extends Number {
9276
- readonly "~rebuild.out": Finite
9397
+ readonly "Rebuild": Finite
9277
9398
  }
9278
9399
 
9279
9400
  /**
@@ -9291,7 +9412,7 @@ export const Finite: Finite = Number.check(isFinite())
9291
9412
  * @since 4.0.0
9292
9413
  */
9293
9414
  export interface Int extends Number {
9294
- readonly "~rebuild.out": Int
9415
+ readonly "Rebuild": Int
9295
9416
  }
9296
9417
 
9297
9418
  /**
@@ -9309,7 +9430,7 @@ export const Int: Int = Number.check(isInt())
9309
9430
  * @since 4.0.0
9310
9431
  */
9311
9432
  export interface NumberFromString extends decodeTo<Finite, String> {
9312
- readonly "~rebuild.out": NumberFromString
9433
+ readonly "Rebuild": NumberFromString
9313
9434
  }
9314
9435
 
9315
9436
  /**
@@ -9335,7 +9456,7 @@ export const NumberFromString: NumberFromString = String.annotate({
9335
9456
  * @since 4.0.0
9336
9457
  */
9337
9458
  export interface FiniteFromString extends decodeTo<Finite, String> {
9338
- readonly "~rebuild.out": FiniteFromString
9459
+ readonly "Rebuild": FiniteFromString
9339
9460
  }
9340
9461
 
9341
9462
  /**
@@ -9362,7 +9483,7 @@ export const FiniteFromString: FiniteFromString = String.annotate({
9362
9483
  * @since 4.0.0
9363
9484
  */
9364
9485
  export interface BigIntFromString extends decodeTo<BigInt, String> {
9365
- readonly "~rebuild.out": BigIntFromString
9486
+ readonly "Rebuild": BigIntFromString
9366
9487
  }
9367
9488
 
9368
9489
  /**
@@ -9388,7 +9509,7 @@ export const BigIntFromString: BigIntFromString = make<String>(AST.bigIntString)
9388
9509
  * @since 4.0.0
9389
9510
  */
9390
9511
  export interface Trimmed extends String {
9391
- readonly "~rebuild.out": Trimmed
9512
+ readonly "Rebuild": Trimmed
9392
9513
  }
9393
9514
 
9394
9515
  /**
@@ -9406,7 +9527,7 @@ export const Trimmed: Trimmed = String.check(isTrimmed())
9406
9527
  * @since 4.0.0
9407
9528
  */
9408
9529
  export interface Trim extends decodeTo<Trimmed, String> {
9409
- readonly "~rebuild.out": Trim
9530
+ readonly "Rebuild": Trim
9410
9531
  }
9411
9532
 
9412
9533
  /**
@@ -9432,7 +9553,7 @@ export const Trim: Trim = String.annotate({
9432
9553
  * @since 4.0.0
9433
9554
  */
9434
9555
  export interface StringFromBase64 extends decodeTo<String, String> {
9435
- readonly "~rebuild.out": StringFromBase64
9556
+ readonly "Rebuild": StringFromBase64
9436
9557
  }
9437
9558
 
9438
9559
  /**
@@ -9460,7 +9581,7 @@ export const StringFromBase64: StringFromBase64 = String.annotate({
9460
9581
  * @since 4.0.0
9461
9582
  */
9462
9583
  export interface StringFromBase64Url extends decodeTo<String, String> {
9463
- readonly "~rebuild.out": StringFromBase64Url
9584
+ readonly "Rebuild": StringFromBase64Url
9464
9585
  }
9465
9586
 
9466
9587
  /**
@@ -9488,7 +9609,7 @@ export const StringFromBase64Url: StringFromBase64Url = String.annotate({
9488
9609
  * @since 4.0.0
9489
9610
  */
9490
9611
  export interface StringFromHex extends decodeTo<String, String> {
9491
- readonly "~rebuild.out": StringFromHex
9612
+ readonly "Rebuild": StringFromHex
9492
9613
  }
9493
9614
 
9494
9615
  /**
@@ -9516,7 +9637,7 @@ export const StringFromHex: StringFromHex = String.annotate({
9516
9637
  * @since 4.0.0
9517
9638
  */
9518
9639
  export interface StringFromUriComponent extends decodeTo<String, String> {
9519
- readonly "~rebuild.out": StringFromUriComponent
9640
+ readonly "Rebuild": StringFromUriComponent
9520
9641
  }
9521
9642
 
9522
9643
  /**
@@ -9582,7 +9703,7 @@ export const StandardSchemaV1FailureResult = Struct({
9582
9703
  * @since 4.0.0
9583
9704
  */
9584
9705
  export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0, 1]>> {
9585
- readonly "~rebuild.out": BooleanFromBit
9706
+ readonly "Rebuild": BooleanFromBit
9586
9707
  }
9587
9708
 
9588
9709
  /**
@@ -9608,7 +9729,7 @@ export const BooleanFromBit: BooleanFromBit = Literals([0, 1]).pipe(
9608
9729
  * @since 4.0.0
9609
9730
  */
9610
9731
  export interface Uint8Array extends instanceOf<globalThis.Uint8Array<ArrayBufferLike>> {
9611
- readonly "~rebuild.out": Uint8Array
9732
+ readonly "Rebuild": Uint8Array
9612
9733
  }
9613
9734
 
9614
9735
  const Base64String = String.annotate({
@@ -9651,7 +9772,7 @@ export const Uint8Array: Uint8Array = instanceOf(globalThis.Uint8Array<ArrayBuff
9651
9772
  * @since 4.0.0
9652
9773
  */
9653
9774
  export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
9654
- readonly "~rebuild.out": Uint8ArrayFromBase64
9775
+ readonly "Rebuild": Uint8ArrayFromBase64
9655
9776
  }
9656
9777
 
9657
9778
  /**
@@ -9678,7 +9799,7 @@ export const Uint8ArrayFromBase64: Uint8ArrayFromBase64 = Base64String.pipe(
9678
9799
  * @since 4.0.0
9679
9800
  */
9680
9801
  export interface Uint8ArrayFromBase64Url extends decodeTo<Uint8Array, String> {
9681
- readonly "~rebuild.out": Uint8ArrayFromBase64Url
9802
+ readonly "Rebuild": Uint8ArrayFromBase64Url
9682
9803
  }
9683
9804
 
9684
9805
  /**
@@ -9710,7 +9831,7 @@ export const Uint8ArrayFromBase64Url: Uint8ArrayFromBase64Url = String.annotate(
9710
9831
  * @since 4.0.0
9711
9832
  */
9712
9833
  export interface Uint8ArrayFromHex extends decodeTo<Uint8Array, String> {
9713
- readonly "~rebuild.out": Uint8ArrayFromHex
9834
+ readonly "Rebuild": Uint8ArrayFromHex
9714
9835
  }
9715
9836
 
9716
9837
  /**
@@ -9742,7 +9863,7 @@ export const Uint8ArrayFromHex: Uint8ArrayFromHex = String.annotate({
9742
9863
  * @since 4.0.0
9743
9864
  */
9744
9865
  export interface DateTimeUtc extends declare<DateTime.Utc> {
9745
- readonly "~rebuild.out": DateTimeUtc
9866
+ readonly "Rebuild": DateTimeUtc
9746
9867
  }
9747
9868
 
9748
9869
  /**
@@ -9786,7 +9907,7 @@ export const DateTimeUtc: DateTimeUtc = declare(
9786
9907
  * @since 4.0.0
9787
9908
  */
9788
9909
  export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
9789
- readonly "~rebuild.out": DateTimeUtcFromDate
9910
+ readonly "Rebuild": DateTimeUtcFromDate
9790
9911
  }
9791
9912
 
9792
9913
  /**
@@ -9815,7 +9936,7 @@ export const DateTimeUtcFromDate: DateTimeUtcFromDate = DateValid.pipe(
9815
9936
  * @since 4.0.0
9816
9937
  */
9817
9938
  export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
9818
- readonly "~rebuild.out": DateTimeUtcFromString
9939
+ readonly "Rebuild": DateTimeUtcFromString
9819
9940
  }
9820
9941
 
9821
9942
  /**
@@ -9848,7 +9969,7 @@ export const DateTimeUtcFromString: DateTimeUtcFromString = String.annotate({
9848
9969
  * @since 4.0.0
9849
9970
  */
9850
9971
  export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>, Number> {
9851
- readonly "~rebuild.out": DateTimeUtcFromMillis
9972
+ readonly "Rebuild": DateTimeUtcFromMillis
9852
9973
  }
9853
9974
 
9854
9975
  /**
@@ -9877,7 +9998,7 @@ export const DateTimeUtcFromMillis: DateTimeUtcFromMillis = Number.pipe(
9877
9998
  * @since 4.0.0
9878
9999
  */
9879
10000
  export interface TimeZoneOffset extends declare<DateTime.TimeZone.Offset> {
9880
- readonly "~rebuild.out": TimeZoneOffset
10001
+ readonly "Rebuild": TimeZoneOffset
9881
10002
  }
9882
10003
 
9883
10004
  /**
@@ -9921,7 +10042,7 @@ export const TimeZoneOffset: TimeZoneOffset = declare(
9921
10042
  * @since 4.0.0
9922
10043
  */
9923
10044
  export interface TimeZoneNamed extends declare<DateTime.TimeZone.Named> {
9924
- readonly "~rebuild.out": TimeZoneNamed
10045
+ readonly "Rebuild": TimeZoneNamed
9925
10046
  }
9926
10047
 
9927
10048
  const TimeZoneNamedString = String.annotate({ expected: "an IANA time zone identifier" })
@@ -9971,7 +10092,7 @@ export const TimeZoneNamed: TimeZoneNamed = declare(
9971
10092
  * @since 4.0.0
9972
10093
  */
9973
10094
  export interface TimeZoneNamedFromString extends decodeTo<TimeZoneNamed, String> {
9974
- readonly "~rebuild.out": TimeZoneNamedFromString
10095
+ readonly "Rebuild": TimeZoneNamedFromString
9975
10096
  }
9976
10097
 
9977
10098
  /**
@@ -9997,7 +10118,7 @@ export const TimeZoneNamedFromString: TimeZoneNamedFromString = TimeZoneNamedStr
9997
10118
  * @since 4.0.0
9998
10119
  */
9999
10120
  export interface TimeZone extends declare<DateTime.TimeZone> {
10000
- readonly "~rebuild.out": TimeZone
10121
+ readonly "Rebuild": TimeZone
10001
10122
  }
10002
10123
 
10003
10124
  const TimeZoneString = String.annotate({
@@ -10053,7 +10174,7 @@ export const TimeZone: TimeZone = declare(
10053
10174
  * @since 4.0.0
10054
10175
  */
10055
10176
  export interface TimeZoneFromString extends decodeTo<TimeZone, String> {
10056
- readonly "~rebuild.out": TimeZoneFromString
10177
+ readonly "Rebuild": TimeZoneFromString
10057
10178
  }
10058
10179
 
10059
10180
  /**
@@ -10079,7 +10200,7 @@ export const TimeZoneFromString: TimeZoneFromString = TimeZoneString.pipe(
10079
10200
  * @since 4.0.0
10080
10201
  */
10081
10202
  export interface DateTimeZoned extends declare<DateTime.Zoned> {
10082
- readonly "~rebuild.out": DateTimeZoned
10203
+ readonly "Rebuild": DateTimeZoned
10083
10204
  }
10084
10205
 
10085
10206
  const DateTimeZonedString = String.annotate({
@@ -10136,7 +10257,7 @@ export const DateTimeZoned: DateTimeZoned = declare(
10136
10257
  * @since 4.0.0
10137
10258
  */
10138
10259
  export interface DateTimeZonedFromString extends decodeTo<DateTimeZoned, String> {
10139
- readonly "~rebuild.out": DateTimeZonedFromString
10260
+ readonly "Rebuild": DateTimeZonedFromString
10140
10261
  }
10141
10262
 
10142
10263
  /**
@@ -10178,7 +10299,7 @@ export interface Class<Self, S extends Top & { readonly fields: Struct.Fields },
10178
10299
  S["EncodingServices"],
10179
10300
  AST.Declaration,
10180
10301
  decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>,
10181
- S["~type.make.in"],
10302
+ RequiredKeys<S["~type.make.in"]> extends never ? void | S["~type.make.in"] : S["~type.make.in"],
10182
10303
  S["Iso"],
10183
10304
  readonly [S],
10184
10305
  Self,
@@ -10195,6 +10316,7 @@ export interface Class<Self, S extends Top & { readonly fields: Struct.Fields },
10195
10316
  ): S["Type"] & Inherited
10196
10317
  readonly identifier: string
10197
10318
  readonly fields: S["fields"]
10319
+
10198
10320
  /**
10199
10321
  * Returns a new struct with the fields modified by the provided function.
10200
10322
  *
@@ -10249,9 +10371,9 @@ function makeClass<
10249
10371
 
10250
10372
  const out = class extends Inherited {
10251
10373
  constructor(...[input, options]: ReadonlyArray<any>) {
10252
- const props = input ?? {}
10253
- const validated = struct.make(props, options)
10254
- super({ ...props, ...validated }, { ...options, disableChecks: true })
10374
+ input = input ?? {}
10375
+ const validated = struct.make(input, options)
10376
+ super({ ...input, ...validated }, { ...options, disableChecks: true })
10255
10377
  }
10256
10378
 
10257
10379
  static readonly [TypeId] = TypeId
@@ -10262,24 +10384,6 @@ function makeClass<
10262
10384
 
10263
10385
  static readonly [immerable] = true
10264
10386
 
10265
- declare static readonly "~rebuild.out": decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>
10266
- declare static readonly "~type.parameters": readonly [S]
10267
-
10268
- declare static readonly "Type": Self
10269
- declare static readonly "Encoded": S["Encoded"]
10270
- declare static readonly "DecodingServices": S["DecodingServices"]
10271
- declare static readonly "EncodingServices": S["EncodingServices"]
10272
-
10273
- declare static readonly "~type.make.in": S["~type.make.in"]
10274
- declare static readonly "~type.make": Self
10275
- declare static readonly "~type.constructor.default": S["~type.constructor.default"]
10276
- declare static readonly "Iso": S["Iso"]
10277
-
10278
- declare static readonly "~type.mutability": S["~type.mutability"]
10279
- declare static readonly "~type.optionality": S["~type.optionality"]
10280
- declare static readonly "~encoded.mutability": S["~encoded.mutability"]
10281
- declare static readonly "~encoded.optionality": S["~encoded.optionality"]
10282
-
10283
10387
  static readonly identifier = identifier
10284
10388
  static readonly fields = struct.fields
10285
10389
 
@@ -10295,15 +10399,15 @@ function makeClass<
10295
10399
  static make(input: S["~type.make.in"], options?: MakeOptions): Self {
10296
10400
  return new this(input, options)
10297
10401
  }
10402
+ static makeOption(input: S["~type.make.in"], options?: MakeOptions): Option_.Option<Self> {
10403
+ return Parser.makeOption(getClassSchema(this) as any)(input ?? {}, options) as any
10404
+ }
10298
10405
  static makeEffect(input: S["~type.make.in"], options?: MakeOptions): Effect.Effect<Self, SchemaError> {
10299
10406
  return Effect.mapErrorEager(
10300
- Parser.makeEffect(getClassSchema(this) as any)(input, options),
10407
+ Parser.makeEffect(getClassSchema(this) as any)(input ?? {}, options),
10301
10408
  (issue) => new SchemaError(issue)
10302
10409
  ) as any
10303
10410
  }
10304
- static makeOption(input: S["~type.make.in"], options?: MakeOptions): Option_.Option<Self> {
10305
- return Parser.makeOption(getClassSchema(this) as any)(input, options) as any
10306
- }
10307
10411
  static annotate(annotations: Annotations.Declaration<Self, readonly [S]>) {
10308
10412
  return this.rebuild(AST.annotate(this.ast, annotations))
10309
10413
  }
@@ -10740,17 +10844,6 @@ export const TaggedClass: {
10740
10844
  }
10741
10845
  }
10742
10846
 
10743
- /**
10744
- * Interface for schema-backed error classes created with {@link ErrorClass}.
10745
- * Extends {@link Class} and is also a `YieldableError`, so instances
10746
- * can be yielded inside `Effect.gen` as failures.
10747
- *
10748
- * @since 4.0.0
10749
- */
10750
- export interface ErrorClass<Self, S extends Top & { readonly fields: Struct.Fields }, Inherited>
10751
- extends Class<Self, S, Inherited>
10752
- {}
10753
-
10754
10847
  /**
10755
10848
  * Creates a schema-backed error class that can be used as a typed,
10756
10849
  * yieldable error in Effect programs. Combines {@link Class} validation with
@@ -11063,7 +11156,7 @@ export function toArbitrary<S extends Top>(schema: S): FastCheck.Arbitrary<S["Ty
11063
11156
  * @since 4.0.0
11064
11157
  */
11065
11158
  export function overrideToFormatter<S extends Top>(toFormatter: () => Formatter<S["Type"]>) {
11066
- return (self: S): S["~rebuild.out"] => {
11159
+ return (self: S): S["Rebuild"] => {
11067
11160
  return self.annotate({ toFormatter })
11068
11161
  }
11069
11162
  }
@@ -11228,7 +11321,7 @@ export function toFormatter<T>(schema: Schema<T>, options?: {
11228
11321
  * @since 4.0.0
11229
11322
  */
11230
11323
  export function overrideToEquivalence<S extends Top>(toEquivalence: () => Equivalence.Equivalence<S["Type"]>) {
11231
- return (self: S): S["~rebuild.out"] => self.annotate({ toEquivalence })
11324
+ return (self: S): S["Rebuild"] => self.annotate({ toEquivalence })
11232
11325
  }
11233
11326
 
11234
11327
  /**