0.1.3 #4
@@ -24,6 +24,7 @@ export const ZodSchemaObject = <
|
||||
static readonly schema = stripZodObjectDefaults(schemaWithDefaults)
|
||||
static readonly schemaWithDefaults = schemaWithDefaults
|
||||
|
||||
|
||||
static pipeSchemaIntoInstance<
|
||||
Instance extends Values,
|
||||
|
||||
@@ -39,6 +40,25 @@ export const ZodSchemaObject = <
|
||||
return schema.transform(values => new this(values))
|
||||
}
|
||||
|
||||
static pipeInstanceIntoSchema<
|
||||
Instance extends Values,
|
||||
|
||||
SchemaT extends z.ZodRawShape,
|
||||
SchemaUnknownKeys extends z.UnknownKeysParam,
|
||||
SchemaCatchall extends z.ZodTypeAny,
|
||||
SchemaOutput,
|
||||
SchemaInput extends Values,
|
||||
>(
|
||||
this: (
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObjectImpl>
|
||||
),
|
||||
|
||||
schema: z.ZodObject<SchemaT, SchemaUnknownKeys, SchemaCatchall, SchemaOutput, SchemaInput>,
|
||||
) {
|
||||
return schema.transform(values => new this(values))
|
||||
}
|
||||
|
||||
|
||||
static create<
|
||||
Instance extends Values
|
||||
|
||||
Reference in New Issue
Block a user