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