@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
33 lines (32 loc) • 921 B
TypeScript
/// <reference types="react" />
/// <reference types="react" />
import { FormikErrors } from 'formik';
import type { 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 {};