extendSchemable work
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-01-09 03:06:52 +01:00
parent 1bdfc079b9
commit 6fe782208d
4 changed files with 91 additions and 57 deletions

View File

@@ -0,0 +1,23 @@
import { z } from "zod"
import { extendSchemable } from "."
const Test1Schema = z.object({ prout: z.string() })
class Test1 {
static readonly schema = Test1Schema
readonly schema = Test1Schema
static readonly defaultValues = { prout: "heugneu" }
readonly defaultValues = { prout: "heugneu" }
prout: string = "heugneu"
}
const Test2 = extendSchemable(
Test1,
schema => schema.extend({ prout: z.literal("ruquier"), ruquier: z.number() }),
defaultValues => ({ prout: "ruquier" as const }),
)
Test2.defaultValues
new Test2().prout