MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeStruct

Function makeStruct

packages/effect/src/Schema.ts:3554–3568  ·  view source on GitHub ↗
(ast: SchemaAST.Objects, fields: Fields)

Source from the content-addressed store, hash-verified

3552}
3553
3554function 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 *

Callers 2

mapFieldsFunction · 0.70
StructFunction · 0.70

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected