Skip to content

Commit 3a96b23

Browse files
authored
feat: Support exactOptionalPropertyTypes on ErrorBoundary (#9098)
1 parent 85a494a commit 3a96b23

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/react/src/errorboundary.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export type FallbackRender = (errorData: {
2323
export type ErrorBoundaryProps = {
2424
children?: React.ReactNode | (() => React.ReactNode);
2525
/** If a Sentry report dialog should be rendered on error */
26-
showDialog?: boolean;
26+
showDialog?: boolean | undefined;
2727
/**
2828
* Options to be passed into the Sentry report dialog.
2929
* No-op if {@link showDialog} is false.
3030
*/
31-
dialogOptions?: ReportDialogOptions;
31+
dialogOptions?: ReportDialogOptions | undefined;
3232
/**
3333
* A fallback component that gets rendered when the error boundary encounters an error.
3434
*
@@ -37,17 +37,17 @@ export type ErrorBoundaryProps = {
3737
* the error, the component stack, and an function that resets the error boundary on error.
3838
*
3939
*/
40-
fallback?: React.ReactElement | FallbackRender;
40+
fallback?: React.ReactElement | FallbackRender | undefined;
4141
/** Called when the error boundary encounters an error */
42-
onError?(error: Error, componentStack: string, eventId: string): void;
42+
onError?: ((error: Error, componentStack: string, eventId: string) => void) | undefined;
4343
/** Called on componentDidMount() */
44-
onMount?(): void;
44+
onMount?: (() => void) | undefined;
4545
/** Called if resetError() is called from the fallback render props function */
46-
onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void;
46+
onReset?: ((error: Error | null, componentStack: string | null, eventId: string | null) => void) | undefined;
4747
/** Called on componentWillUnmount() */
48-
onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void;
48+
onUnmount?: ((error: Error | null, componentStack: string | null, eventId: string | null) => void) | undefined;
4949
/** Called before the error is captured by Sentry, allows for you to add tags or context using the scope */
50-
beforeCapture?(scope: Scope, error: Error | null, componentStack: string | null): void;
50+
beforeCapture?: ((scope: Scope, error: Error | null, componentStack: string | null) => void) | undefined;
5151
};
5252

5353
type ErrorBoundaryState =

0 commit comments

Comments
 (0)