preact-router
preact-router copied to clipboard
Add types to the Match function
When using preact-router with TypeScript (and strict settings) you had to explicitly type the function passed as a child to the Match component like this:
<Match path="/">{({ url }: {url: string}) => <pre>{url}</pre>}</Match>
This PR overrides the type of the children property of the Match component to provide the required types. You can now use the component as intended, even in strict mode:
<Match path="/">{({ url }) => <pre>{url}</pre>}</Match>
I also removed unused imports in match/index.d.ts and test/match.tsx.