zent
Version:
一套前端设计语言和基于React的实现
30 lines (29 loc) • 990 B
TypeScript
import { Component } from 'react';
import ErrorBoundaryFallbackComponent from './Fallback';
import catchError from './catchError';
import withErrorBoundary from './withErrorBoundary';
export interface IOnErrorCallback {
(error: Error, componentStack: string): void;
}
export interface IErrorBoundaryFallbackComponentProps {
error: Error;
componentStack: string;
}
export interface IErrorBoundaryProps {
onError?: IOnErrorCallback;
FallbackComponent?: React.ComponentType<IErrorBoundaryFallbackComponentProps>;
}
export declare class ErrorBoundary extends Component<IErrorBoundaryProps> {
static defaultProps: {
FallbackComponent: typeof ErrorBoundaryFallbackComponent;
};
static withErrorBoundary: typeof withErrorBoundary;
static catchError: typeof catchError;
state: {
error: any;
info: any;
};
componentDidCatch(error: any, info: any): void;
render(): import("react").ReactNode;
}
export default ErrorBoundary;