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

This commit is contained in:
Julien Valverdé
2024-03-17 19:31:39 +01:00
parent afd703b781
commit a05ad759ad

View File

@@ -41,7 +41,7 @@ export const ZodSchemaObject = <
}
static pipeInstanceIntoSchema<
Instance extends Values,
Self extends Class<Values, [values: Values]>,
SchemaT extends z.ZodRawShape,
SchemaUnknownKeys extends z.UnknownKeysParam,
@@ -49,14 +49,10 @@ export const ZodSchemaObject = <
SchemaOutput,
SchemaInput extends Values,
>(
this: (
Class<Instance, [values: Values]> &
ImplStatic<typeof ZodSchemaObjectImpl>
),
schema: z.ZodObject<SchemaT, SchemaUnknownKeys, SchemaCatchall, SchemaOutput, SchemaInput>,
this: Self,
schema: z.ZodObject<SchemaT, SchemaUnknownKeys, SchemaCatchall, SchemaOutput, SchemaInput>,
) {
return schema.transform(values => new this(values))
return z.instanceof(this).pipe(schema)
}