Skip to content

Commit 6824a7a

Browse files
authored
fix(react): Add children prop type to ErrorBoundary component (#4966)
1 parent cafec74 commit 6824a7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export type FallbackRender = (errorData: {
2020
}) => React.ReactElement;
2121

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

153154
if (typeof children === 'function') {
154-
return children();
155+
return (children as () => React.ReactNode)();
155156
}
156157
return children;
157158
}

0 commit comments

Comments
 (0)