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
)
const inst = User.create({ id: 1n, name: "" })
const instEffect = User.createEffect({ id: 1n, name: "" })
const inst = User.create({ id: 1n, name: "User" })
// 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()
.schema({
schema: s => s.extend({
name: z.literal("Admin"),
prout: z.string(),
}),
defaultValues: v => ({ ...v, name: "Admin" as const }),
})
.jsonifiable({
jsonifySchema: (s, json) => json.extend({
prout: s.shape.prout
})
})
// const AdminUserProto = User.extend()
// .schema({
// schema: s => s.extend({
// name: z.literal("Admin"),
// prout: z.string(),
// }),
// defaultValues: v => ({ ...v, name: "Admin" as const }),
// })
// .jsonifiable({
// jsonifySchema: (s, json) => json.extend({
// prout: s.shape.prout
// })
// })
class AdminUser extends AdminUserProto.toClass() {}
const subInst = await AdminUser.createPromise({ id: 2n, prout: "" })
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)
// class AdminUser extends AdminUserProto.toClass() {}
// const subInst = await AdminUser.createPromise({ id: 2n, prout: "" })
// console.log(subInst)