Skip to content

Types for ErrorBoundary fallback props seems wrong #4190

Description

@tkrotoff

Package + Version

  • @sentry/react

Version:

6.15.0

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#L131fallback({ 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions