react-router-last-location icon indicating copy to clipboard operation
react-router-last-location copied to clipboard

Missing type dependency

Open marcelkooi opened this issue 5 years ago • 2 comments

I was getting the following error when running tsc --project tsconfig.json after adding react-router-last-location.

$ tsc --project tsconfig.json
node_modules/react-router-last-location/dist/LastLocationProvider.d.ts:14:179 - error TS2694: Namespace '"/Users/sidecar/repos/connect-ui/node_modules/@types/react-router/index"' has no exported member 'WithRouterStatics'.

14 }, "watchOnlyPathname">, "location" | "history" | "match" | "staticContext" | "children" | "watchOnlyPathname">, "children" | "watchOnlyPathname">, any> & import("react-router").WithRouterStatics<React.ComponentClass<Pick<Pick<Pick<Props, "location" | "history" | "match" | "staticContext" | "children">, "location" | "history" | "match" | "staticContext" | "children"> & Pick<{
                                                                                                                                                                                     ~~~~~~~~~~~~~~~~~

node_modules/react-router-last-location/dist/withLastLocation.d.ts:7:482 - error TS2694: Namespace '"/Users/sidecar/repos/connect-ui/node_modules/@types/react-router/index"' has no exported member 'WithRouterStatics'.

7 declare const withLastLocation: <WrappedProps extends WithLastLocationProps>(WrappedComponent: React.ComponentType<WrappedProps>) => React.ComponentClass<import("react-router").Omit<Pick<WrappedProps, import("./types").SetDifference<keyof WrappedProps, "location" | "lastLocation" | "history" | "match" | "staticContext">> & RouteComponentProps<{}, import("react-router").StaticContext, any>, "location" | "history" | "match" | "staticContext"> & {}, any> & import("react-router").WithRouterStatics<React.FunctionComponent<Pick<WrappedProps, import("./types").SetDifference<keyof WrappedProps, "location" | "lastLocation" | "history" | "match" | "staticContext">> & RouteComponentProps<{}, import("react-router").StaticContext, any>>>;

The fix was to update @types/react-router to 5.0.3.

marcelkooi avatar Aug 16 '19 17:08 marcelkooi

same problem, same solution, thanks @marcelkooi . actually I needed to update lots of @types/react-* things after doing that too

ekilah avatar Aug 21 '19 00:08 ekilah

@marcelkooi I know it's quite old issue but a small reproduction repo would be helpful. Maybe types generated with react-router 5.0.1 are different than newer version of react-router-dom nowadays.

hinok avatar Feb 15 '20 13:02 hinok