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
This is a Typescript typings issue. Since withRouter() will provide the routing props you need at runtime, you want to tell consumers that they only need to specify the other props. In this case, you could just use a plain ComponentClass:
export default withRouter(connectModule) as React.ComponentClass<{}>;
Or, if you had other props (defined in an interface called OwnProps) you wanted to pass in, you could do this:
export default withRouter(connectModule) as React.ComponentClass;
There is slightly more discussion here