我正在开发一个使用 React + coreui 开发的项目,该项目一直运行良好。然而,上周我在部署修改时遇到了一个莫名其妙的问题。
18:03:11 Creating an optimized production build...
18:04:32 Failed to compile.
18:04:32
18:04:32 /var/lib/jenkins/workspace/deploy-sandbox/src/AppRouter.tsx
18:04:32 Type error in /var/lib/jenkins/workspace/deploy-sandbox/src/AppRouter.tsx(47,6):
18:04:32 'Router' cannot be used as a JSX component.
18:04:32 Its instance type 'BrowserRouter' is not a valid JSX element.
18:04:32 The types returned by 'render()' are incompatible between these types.
18:04:32 Type 'React.ReactNode' is not assignable to type 'import("/var/lib/jenkins/workspace/deploy-sandbox/node_modules/@types/react-transition-group/node_modules/@types/react/index").ReactNode'. TS2786
18:04:32
18:04:32 45 |
18:04:32 46 | return (
18:04:32 > 47 | <Router>
18:04:32 | …Run Code Online (Sandbox Code Playgroud)