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