Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

replaceQueryInUrl update function parameter should be ParsedUrlQuery, not ParsedUrlQueryInput #12

Open
OliverJAsh opened this issue Dec 26, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@OliverJAsh
Copy link
Member

OliverJAsh commented Dec 26, 2020

When replaceQueryInUrl is called with an update function, we first parse the URL and then pass the parsed URL's query into the update function.

This type of this query will always be ParsedUrlQuery, never ParsedUrlQueryInput (which is wider as it includes boolean/number as well as string).

ParsedUrlQueryInput should only be used for the update function's return type. This is for convenience, so that the user may rely on coercion of query parameters with a type of boolean/number.

The reason I had to make replaceQueryInUrl receive the wider type ParsedUrlQueryInput is because it is implemented using the parsed URL variant of this function—replaceQueryInParsedUrl—and this variant must use the same type in the parameter/return type positions so that it can be chained with other functions (example).

https://crewlabs.slack.com/archives/C0STWEZ2B/p1606837844221800

Note this issue would be made redundant by the fix for #15, since those new APIs don't have separate input/output types.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant