-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A wrapper with Typescript #6
Comments
Thank you very much for this, master branch is refactored all to typescript now and released at version 2.4.4. |
I would say the typescript from this issue has better type-inference than your newly refactored TS code. Moreover, this issue's code has a slightly different (better, more concise) API than the package, I think it's worth leaving this issue opened until the original package fully covers or is fully better than the issue. wdyt? About the release, I think you better off release minor version upgrade instead of patch version. Thank you for the work btw, I really appreciate it. |
Your wrapper does not cover my case where |
Here is a Typescript wrapper around this package I write for my project (with a very good type-inference). The API has changed a little bit (
initial
andtypes
are now combined into 1 param calledinitialOrType
for more concise syntax).Usage
Now, the initial URLSearchParams is
?name=loi&handsome=true
, with the type ofparams
to beOr, if you want to take full advantage of typescript to narrow the type:
Now the type of
params
becomesOr you can mix initial params with types (in case not all types have initial params) and still narrow the type:
will result in the same type as the example above.
File
(I will update immediately here if there's any bug)
useUrlSearchParams.ts
The text was updated successfully, but these errors were encountered: