MENSAJE DE ERROR Type '{ location: Location; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<RouteComponentProps<{}, StaticContext, UnknownFacade>, never>, any, any>> & Readonly<...> & Readonly<...>'. Property 'location' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<RouteComponentProps<{}, StaticContext, UnknownFacade>, never>, any, any>> & Readonly<...> & Readonly<...>'.
Type '{ location: Location<UnknownFacade>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<RouteComponentProps<{}, StaticContext, UnknownFacade>, never>, any, any>> & Readonly<...> & Readonly<...>'.
Property 'location' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Pick<RouteComponentProps<{}, StaticContext, UnknownFacade>, never>, any, any>> & Readonly<...> & Readonly<...>'. TS2322
8 | <Router>
9 | <Switch>
> 10 | <Route exact path='/' render={({location}) => <Visited location={location} />}/>
| ^
11 | <Route path='/admin' component={Admin} />
12 | </Switch>
13 | </Router>
COMPORTAMIENTO ESPERADO Que me compile sin tener que poner el tipo "any" a location
App.tsx
import React from 'react';
import {HashRouter as Router, Route ,Switch} from 'react-router-dom';
import Visited from '../modules/visited';
import Admin from '../modules/admin';
const App: React.FC = () => (
<Router>
<Switch>
<Route exact path='/' render={({location}) => <Visited location={location} />}/>
<Route path='/admin' component={Admin} />
</Switch>
</Router>
)
export default App;
Visited.tsx
import React from 'react';
import { Switch, Route, RouteComponentProps, withRouter } from 'react-router-dom';
import Home from './containers/home';
const Visited: React.FC<RouteComponentProps> = ({location}) => {
return (
<Switch location={location} key={location.pathname}>
<Route exact path="/" component={Home} />
</Switch>
)
}
export default withRouter(Visited);
location
en tu componente App?