TZodSchemaClass work
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-01-24 19:06:05 +01:00
parent b6c2c4bec7
commit 338c750a4b
3 changed files with 128 additions and 18 deletions

View File

@@ -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: "" })