This commit is contained in:
20
src/tests.ts
20
src/tests.ts
@@ -14,12 +14,24 @@ class Test extends ZodSchemaClassOf(Root, {
|
||||
|
||||
defaultValues: defineDefaultValues({ id: -1n }),
|
||||
}) {}
|
||||
|
||||
Test.defaultValues
|
||||
const inst = await Test.instantiatePromise({ id: 1n, name: "" })
|
||||
// Test.extend()
|
||||
|
||||
console.log(inst)
|
||||
class SubTest extends Test.extend({
|
||||
schema: ({ schema }) => schema.extend({
|
||||
prout: z.string()
|
||||
}),
|
||||
|
||||
class ChildTest extends Test {}
|
||||
defaultValues: defaultValues => defineDefaultValues({
|
||||
...defaultValues
|
||||
}),
|
||||
}) {}
|
||||
|
||||
ChildTest.instantiate({ name: "" })
|
||||
const subInst = await SubTest.instantiatePromise({ name: "", prout: "" })
|
||||
|
||||
console.log(subInst)
|
||||
|
||||
// class ChildTest extends Test {}
|
||||
|
||||
// ChildTest.instantiate({ name: "" })
|
||||
|
||||
Reference in New Issue
Block a user