ZodSchemaClassBuilder work
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -48,8 +48,8 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this
|
return new ZodSchemaClassBuilder(
|
||||||
.extends(Schemas as unknown as (
|
Schemas as unknown as (
|
||||||
AbstractClass<
|
AbstractClass<
|
||||||
InstanceType<Superclass> &
|
InstanceType<Superclass> &
|
||||||
Simplify<
|
Simplify<
|
||||||
@@ -64,10 +64,13 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
|||||||
StaticMembers<typeof Schemas>,
|
StaticMembers<typeof Schemas>,
|
||||||
]>
|
]>
|
||||||
>
|
>
|
||||||
))
|
),
|
||||||
.expresses(
|
|
||||||
|
[
|
||||||
|
...this.expressionTraits,
|
||||||
InstantiableZodSchemaObject,
|
InstantiableZodSchemaObject,
|
||||||
ExtendableZodSchemaObject,
|
ExtendableZodSchemaObject,
|
||||||
|
],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
src/tests.ts
12
src/tests.ts
@@ -7,13 +7,15 @@ import { ObservableZodSchemaObject } from "./traits/ObservableZodSchemaObject"
|
|||||||
const newTestExp = new ZodSchemaClassBuilder(TraitExpression.NullSuperclass, [])
|
const newTestExp = new ZodSchemaClassBuilder(TraitExpression.NullSuperclass, [])
|
||||||
.schema(
|
.schema(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.bigint()
|
/** Object ID */
|
||||||
|
id: z.bigint(),
|
||||||
|
name: z.string(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
{ id: -1n },
|
{ id: -1n },
|
||||||
)
|
)
|
||||||
.expressionSuperclass
|
.expresses(ObservableZodSchemaObject)
|
||||||
|
.build()
|
||||||
|
|
||||||
const TestExp = ZodSchemaClass({
|
const TestExp = ZodSchemaClass({
|
||||||
schema: z.object({
|
schema: z.object({
|
||||||
@@ -27,8 +29,8 @@ const TestExp = ZodSchemaClass({
|
|||||||
.expresses(ObservableZodSchemaObject)
|
.expresses(ObservableZodSchemaObject)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
@TestExp.staticImplements
|
@newTestExp.staticImplements
|
||||||
class Test extends TestExp.extends implements Implements<typeof TestExp> {}
|
class Test extends newTestExp.extends implements Implements<typeof newTestExp> {}
|
||||||
|
|
||||||
Test.schema
|
Test.schema
|
||||||
const inst = Test.create({ id: 1n, name: "" })
|
const inst = Test.create({ id: 1n, name: "" })
|
||||||
|
|||||||
Reference in New Issue
Block a user