Skip to content

Commit

Permalink
fix(react): Add children prop type to ErrorBoundary component (#4966)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronaziz committed Apr 26, 2022
1 parent cafec74 commit 6824a7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/react/src/errorboundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type FallbackRender = (errorData: {
}) => React.ReactElement;

export type ErrorBoundaryProps = {
children?: React.ReactNode | (() => React.ReactNode);
/** If a Sentry report dialog should be rendered on error */
showDialog?: boolean;
/**
Expand Down Expand Up @@ -151,7 +152,7 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
}

if (typeof children === 'function') {
return children();
return (children as () => React.ReactNode)();
}
return children;
}
Expand Down

0 comments on commit 6824a7a

Please sign in to comment.