Extend fix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-25 05:38:27 +01:00
parent 29d539ec32
commit 93edcde258
2 changed files with 10 additions and 11 deletions

View File

@@ -38,20 +38,19 @@ const inst = User.create({ id: 1n, name: "" })
const jsonifiedUser = await inst.jsonifyPromise()
const extended = User.extend()
const AdminUserProto = User.extend()
.schema({
schema: s => s.extend({
prout: z.string()
name: z.literal("Admin"),
prout: z.string(),
}),
defaultValues: v => v,
defaultValues: v => ({ ...v, name: "Admin" as const }),
})
class SubTest extends extended.build() {}
const subInst = await SubTest.createPromise({ name: "", prout: "" })
// console.log(subInst)
class AdminUser extends AdminUserProto.build() {}
const subInst = await AdminUser.createPromise({ id: 2n, prout: "" })
console.log(subInst)
// class Box<T> {