I'm trying to get set up with react-router using Typescript in a way which accepts a parameter.
In my render element I have
<Route path="/show/:id" component={TestComp} />
And I define TestComp as
const TestComp = ({ match }) => (
<div>
<h2>Showing specified ID: {match.params.id}</h2>
</div>
)
However, VS Code underlines the match parameter (in the declaration of TestComp) and tells me
Binding element 'match' implicitly has an 'any' type.
and it fails to compile.
Can anyone tell me as what type match should be declared? I've tried RouteProps but that doesn't work either. Looking in the index.d.ts, I think it's defined as match<P> but I'm not sure how to declare a parameter as being of a generic type.
UPDATE
Based on the comments to @TarasPolovyi's answer, I've added the following:
As you can see, this still has problems.
