import type { ErrorInfo } from 'react'; import type { ErrorBoundaryPropsWithFallback } from 'react-error-boundary'; import { ErrorBoundary as DefaultErrorBoundary } from 'react-error-boundary'; import { DefaultError } from '@/components/molecules'; type Optional = Omit & Pick, K>; type Properties = { readonly onReset?: () => void; } & Optional; function ErrorBoundary({ fallback, onError, onReset = undefined, ...props }: Properties) { const onErrorReport = (error: unknown, info: ErrorInfo) => { // use any crash reporting tool here return onError?.(error, info); }; return ( } onError={onErrorReport} /> ); } export default ErrorBoundary;