AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
675 stars 30 forks source link

fix(types): Improve `get` method on `TinroRouterLocationQuery` #119

Closed sebastinez closed 1 year ago

sebastinez commented 2 years ago

Currently router.location.query.get(name?: string) return is defined as Record<string, string> | string.

But this can get confusing, since if passed a string we should receive a string, and only if no name is passed we should return the entire object as Record<string, string>

And if the property hasn't been set, we should also show that the return value could be undefined

So this updated type definition should help with that.