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

This commit is contained in:
Julien Valverdé
2024-03-16 23:20:39 +01:00
parent 2bf207883f
commit 11f384d933
3 changed files with 37 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
import { ImplStatic, trait } from "@thilawyn/traitify-ts"
import { AbstractClass, Class, HasRequiredKeys } from "type-fest"
import { Class, HasRequiredKeys } from "type-fest"
import { z } from "zod"
import { StaticMembers, parseZodSchemaEffect, stripZodObjectDefaults } from "../util"
@@ -85,13 +85,24 @@ export const ZodSchemaObject = <
}
static extend<
Self extends AbstractClass<ZodSchemaObject> & ImplStatic<typeof ZodSchemaObject>
>(
this: Self
) {
// static extend<
// Self extends AbstractClass<ZodSchemaObject> & ImplStatic<typeof ZodSchemaObject>,
}
// ExtendedT extends z.ZodRawShape,
// ExtendedCatchall extends z.ZodTypeAny,
// ExtendedValues extends Values,
// ExtendedPartialValues extends Partial<ExtendedValues>,
// >(
// this: Self,
// schemaWithDefaults: (
// schemaWithDefaults: typeof this.schemaWithDefaults
// ) => z.ZodObject<ExtendedT, "strip", ExtendedCatchall, ExtendedValues, ExtendedPartialValues>,
// ) {
// return expression
// .extends(this)
// .expresses(ZodSchemaObject(schemaWithDefaults(this.schemaWithDefaults)))
// }
}
return ZodSchemaObject as Class<ZodSchemaObject & Values> & StaticMembers<typeof ZodSchemaObject>