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

This commit is contained in:
Julien Valverdé
2024-01-21 23:29:11 +01:00
parent c073154eeb
commit b6c2c4bec7
3 changed files with 29 additions and 11 deletions

View File

@@ -2,7 +2,11 @@ import { z } from "zod"
import { ZodSchemaClassOf, defineDefaultValues } from "."
class Test extends ZodSchemaClassOf(Object, {
class Root {
}
class Test extends ZodSchemaClassOf(Root, {
schema: z.object({
id: z.bigint(),
name: z.string(),
@@ -11,11 +15,11 @@ class Test extends ZodSchemaClassOf(Object, {
defaultValues: defineDefaultValues({ id: -1n }),
}) {}
Test.defaultValues
const inst = await Test.newPromise({ id: 1n, name: "" })
const inst = await Test.instantiatePromise({ id: 1n, name: "" })
// Test.extend()
console.log(inst)
// class ChildTest extends Test {}
class ChildTest extends Test {}
// ChildTest.newPromise()
ChildTest.instantiate({ name: "" })