@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
21 lines (20 loc) • 845 B
TypeScript
import Ajv from 'ajv/dist/2020.js';
import { ajvErrorsToFormErrors, ajvErrorsToOneFormError } from './ajvErrors';
export { Ajv };
export type AjvInstance = Ajv & {
ajvErrorsToFormErrors: typeof ajvErrorsToFormErrors;
ajvErrorsToOneFormError: typeof ajvErrorsToOneFormError;
};
/**
* Creates or enhances an Ajv instance.
* If no instance is provided, a new one is created with allErrors option enabled.
* The ajv-errors plugin is added to the instance if it hasn't been added yet.
*/
export declare function makeAjvInstance(instance?: Ajv): AjvInstance;
/**
* Enhances an Ajv instance by adding the ajv-errors plugin if it hasn't been added yet.
*
* @param instance - Optional custom instance of Ajv.
* @returns The created or provided instance of Ajv.
*/
export declare function enhanceAjvInstance(instance?: Ajv): AjvInstance;