0.1.2 #3

Merged
Thilawyn merged 136 commits from next into master 2024-03-11 19:44:21 +01:00
2 changed files with 15 additions and 7 deletions
Showing only changes of commit 53bd30aa7a - Show all commits

View File

@@ -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,
], ],
) )

View File

@@ -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({