/** * 错误边界 高阶组件 * https://zh-hans.reactjs.org/docs/error-boundaries.html * * ts: https://www.pluralsight.com/guides/higher-order-composition-typescript-react */ import React from 'react'; declare function errorBoundary(WrappedComponent: React.ComponentType): { new (props: any): { render(): JSX.Element; context: any; setState(state: {} | ((prevState: Readonly<{}>, props: Readonly) => {} | Pick<{}, K>) | Pick<{}, K>, callback?: () => void): void; forceUpdate(callback?: () => void): void; readonly props: Readonly & Readonly<{ children?: React.ReactNode; }>; state: Readonly<{}>; refs: { [key: string]: React.ReactInstance; }; componentDidMount?(): void; shouldComponentUpdate?(nextProps: Readonly, nextState: Readonly<{}>, nextContext: any): boolean; componentWillUnmount?(): void; componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void; getSnapshotBeforeUpdate?(prevProps: Readonly, prevState: Readonly<{}>): any; componentDidUpdate?(prevProps: Readonly, prevState: Readonly<{}>, snapshot?: any): void; componentWillMount?(): void; UNSAFE_componentWillMount?(): void; componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void; UNSAFE_componentWillReceiveProps?(nextProps: Readonly, nextContext: any): void; componentWillUpdate?(nextProps: Readonly, nextState: Readonly<{}>, nextContext: any): void; UNSAFE_componentWillUpdate?(nextProps: Readonly, nextState: Readonly<{}>, nextContext: any): void; }; getDerivedStateFromError(): { hasError: boolean; }; contextType?: React.Context; }; export default errorBoundary;