WinmezzZ/react-antd-admin

Module '"react-router"' has no exported member 'PartialRouteObject'

Closed this issue · 2 comments

ctk41 commented

When I run your project, then I got the errors bellow. Please check

TypeScript error in D:/18.React/react-antd-admin/src/routes/index.tsx(5,10):
Module '"react-router"' has no exported member 'PartialRouteObject'. TS2305

3 | import LoginPage from 'pages/login';
4 | import LayoutPage from 'pages/layout';

5 | import { PartialRouteObject } from 'react-router';
| ^
6 | import WrapperRouteComponent from './config';
7 | import { useRoutes } from 'react-router-dom';

Seems like a problem with the react-router-dom version being automatically upgraded.
There's two way to fix this.

  • Try to lock version of react-router-dom to 6.0.0-beta.0
    in package.json
{
"react-router-dom": "6.0.0-beta.0"
}
  • or use RouteProps insteadof PartialRouteObject

fixed in

import { RouteObject } from 'react-router';