I have installed ionic react with the default tabs, I did not add any package. When I launch the app I receive this error:
[react-scripts] TypeScript error in C:/Users/xxx/Documents/nodeJs-Apps/test-mobile-v1/src/App.tsx(42,11):
JSX element type 'Route<{ path: "/tab1"; component: FC<{}>; exact: true; }>' is not a constructor function for JSX elements.
The types returned by 'render()' are incompatible between these types.
[react-scripts] Type 'ReactNode' is not assignable to type 'false | Element | null'.
[react-scripts] Type 'undefined' is not assignable to type 'false | Element | null'. TS2605
[react-scripts] 41 | <IonRouterOutlet>
[react-scripts] 42 | <React.Fragment>
[react-scripts] > 43 | <Route path="/tab1" component={Tab1} exact={true} />
[react-scripts] | ^
[react-scripts] 44 | <Route path="/tab2" component={Tab2} exact={true} />
[react-scripts] 45 | <Route path="/tab3" component={Tab3} />
[react-scripts] 45 | <Route path="/" render={() => <Redirect to="/tab1" />} exact={true} />
In VS Route and Redirect is highlighting as if there is syntax error, and when hovered it shows this:
(alias) class Route<T extends RouteProps = RouteProps>
import Route
'Route' cannot be used as a JSX component.
Its instance type 'Route<{ path: "/tab1"; component: FC<{}>; exact: true; }>' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'ReactNode' is not assignable to type 'false | Element | null'.
Type 'undefined' is not assignable to type 'false | Element | null'.ts(2786)
If I comment out this:
<Route path="/tab1" component={Tab1} exact={true} />
<Route path="/tab2" component={Tab2} exact={true} />
<Route path="/tab3" component={Tab3} />
<Route path="/" render={() => <Redirect to="/tab1" />} exact={true} />
The app launchs. Perhaps the problem is with the Route
I have opened an Issue on github (https://github.com/ionic-team/ionic/issues/21109) , but I was advised to get help here. Any help?
my specs:
Version: 1.44.2 (user setup)
Commit: ff915844119ce9485abfe8aa9076ec76b5300ddd
Date: 2020-04-16T16:36:23.138Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18362
Ionic:
Ionic CLI : 6.6.0 (C:\Users\xxx\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 5.0.7
Capacitor:
Capacitor CLI : 2.0.1
@capacitor/core : 2.0.1
Utility:
cordova-res : 0.12.1
native-run : 1.0.0
System:
NodeJS : v12.14.1 (C:\Program Files\nodejs\node.exe)
npm : 6.14.4
OS : Windows 10