I\'m trying to use react router with TypeScript. However, I have certain problems using withRouter function. On the last line, I\'m getting pretty weird error:
A
+1 for Ramon's answer. You can absolutely get full type coverage here. To add a bit - I added the call to withRouter.
interface FooProps extends RouteComponentProps {
foo: string;
}
const Foo = ({ history, foo }: FooProps) => ;
const RoutedFoo = withRouter(Foo);
my dependencies:
"@types/react-router-dom": "^4.3.0",
"typescript": "^2.9.2",