I have a normal route
function LoginPage(props: RouteComponentProps): React.ReactElement {...
}
that uses RouteComponentProps
I benefitted from @Oliver Joseph Ash answer but somehow I did not have access to StaticContext
perhaps because I use connected-react-router
and it has no exported member but I did not dive deep.
I created a mock type like so:
import { RouteComponentProps } from 'react-router-dom';
type LocationState = {
// ... type of members passed to state
};
type MockType = {
[key: string]: string | undefined;
};
type TypeWithLocationState = RouteComponentProps;
This worked for me.