This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
// import { trait } from "@thilawyn/traitify-ts"
|
||||
// import { ZodSchemaClassExtender } from "../builders/ZodSchemaClassExtender"
|
||||
// import { ZodSchemaClass } from "../shapes/ZodSchemaClass"
|
||||
import { expression } from "@thilawyn/traitify-ts"
|
||||
import { z } from "zod"
|
||||
import { ZodSchemaObject } from "./ZodSchemaObject"
|
||||
|
||||
|
||||
// export const ExtendableZodSchemaObject = trait
|
||||
// .implement(Super => class ExtendableZodSchemaObject extends Super {
|
||||
// static extend<
|
||||
// Self extends ZodSchemaClass<any, any, any, any, any, any, any, any, any>,
|
||||
// >(
|
||||
// this: Self
|
||||
// ) {
|
||||
// return new ZodSchemaClassExtender(this, this)
|
||||
// }
|
||||
// })
|
||||
// .build()
|
||||
export const ExtendableZodSchemaObject = <
|
||||
T extends z.ZodRawShape,
|
||||
Catchall extends z.ZodTypeAny,
|
||||
Values extends object,
|
||||
PartialValues extends Partial<Values>,
|
||||
>(
|
||||
schemaWithDefaults: z.ZodObject<T, "strip", Catchall, Values, PartialValues>,
|
||||
) => expression
|
||||
.expresses(ZodSchemaObject(schemaWithDefaults))
|
||||
.buildAnyway()
|
||||
.subtrait()
|
||||
.implement(Super => class ExtendableZodSchemaObject extends Super {
|
||||
})
|
||||
.build()
|
||||
|
||||
Reference in New Issue
Block a user