This commit is contained in:
@@ -37,25 +37,23 @@ export const JsonifiableZodSchemaObject = <
|
||||
.build()
|
||||
.subtrait()
|
||||
.implement(Super => class JsonifiableZodSchemaObject extends Super {
|
||||
declare ["constructor"]: typeof JsonifiableZodSchemaObject
|
||||
|
||||
static readonly jsonifySchema = jsonifySchema
|
||||
static readonly dejsonifySchema = dejsonifySchema
|
||||
|
||||
|
||||
jsonify(params?: Partial<z.ParseParams>) {
|
||||
return (this.constructor as unknown as ImplStatic<typeof JsonifiableZodSchemaObject>)
|
||||
.jsonifySchema
|
||||
.parse(this, params)
|
||||
return this.constructor.jsonifySchema.parse(this, params)
|
||||
}
|
||||
|
||||
jsonifyPromise(params?: Partial<z.ParseParams>) {
|
||||
return (this.constructor as unknown as ImplStatic<typeof JsonifiableZodSchemaObject>)
|
||||
.jsonifySchema
|
||||
.parseAsync(this, params)
|
||||
return this.constructor.jsonifySchema.parseAsync(this, params)
|
||||
}
|
||||
|
||||
jsonifyEffect(params?: Partial<z.ParseParams>) {
|
||||
return parseZodSchemaEffect(
|
||||
(this.constructor as unknown as ImplStatic<typeof JsonifiableZodSchemaObject>).jsonifySchema,
|
||||
this.constructor.jsonifySchema,
|
||||
this,
|
||||
params,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user