0.1.3 #4
@@ -31,6 +31,6 @@ export function ZodSchemaClass<
|
|||||||
}
|
}
|
||||||
|
|
||||||
return expression
|
return expression
|
||||||
.extends(ZodSchemaObjectConstructor as AbstractClass<Values, [values: Values]>)
|
.extends(ZodSchemaObjectConstructor)
|
||||||
.expresses(ZodSchemaObject(schema, schemaWithDefaultValues))
|
.expresses(ZodSchemaObject(schema, schemaWithDefaultValues))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ImplStatic, trait } from "@thilawyn/traitify-ts"
|
import { ImplStatic, trait } from "@thilawyn/traitify-ts"
|
||||||
import { Class, HasRequiredKeys } from "type-fest"
|
import { Class, HasRequiredKeys } from "type-fest"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { parseZodSchemaEffect } from "../util"
|
import { StaticMembers, parseZodSchemaEffect } from "../util"
|
||||||
|
|
||||||
|
|
||||||
type CreateArgs<Input extends object> = (
|
type CreateArgs<Input extends object> = (
|
||||||
@@ -23,7 +23,8 @@ export const ZodSchemaObject = <
|
|||||||
schema: z.ZodObject<SchemaT, "strip", SchemaCatchall, Values, Values>,
|
schema: z.ZodObject<SchemaT, "strip", SchemaCatchall, Values, Values>,
|
||||||
schemaWithDefaultValues: z.ZodObject<SchemaWithDefaultValuesT, "strip", SchemaWithDefaultValuesCatchall, Values, PartialValues>,
|
schemaWithDefaultValues: z.ZodObject<SchemaWithDefaultValuesT, "strip", SchemaWithDefaultValuesCatchall, Values, PartialValues>,
|
||||||
) => trait
|
) => trait
|
||||||
.implement(Super => class ZodSchemaObject extends Super {
|
.implement(Super => {
|
||||||
|
class ZodSchemaObject extends Super {
|
||||||
static readonly schema = schema
|
static readonly schema = schema
|
||||||
static readonly schemaWithDefaultValues = schemaWithDefaultValues
|
static readonly schemaWithDefaultValues = schemaWithDefaultValues
|
||||||
|
|
||||||
@@ -86,6 +87,9 @@ export const ZodSchemaObject = <
|
|||||||
params,
|
params,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ZodSchemaObject as Class<ZodSchemaObject & Values> & StaticMembers<typeof ZodSchemaObject>
|
||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user