UNPKG

@next-safe-action/adapter-react-hook-form

Version:

This adapter offers a way to seamlessly integrate next-safe-action with react-hook-form.

19 lines (16 loc) 696 B
import { ValidationErrors } from "next-safe-action"; import { FieldErrors } from "react-hook-form"; import { S as StandardSchemaV1, E as ErrorMapperProps, a as InferOutputOrDefault, } from "./standard-schema-DVTKKT6T.mjs"; /** * Maps a validation errors object to an object of `FieldErrors` compatible with react-hook-form. * You should only call this function directly for advanced use cases, and prefer exported hooks. */ declare function mapToHookFormErrors<S extends StandardSchemaV1 | undefined>( validationErrors: ValidationErrors<S> | undefined, props?: ErrorMapperProps ): FieldErrors<InferOutputOrDefault<S, any>> | undefined; export { ErrorMapperProps, mapToHookFormErrors };