Package + Version
Version:
Description
fallback props from ErrorBoundary is defined as
...
error: Error;
componentStack: string | null;
eventId: string | null;
...
When fallback is called, eventId and componentStack cannot be null because error is not null and error, eventId, componentStack are set at the same time.
Proper types:
...
error: Error;
componentStack: string | null;
eventId: string | null;
...
Instead of:
// https://github.com/getsentry/sentry-javascript/blob/6.15.0/packages/react/src/errorboundary.tsx#L131
fallback({ error, componentStack, resetError: this.resetErrorBoundary, eventId });
it should be:
fallback({ error, componentStack!, resetError: this.resetErrorBoundary, eventId! });
because you know eventId and componentStack are not null.
Package + Version
@sentry/reactVersion:
Description
fallbackprops fromErrorBoundaryis defined asWhen
fallbackis called,eventIdandcomponentStackcannot be null becauseerroris not null anderror,eventId,componentStackare set at the same time.Proper types:
Instead of:
it should be:
because you know
eventIdandcomponentStackare not null.