0.1.1 #2

Merged
Thilawyn merged 47 commits from next into master 2024-01-17 20:47:13 +01:00
Showing only changes of commit adc24574ec - Show all commits

View File

@@ -1,6 +1,6 @@
import { pipeInto } from "ts-functional-pipe"
import { z } from "zod"
import { makeSchemableClass, newSchemable } from "."
import { extendSchemableClass, makeSchemableClass, newSchemable } from "."
import { makeJsonifiableSchemableClass } from "./jsonifiable"
import { dejsonifyBigIntSchema, jsonifyBigIntSchema } from "./legacy/jsonifiable"
@@ -49,4 +49,22 @@ class User extends pipeInto(
const user1 = newSchemable(User, { id: 1n, name: "User" })
user1.jsonify()
console.log(user1.jsonify())
const UserWithPhone = extendSchemableClass(User, {
schema: schema => schema.extend({
phone: z.string()
}),
defaultValues: defaultValues => ({
...defaultValues,
phone: "+33600000000",
}),
})
UserWithPhone.schema
const user2 = newSchemable(UserWithPhone, { id: 1n, name: "User" })
console.log(user2.jsonify())