UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

31 lines (30 loc) 852 B
import { FormikErrors } from 'formik'; import { Paths } from '../types'; /** * Provides tools to introspect validation errors for Formik-based forms. */ export declare function useErrorChecker<Values = unknown>(): { hasAnyError: (...paths: Paths<Values>[]) => boolean; }; /** * Recursively look up the names of fields that have errors, and join them using * path-syntax. * * Example: * * getErrorNames({foo: {bar: 'an error!'}}) * // ['foo', ['foo.bar']] * * @private */ export declare function getErrorNames<T>(errors: FormikErrors<T>): Paths<T>[]; interface ValidationErrors { hasErrors: boolean; errors: string[]; } export declare const useValidationErrors: (name: string) => ValidationErrors; export interface ErrorListProps { errors: string[]; } export declare const ErrorList: React.FC<ErrorListProps>; export {};