solidjs / solid-router

A universal router for Solid inspired by Ember and React Router
MIT License
1.13k stars 143 forks source link

[Bug]: `useSearchParams<{foo: string;}>` generic should pass through `Partial<>` #329

Closed devinrhode2 closed 8 months ago

devinrhode2 commented 1 year ago

Duplicates

Latest version

Current behavior 😯

Calling useSearchParams<{foo: string}> should make the returned searchParams type { foo?: string }. This is because we never know what kind of query params somebody will actually send.

Expected behavior 🤔

See previous

Steps to reproduce 🕹

assert that ReturnType<typeof useSearchParams<{ foo: 'foo';}>>[0] has type string | undefined

Context 🔦

No response

Your environment 🌎

No response