This commit is contained in:
@@ -4,12 +4,10 @@ import { z } from "zod"
|
||||
import { parseZodSchemaEffect } from "../util"
|
||||
|
||||
|
||||
type ParseParamsArgs = [] | [params: Partial<z.ParseParams>]
|
||||
|
||||
type NewZodSchemaInstanceArgs<Input extends object> = (
|
||||
type CreateArgs<Input extends object> = (
|
||||
HasRequiredKeys<Input> extends true
|
||||
? [values: Input, ...args: ParseParamsArgs]
|
||||
: [] | [values: Input, ...args: ParseParamsArgs]
|
||||
? [values: Input, params?: Partial<z.ParseParams>]
|
||||
: [] | [values: Input, params?: Partial<z.ParseParams>]
|
||||
)
|
||||
|
||||
|
||||
@@ -55,7 +53,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
@@ -69,7 +67,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return this
|
||||
.transform(this.schemaWithDefaultsValues)
|
||||
@@ -83,7 +81,7 @@ export const ZodSchemaObject = <
|
||||
Class<Instance, [values: Values]> &
|
||||
ImplStatic<typeof ZodSchemaObject>
|
||||
),
|
||||
...[values, params]: NewZodSchemaInstanceArgs<PartialValues>
|
||||
...[values, params]: CreateArgs<PartialValues>
|
||||
) {
|
||||
return parseZodSchemaEffect(
|
||||
this.transform(this.schemaWithDefaultsValues),
|
||||
|
||||
Reference in New Issue
Block a user