This commit is contained in:
@@ -6,6 +6,7 @@ import { ZodSchemaAbstractClass } from "./shapes/ZodSchemaClass"
|
|||||||
import { DejsonifiableZodSchemaObject } from "./traits/DejsonifiableZodSchemaObject"
|
import { DejsonifiableZodSchemaObject } from "./traits/DejsonifiableZodSchemaObject"
|
||||||
import { ExtendableZodSchemaObject } from "./traits/ExtendableZodSchemaObject"
|
import { ExtendableZodSchemaObject } from "./traits/ExtendableZodSchemaObject"
|
||||||
import { InstantiableZodSchemaObject } from "./traits/InstantiableZodSchemaObject"
|
import { InstantiableZodSchemaObject } from "./traits/InstantiableZodSchemaObject"
|
||||||
|
import { JsonifiableZodSchemaObject } from "./traits/JsonifiableZodSchemaObject"
|
||||||
import { Extend, StaticMembers } from "./util"
|
import { Extend, StaticMembers } from "./util"
|
||||||
|
|
||||||
|
|
||||||
@@ -62,12 +63,8 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
|||||||
InstanceType<Superclass> & Values,
|
InstanceType<Superclass> & Values,
|
||||||
ConstructorParameters<typeof Schemas>
|
ConstructorParameters<typeof Schemas>
|
||||||
> &
|
> &
|
||||||
Simplify<
|
StaticMembers<Superclass> &
|
||||||
Extend<[
|
StaticMembers<typeof Schemas>
|
||||||
StaticMembers<Superclass>,
|
|
||||||
StaticMembers<typeof Schemas>,
|
|
||||||
]>
|
|
||||||
>
|
|
||||||
),
|
),
|
||||||
|
|
||||||
[
|
[
|
||||||
@@ -128,14 +125,24 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
|||||||
|
|
||||||
class JsonifiableSchemas extends (this.expressionSuperclass as AbstractClass<object>) {
|
class JsonifiableSchemas extends (this.expressionSuperclass as AbstractClass<object>) {
|
||||||
static readonly jsonifySchema = jsonifySchema
|
static readonly jsonifySchema = jsonifySchema
|
||||||
|
readonly jsonifySchema = jsonifySchema
|
||||||
static readonly dejsonifySchema = dejsonifySchema
|
static readonly dejsonifySchema = dejsonifySchema
|
||||||
|
readonly dejsonifySchema = dejsonifySchema
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ZodSchemaClassBuilder(
|
return new ZodSchemaClassBuilder(
|
||||||
JsonifiableSchemas as unknown as Superclass & StaticMembers<typeof JsonifiableSchemas>,
|
JsonifiableSchemas as unknown as (
|
||||||
|
AbstractClass<
|
||||||
|
InstanceType<Superclass> & JsonifiableSchemas,
|
||||||
|
ConstructorParameters<Superclass>
|
||||||
|
> &
|
||||||
|
StaticMembers<Superclass> &
|
||||||
|
StaticMembers<typeof JsonifiableSchemas>
|
||||||
|
),
|
||||||
|
|
||||||
[
|
[
|
||||||
...this.expressionTraits,
|
...this.expressionTraits,
|
||||||
|
JsonifiableZodSchemaObject,
|
||||||
DejsonifiableZodSchemaObject,
|
DejsonifiableZodSchemaObject,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class User extends exp.extends implements Implements<typeof exp> {}
|
|||||||
User.defaultValues
|
User.defaultValues
|
||||||
const inst = User.create({ id: 1n, name: "" })
|
const inst = User.create({ id: 1n, name: "" })
|
||||||
console.log(inst)
|
console.log(inst)
|
||||||
|
inst.jsonify()
|
||||||
|
|
||||||
|
|
||||||
class SubTest extends User.extend({
|
class SubTest extends User.extend({
|
||||||
|
|||||||
Reference in New Issue
Block a user