import { type IGuard, type ValidationContext, type ValidationRule } from '../core'; /** * Специальный итерфейс Guard для object. В данном интерфейсе ctx required * Переопределение необходимо для того, чтобы ts показывал, что ctx required в кастомных правилах */ interface IObjectPropGuard> { (value: Parameters>[0], ctx: ValidationContext): ReturnType>; define: IGuard['define']; } type AdditionalDefOptions = { /** * Делает все свойства объекта partial */ isPartial?: boolean; }; /** * Возможные значения, принимаемые схемой */ export type SchemaValue> = IObjectPropGuard | ValidationRule; /** * Схема правил валдиации для объекта */ export type Schema> = Record>; /** * Guard для объекта * @param schema - схема валидации объекта * @example * ```ts * type Values = { * name: string; * age?: number; * info: { surname: string }; * }; * * const values: Values = { name: 'Vasya', info: { surname: 'Vasin' } }; * * const validateObject = object({ * name: string(min(2)), * age: optional(number()), * info: object({ surname: string(min(2)) }), * customField: (value, ctx) => { * return ctx.createError({ message: 'error', code: 'custom error' }) * } * }); * ``` */ export declare const object: , TLastSchemaValues extends Record = {}>(schema: Schema) => IGuard; export type ObjectGuard> = ReturnType>; export {};