dejsonifySchemable
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-01-16 14:44:54 +01:00
parent adc24574ec
commit bfa359449e
4 changed files with 229 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ export function extendSchemableClass<
>,
props: {
schema: (
schema: (props: {
schema: z.ZodObject<
ExtendSchemaT,
ExtendSchemaUnknownKeys,
@@ -43,7 +43,9 @@ export function extendSchemableClass<
ExtendSchemaValues,
ExtendSchemaValues
>
) => z.ZodObject<
shape: ExtendSchemaT
}) => z.ZodObject<
SchemaT,
SchemaUnknownKeys,
SchemaCatchall,
@@ -60,7 +62,10 @@ export function extendSchemableClass<
: AbstractClass<T, Arguments>
)
const schema = props.schema(extend.schema)
const schema = props.schema({
schema: extend.schema,
shape: extend.schema.shape,
})
const defaultValues = props.defaultValues(extend.defaultValues)
return class extends extend {