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

Method extend

packages/effect/src/Schema.ts:14129–14147  ·  view source on GitHub ↗
(
      identifier: string
    )

Source from the content-addressed store, hash-verified

14127 return this.rebuild(SchemaAST.appendChecks(this.ast, checks))
14128 }
14129 static extend(
14130 identifier: string
14131 ) {
14132 return (
14133 schema: Struct.Fields | Struct<Struct.Fields>,
14134 annotations?: Annotations.Declaration<any, readonly [any]>
14135 ) => {
14136 const extension = isStruct(schema) ? schema : Struct(schema)
14137 const fields = { ...struct.fields, ...extension.fields }
14138 const ast = SchemaAST.struct(fields, struct.ast.checks, { identifier })
14139 return makeClass(
14140 this,
14141 identifier,
14142 makeStruct(SchemaAST.appendChecks(ast, extension.ast.checks), fields),
14143 annotations,
14144 proto
14145 )
14146 }
14147 }
14148 static mapFields<To extends Struct.Fields>(
14149 f: (fields: S["fields"]) => To,
14150 options?: {

Callers

nothing calls this directly

Calls 4

makeClassFunction · 0.85
makeStructFunction · 0.85
isStructFunction · 0.70
StructFunction · 0.70

Tested by

no test coverage detected