44 lines
866 B
TypeScript
44 lines
866 B
TypeScript
import { z } from "zod"
|
|
import { ZodSchemaClass, defineDefaultValues } from "."
|
|
|
|
|
|
class Test extends ZodSchemaClass({
|
|
schema: z.object({
|
|
id: z.bigint(),
|
|
name: z.string(),
|
|
}),
|
|
|
|
defaultValues: { id: -1n },
|
|
}) {}
|
|
|
|
const Test2 = ZodSchemaClass({
|
|
schema: z.object({
|
|
id: z.bigint(),
|
|
name: z.string(),
|
|
}),
|
|
|
|
defaultValues: { id: -1n },
|
|
})
|
|
|
|
Test.defaultValues
|
|
const inst = Test.create({ id: 1n, name: "" })
|
|
|
|
|
|
// class SubTest extends Test.extend({
|
|
// schema: ({ schema }) => schema.extend({
|
|
// prout: z.string()
|
|
// }),
|
|
|
|
// defaultValues: defaultValues => defineDefaultValues({
|
|
// ...defaultValues
|
|
// }),
|
|
// }) {}
|
|
|
|
// const subInst = await SubTest.createPromise({ name: "", prout: "" })
|
|
|
|
// console.log(subInst)
|
|
|
|
// class ChildTest extends Test {}
|
|
|
|
// ChildTest.instantiate({ name: "" })
|