0.1.2 #3

Merged
Thilawyn merged 136 commits from next into master 2024-03-11 19:44:21 +01:00
2 changed files with 28 additions and 3 deletions
Showing only changes of commit 9e18a4a0ee - Show all commits

View File

@@ -3,6 +3,7 @@ import { z } from "zod"
import { ZodSchemaClassBuilder } from "./ZodSchemaClass"
import { dejsonify, jsonify } from "./schema/jsonify"
import { ObservableZodSchemaObject } from "./traits/ObservableZodSchemaObject"
import { AbstractClass, Class } from "type-fest"
const exp = new ZodSchemaClassBuilder(TraitExpression.NullSuperclass, [])
@@ -34,7 +35,7 @@ class User extends exp.extends implements Implements<typeof exp> {}
User.defaultValues
const inst = User.create({ id: 1n, name: "" })
console.log(inst)
// console.log(inst)
const jsonifiedUser = await inst.jsonifyPromise()
@@ -47,4 +48,28 @@ class SubTest extends User.extend({
}) {}
const subInst = await SubTest.createPromise({ name: "", prout: "" })
console.log(subInst)
// console.log(subInst)
class BaseClass {
declare ["constructor"]: typeof BaseClass
static readonly issou = "gneugneu"
otherMethod() {
return "prout" as const
}
method<I extends object>(
this: Omit<BaseClass, "constructor"> & { ["constructor"]: Class<I> }
) {
this.otherMethod()
return new this.constructor()
}
}
class Superclass extends BaseClass {
declare ["constructor"]: typeof Superclass
}
console.log(new Superclass().method())

View File

@@ -64,7 +64,7 @@ export const JsonifiableZodSchemaObject = trait
params?: Partial<z.ParseParams>,
) {
return this.dejsonifySchema.parseAsync(this, params)
return this.jsonifySchema.parseAsync(this, params)
}
jsonifyEffect<