Effect CommunityEC
Effect Community2y ago
10 replies
TheStockBroker

Revisiting Schema.extends for Nested Structures

I think we should revisit Schema.extends , we might want to support the following use case:
const A = Schema.struct({ key: Schema.struct({ a: Schema.string }) })
const B = Schema.struct({ key: Schema.struct({ b: Schema.boolean }) })
const C = Schema.extends(A, B) // <- should be allowed(?) since it's safe
//    ^ Schema<{ key: { a: string, b: boolean } }>

Other systems like zod, typebox, and arktype allow this, and type-wise we already resolve this
Was this page helpful?