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