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

This commit is contained in:
Julien Valverdé
2024-02-27 05:25:55 +01:00
parent 9f8cc4f895
commit af8d4e5f86

View File

@@ -40,58 +40,27 @@ const test = User.schema.extend({
User.schemaWithDefaultValues User.schemaWithDefaultValues
) )
const inst = User.create({ id: 1n, name: "" }) const inst = User.create({ id: 1n, name: "User" })
const instEffect = User.createEffect({ id: 1n, name: "" }) // console.log(inst.name)
const instEffect = User.createEffect({ id: 1n, name: "User" })
// console.log(inst) // const jsonifiedUser = await inst.jsonifyPromise()
const jsonifiedUser = await inst.jsonifyPromise()
const AdminUserProto = User.extend() // const AdminUserProto = User.extend()
.schema({ // .schema({
schema: s => s.extend({ // schema: s => s.extend({
name: z.literal("Admin"), // name: z.literal("Admin"),
prout: z.string(), // prout: z.string(),
}), // }),
defaultValues: v => ({ ...v, name: "Admin" as const }), // defaultValues: v => ({ ...v, name: "Admin" as const }),
}) // })
.jsonifiable({ // .jsonifiable({
jsonifySchema: (s, json) => json.extend({ // jsonifySchema: (s, json) => json.extend({
prout: s.shape.prout // prout: s.shape.prout
}) // })
}) // })
class AdminUser extends AdminUserProto.toClass() {} // class AdminUser extends AdminUserProto.toClass() {}
const subInst = await AdminUser.createPromise({ id: 2n, prout: "" }) // const subInst = await AdminUser.createPromise({ id: 2n, prout: "" })
console.log(subInst) // console.log(subInst)
// class Box<T> {
// declare ["constructor"]: typeof Box
// constructor(public value: T) {}
// otherMethod() {
// return "prout" as const
// }
// newBox<
// C extends Class<I, ConstructorParameters<typeof Box>>,
// I extends Box<any>,
// T,
// >(
// // this: Omit<BaseClass<T>, "constructor"> & { ["constructor"]: Class<I> }
// this: { ["constructor"]: C | Class<I, ConstructorParameters<typeof Box>> },
// value: T,
// ) {
// // this.otherMethod()
// return new this.constructor(value)
// }
// }
// class UnrelatedClass {}
// class SuperBox<T> extends Box<T> {
// declare ["constructor"]: typeof SuperBox
// }
// const value = new SuperBox(69).newBox(69)