Skip to content

Getting Typescript errors when upgrading to React 18 #4904

@gxxcastillo

Description

@gxxcastillo

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/react

SDK Version

6.19.6

Framework Version

6.19.6

Link to Sentry event

No response

Steps to Reproduce

Hi, I've started getting the following Typescript errors in my build. It seems it has to do with ErrorBoundaryProps not having a children property declared. Adding children: React.ReactNode to ErrorBoundaryProps fixed the issue for me.

DefinitelyTyped/DefinitelyTyped#46691

Expected Result

Typescript errors should not occur when React.ErrorBoundary has children

Actual Result

No overload matches this call.
  Overload 1 of 2, '(props: ErrorBoundaryProps | Readonly<ErrorBoundaryProps>): ErrorBoundary', gave the following error.
    Type '{ children: Element; fallback: Element; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ErrorBoundary> & Readonly<ErrorBoundaryProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ErrorBoundary> & Readonly<ErrorBoundaryProps>'.
  Overload 2 of 2, '(props: ErrorBoundaryProps, context: any): ErrorBoundary', gave the following error.
    Type '{ children: Element; fallback: Element; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ErrorBoundary> & Readonly<ErrorBoundaryProps>'.
      Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ErrorBoundary> & Readonly<ErrorBoundaryProps>'

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions