@alitajs/antd-plus
Version:
基于 ant-design 封装的偏业务组件
29 lines (28 loc) • 889 B
TypeScript
import React, { Component, ComponentType, ErrorInfo } from 'react';
export interface ErrorBoundaryProps {
fallback: ComponentType<{
error: ErrorInfo;
componentStack: string;
}>;
onError?: (error: Error, componentStack: string) => void;
}
interface ErrorBoundaryState {
hasError: boolean;
error?: ErrorInfo;
}
declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
static getDerivedStateFromError(error: ErrorInfo): {
hasError: boolean;
error: React.ErrorInfo;
};
static getDerivedStateFromProps(nextProps: any, state: any): {
children: any;
hasError: boolean;
error: any;
};
state: ErrorBoundaryState;
componentDidCatch(error: Error, info: ErrorInfo): void;
renderError: (e: ErrorInfo) => JSX.Element;
render(): {};
}
export default ErrorBoundary;