Skip to content

Commit d43952c

Browse files
committed
fix(react): Make fallback render types more accurate
1 parent 4c07d02 commit d43952c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export const UNKNOWN_COMPONENT = 'unknown';
1313

1414
export type FallbackRender = (errorData: {
1515
error: Error;
16-
componentStack: string | null;
17-
eventId: string | null;
16+
componentStack: string;
17+
eventId: string;
1818
resetError(): void;
1919
}) => React.ReactElement;
2020

@@ -138,7 +138,14 @@ class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundarySta
138138
if (error) {
139139
let element: React.ReactElement | undefined = undefined;
140140
if (typeof fallback === 'function') {
141-
element = fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });
141+
element = fallback({
142+
error,
143+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
144+
componentStack: componentStack!,
145+
resetError: this.resetErrorBoundary,
146+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
147+
eventId: eventId!,
148+
});
142149
} else {
143150
element = fallback;
144151
}

0 commit comments

Comments
 (0)