| 3552 | } |
| 3553 | |
| 3554 | function makeStruct<const Fields extends Struct.Fields>(ast: SchemaAST.Objects, fields: Fields): Struct<Fields> { |
| 3555 | return make(ast, { |
| 3556 | fields, |
| 3557 | mapFields<To extends Struct.Fields>( |
| 3558 | this: Struct<Fields>, |
| 3559 | f: (fields: Fields) => To, |
| 3560 | options?: { |
| 3561 | readonly unsafePreserveChecks?: boolean | undefined |
| 3562 | } | undefined |
| 3563 | ): Struct<To> { |
| 3564 | const fields = f(this.fields) |
| 3565 | return makeStruct(SchemaAST.struct(fields, options?.unsafePreserveChecks ? this.ast.checks : undefined), fields) |
| 3566 | } |
| 3567 | }) |
| 3568 | } |
| 3569 | /** |
| 3570 | * Defines a struct schema from a map of field schemas. |
| 3571 | * |