import { type StandardSchemaV1 } from "../../Validate/standardSchema"; export interface UndefinedReturn { validate: boolean; message: string; type: "undefined"; } /** * Optional validator augmented with a reference to the wrapped validator, * used by `required()` to unwrap optional layers when rebuilding a shape * @template T - The type of value the wrapped validator expects * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through) */ export type OptionalValidator = ((value?: T) => R | UndefinedReturn) & { inner: (value: T) => R; isOptional: true; }; /** * Wraps a validator to accept undefined values * @template T - The type of value the wrapped validator expects * @template R - The return type of the wrapped validator (preserved so the inner type tag flows through) * @param {Function} validator - Validator function to make optional * @returns {OptionalValidator} - Validator that passes for undefined or delegates to the wrapped validator */ export declare const optional: (validator: (value: T) => R) => OptionalValidator & StandardSchemaV1;