import { Component, type ErrorInfo, type ReactNode } from "react"; interface ErrorBoundaryProps { children: ReactNode; /** Rendered when a descendant throws. Receives the error and a reset fn. */ fallback?: (error: Error, reset: () => void) => ReactNode; /** Optional hook for logging the caught error. */ onError?: (error: Error, info: ErrorInfo) => void; /** * When any value in this array changes, the boundary clears its error state * and retries rendering. Pass the inputs that produced the crash (e.g. the * active content) so editing past a bad state automatically recovers. */ resetKeys?: unknown[]; } interface ErrorBoundaryState { error: Error | null; } /** * Catches render-time exceptions from descendants so a single bad input — most * commonly malformed XML being parsed mid-edit — degrades to an inline notice * instead of crashing the entire host application. */ declare class ErrorBoundary extends Component { state: ErrorBoundaryState; static getDerivedStateFromError(error: Error): ErrorBoundaryState; componentDidCatch(error: Error, info: ErrorInfo): void; componentDidUpdate(prevProps: ErrorBoundaryProps): void; reset: () => void; render(): string | number | bigint | boolean | import("react").JSX.Element | Iterable | Promise> | Iterable | null | undefined> | null | undefined; } export default ErrorBoundary;