type DeepPartial = { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial } export type ValidateArg = T extends object ? DeepPartial : T export type Validator = { prevalidate?: (v: string | null) => boolean rehydrate: (v: string | null) => T validate?: (v: ValidateArg) => boolean /** * The field is optional and validation will be skipped if it is not provided. * Optional parameters will always be nullable. * For `usePathParams` this field is ignored. */ optional: boolean /** * OpenAPI description field. * If 'errorMessage' is not provided, will be used to inform user in the event of failed validation. */ description?: string /** * Error message sent to user when validation fails. */ errorMessage?: string } export type BuiltInValidator = Validator & { description: DescriptionT errorMessage: ErrorMessageT }