This commit is contained in:
@@ -29,7 +29,7 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
||||
// }
|
||||
|
||||
schema<
|
||||
Superclass extends AbstractClass<object> & { schema?: never, defaultValues?: never },
|
||||
Superclass extends AbstractClass<object, []> & { schema?: never, defaultValues?: never },
|
||||
|
||||
SchemaT extends z.ZodRawShape,
|
||||
SchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
@@ -58,11 +58,7 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
||||
return new ZodSchemaClassBuilder(
|
||||
Schemas as unknown as (
|
||||
AbstractClass<
|
||||
InstanceType<Superclass> &
|
||||
Simplify<
|
||||
Extend<[Schemas, Values]>
|
||||
>,
|
||||
|
||||
InstanceType<Superclass> & Values,
|
||||
ConstructorParameters<typeof Schemas>
|
||||
> &
|
||||
Simplify<
|
||||
@@ -109,40 +105,14 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
||||
|
||||
props: {
|
||||
jsonifySchema: (props: {
|
||||
schema: z.ZodObject<
|
||||
SchemaT,
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
Values
|
||||
>
|
||||
|
||||
schema: z.ZodObject<SchemaT, SchemaUnknownKeys, SchemaCatchall, Values, Values>
|
||||
shape: SchemaT
|
||||
}) => z.ZodObject<
|
||||
JsonifySchemaT,
|
||||
JsonifySchemaUnknownKeys,
|
||||
JsonifySchemaCatchall,
|
||||
JsonifiedValues,
|
||||
Values
|
||||
>
|
||||
}) => z.ZodObject<JsonifySchemaT, JsonifySchemaUnknownKeys, JsonifySchemaCatchall, JsonifiedValues, Values>
|
||||
|
||||
dejsonifySchema: (props: {
|
||||
schema: z.ZodObject<
|
||||
SchemaT,
|
||||
SchemaUnknownKeys,
|
||||
SchemaCatchall,
|
||||
Values,
|
||||
Values
|
||||
>
|
||||
|
||||
schema: z.ZodObject<SchemaT, SchemaUnknownKeys, SchemaCatchall, Values, Values>
|
||||
shape: SchemaT
|
||||
}) => z.ZodObject<
|
||||
DejsonifySchemaT,
|
||||
DejsonifySchemaUnknownKeys,
|
||||
DejsonifySchemaCatchall,
|
||||
Values,
|
||||
JsonifiedValues
|
||||
>
|
||||
}) => z.ZodObject<DejsonifySchemaT, DejsonifySchemaUnknownKeys, DejsonifySchemaCatchall, Values, JsonifiedValues>
|
||||
},
|
||||
) {
|
||||
const jsonifySchema = props.jsonifySchema({
|
||||
@@ -154,25 +124,21 @@ extends TraitExpressionBuilder<Superclass, Traits> {
|
||||
shape: this.expressionSuperclass.schema.shape,
|
||||
})
|
||||
|
||||
class Schemas extends this.expressionSuperclass {
|
||||
class JsonifiableSchemas extends (this.expressionSuperclass as AbstractClass<object>) {
|
||||
static readonly jsonifySchema = jsonifySchema
|
||||
static readonly dejsonifySchema = dejsonifySchema
|
||||
}
|
||||
|
||||
return new ZodSchemaClassBuilder(
|
||||
Schemas as unknown as (
|
||||
JsonifiableSchemas as unknown as (
|
||||
AbstractClass<
|
||||
InstanceType<Superclass> &
|
||||
Simplify<
|
||||
Extend<[Schemas, Values]>
|
||||
>,
|
||||
|
||||
ConstructorParameters<typeof Schemas>
|
||||
InstanceType<Superclass>,
|
||||
ConstructorParameters<Superclass>
|
||||
> &
|
||||
Simplify<
|
||||
Extend<[
|
||||
StaticMembers<Superclass>,
|
||||
StaticMembers<typeof Schemas>,
|
||||
StaticMembers<typeof JsonifiableSchemas>,
|
||||
]>
|
||||
>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user