UNPKG

goobs-frontend

Version:

A comprehensive React-based libary for building modern web applications

28 lines 1.09 kB
import { FormEngine } from '../context'; /** Structural view of the zod schema surface the engine uses. */ interface ZodSchemaLike { safeParse: (value: unknown) => ZodSafeParseResult; shape?: Record<string, unknown>; } interface ZodSafeParseResult { success: boolean; error?: { issues?: ReadonlyArray<{ path: ReadonlyArray<PropertyKey>; message: string; }>; }; } export interface UseZodFormEngineArgs<TValues extends Record<string, unknown>> { /** The zod object schema the form validates against. */ schema: ZodSchemaLike; /** Initial field values. */ initialValues: TValues; /** Called with validated values once submission passes validation. */ onSubmit: (values: TValues) => void | Promise<void>; /** Stable form id used for diagnostics (`formId`). */ formId?: string; } export declare function useZodFormEngine<TValues extends Record<string, unknown>>({ schema, initialValues, onSubmit, formId, }: UseZodFormEngineArgs<TValues>): FormEngine<TValues>; export {}; //# sourceMappingURL=zod.d.ts.map