Skip to content

Commit 62fe62c

Browse files
committed
fix: [ErrorBoundary] update FallbackProps
1 parent 05d9eeb commit 62fe62c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/components/ErrorBoundary/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import React from 'react';
22

3-
export type ErrorBoundaryState = {
3+
export interface ErrorBoundaryState {
44
error: Error | null;
55
errorInfo: React.ErrorInfo | null;
6-
};
6+
}
77

8-
type FallbackProps = ErrorBoundaryState;
8+
interface FallbackProps {
9+
error: Error;
10+
errorInfo: React.ErrorInfo;
11+
}
912

1013
export type ErrorBoundaryProps = {
1114
FallbackComponent?: React.ComponentType<FallbackProps>;
@@ -39,7 +42,7 @@ export class ErrorBoundary extends React.Component<
3942

4043
if (errorInfo) {
4144
if (FallbackComponent) {
42-
return <FallbackComponent error={error} errorInfo={errorInfo} {...rest} />;
45+
return <FallbackComponent error={error!} errorInfo={errorInfo} {...rest} />;
4346
}
4447

4548
return null;

0 commit comments

Comments
 (0)