import { Namespace, DefaultNamespace, TFunction } from 'i18next'; import { ErrorInfo, BadRequest } from './detail.js'; import { ResolvedErrorReason } from './reason.js'; declare function getErrorInfo(data: unknown): ErrorInfo | null; /** * @example For axios: * * const { t } = useTranslation('error'); * * const { message } = getErrorMessage(error.response.data, t); * toast.error(message); */ declare function getErrorMessage(data: unknown, t: TFunction): { reason: ResolvedErrorReason | null; message: string; }; /** * @example For react-hook-form: * * const { setError } = useForm(); * const fieldViolations = getFieldViolations(error.response.data); * fieldViolations.forEach((violation) => { * setError(violation.field, { message: violation.description }); * }); */ declare function getFieldViolations(data: unknown): BadRequest['fieldViolations']; export { getErrorInfo, getErrorMessage, getFieldViolations };