preactjs / preact-router

:earth_americas: URL router for Preact.
http://npm.im/preact-router
MIT License
1.01k stars 156 forks source link

Don't make component's props in <Route /> wrapper optional #466

Closed zlondrej closed 4 months ago

zlondrej commented 4 months ago

Using TypeScript made me use <Route /> wrapper, but it makes all the component's props optional. That kinda goes against the idea of using TypeScript in the first place.

rschristian commented 4 months ago

This looks to be intentional: https://github.com/preactjs/preact-router/pull/211

zlondrej commented 4 months ago

I saw the commit before, but didn't understand the explanation at first. Mostly because I'm making a simple application that doesn't deal with path/query parameters.

After a second look, I still don't like it, but at least it makes some sense.

rschristian commented 4 months ago

There very well might be a better way to deal with that, I'm not a huge TS fan/user myself, just wanted to bring that up as it does seem to serve a legitimate purpose.

If you do know a better option than Partial, happy to have it here