import { SafeParseReturnType, ZodCustomIssue, ZodIssue, ZodType } from "zod"; declare type Primitive = string | number | boolean | bigint | symbol | undefined | null; export declare type DeepNonNullable = T extends Primitive | Date | File ? NonNullable : T extends {} ? { [K in keyof T]-?: DeepNonNullable; } : Required; export interface ZormError { issues: ZodIssue[]; } export declare type GenericSchema = ZodType; export interface RenderProps { name: string; id: string; errorId: string; type: ZodType; issues: ZodIssue[]; } export declare type FieldGetter = any)>(arg?: Arg) => undefined extends Arg ? string : Arg extends (props: RenderProps) => any ? ReturnType : string; export declare type FieldChain = { [P in keyof T]: T[P] extends Array ? (index: number) => FieldChain extends string ? FieldGetter : FieldChain : T[P] extends Date ? FieldGetter : T[P] extends File ? FieldGetter : T[P] extends object ? FieldChain : FieldGetter; }; export declare type FieldChainFromSchema = FieldChain>>; export interface ErrorGetter { /** * Get the Zod Issue */ (): ZodIssue | undefined; /** * Return true when there is an error */ (bool: typeof Boolean): boolean; /** * Call the function on error and return its value */ any>(render: Fn): ReturnType | undefined; /** * Return the given value on error */ (value: T): T | undefined; } export interface ArrayErrorGetter extends ErrorGetter { (index: number): T; } export declare type ErrorChain = { [P in keyof T]: T[P] extends Array ? ArrayErrorGetter extends string ? ErrorGetter : ErrorChain & ErrorGetter> : T[P] extends object ? ErrorChain & ErrorGetter : ErrorGetter; }; export declare type ErrorChainFromSchema = ErrorChain>>; export declare type SafeParseResult = SafeParseReturnType>; export interface Zorm { /** * @deprecated use .form instead */ refObject: React.MutableRefObject; form: HTMLFormElement | undefined; ref: (form: HTMLFormElement | null) => void; fields: FieldChainFromSchema; errors: ErrorChainFromSchema & ErrorGetter; validate(): SafeParseResult; validation: SafeParseResult | null; customIssues: ZodIssue[]; } /** * Create ZodCustomIssue for the field in the chain path */ export interface IssueCreator { (message: string, params?: { [key: string]: any; }): ZodCustomIssue; } export interface ArrayIssueCreator extends IssueCreator { (index: number): T; } export declare type IssueCreatorChain = { [P in keyof T]: T[P] extends Array ? ArrayIssueCreator extends string ? IssueCreator : IssueCreatorChain & IssueCreator> : T[P] extends object ? IssueCreatorChain & IssueCreator : IssueCreator; }; export declare type ZodCustomIssueWithMessage = ZodCustomIssue & { message: string; }; export interface IssueCreatorMethods { hasIssues(): boolean; toArray(): ZodCustomIssueWithMessage[]; toJSON(): ZodCustomIssueWithMessage[]; } export declare type IssueCreatorFromSchema = IssueCreatorChain>> & IssueCreatorMethods; export {}; //# sourceMappingURL=types.d.ts.map