Skip to content

Conversation

tim-we
Copy link

@tim-we tim-we commented Feb 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant