Skip to content

withSentryRouting react-router v5 typing issue #3550

@soullivaneuh

Description

@soullivaneuh

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

6.4.0

Description

Creating a custom Route component using Sentry as described on the documentation:

import {
  Route as BaseRoute
} from 'react-router-dom';
import {
  withSentryRouting,
} from '@sentry/react';

export const Route = withSentryRouting(BaseRoute);

export default null;

Give me the following Typescript error:

Argument of type 'typeof Route' is not assignable to parameter of type 'ComponentType<RouteProps & Record<string, any>>'.
  Type 'typeof Route' is not assignable to type 'ComponentClass<RouteProps & Record<string, any>, any>'.
    Types of parameters 'props' and 'props' are incompatible.
      Type 'RouteProps & Record<string, any>' is not assignable to type '(RouteProps<any, { [x: string]: string | undefined; }> & OmitNative<any, keyof RouteProps<string, { [x: string]: string | undefined; }>>) | Readonly<RouteProps<any, { ...; }> & OmitNative<...>>'.
        Type 'RouteProps & Record<string, any>' is not assignable to type 'Readonly<RouteProps<any, { [x: string]: string | undefined; }> & OmitNative<any, keyof RouteProps<string, { [x: string]: string | undefined; }>>>'.
          Types of property 'location' are incompatible.
            Type 'Location | undefined' is not assignable to type 'Location<unknown> | undefined'.
              Type 'Location' is not assignable to type 'Location<unknown> | undefined'.
                Type 'Location' is missing the following properties from type 'Location<unknown>': search, state, hashts(2345)

     6 | } from '@sentry/react';
     7 | 
  >  8 | export const Route = withSentryRouting(BaseRoute);
       |                                        ^
     9 | 
    10 | export default null;
    11 |

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions