0.1.3 #4

Merged
Thilawyn merged 74 commits from next into master 2024-03-24 22:24:25 +01:00
Showing only changes of commit afd703b781 - Show all commits

View File

@@ -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