Skip to content

Commit

Permalink
fix: [ErrorBoundary] update FallbackProps
Browse files Browse the repository at this point in the history
  • Loading branch information
akai committed Jan 18, 2021
1 parent 05d9eeb commit 62fe62c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import React from 'react';

export type ErrorBoundaryState = {
export interface ErrorBoundaryState {
error: Error | null;
errorInfo: React.ErrorInfo | null;
};
}

type FallbackProps = ErrorBoundaryState;
interface FallbackProps {
error: Error;
errorInfo: React.ErrorInfo;
}

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

if (errorInfo) {
if (FallbackComponent) {
return <FallbackComponent error={error} errorInfo={errorInfo} {...rest} />;
return <FallbackComponent error={error!} errorInfo={errorInfo} {...rest} />;
}

return null;
Expand Down

0 comments on commit 62fe62c

Please sign in to comment.