Skip to content
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

feat: generic types for getQuery and parseQuery #131

Merged
merged 8 commits into from
Jul 28, 2023
Merged

Conversation

oleghalin
Copy link
Contributor

I made very simple generic types for getQuery, maybe something different should be done, let me know.

Also fixed QueryValue to be compatible with boolean too, which resolved type errors in query.test.ts

@oleghalin oleghalin changed the title feat: generic types for getQuery util. feat: generic types for getQuery util Mar 3, 2023
src/query.ts Outdated Show resolved Hide resolved
src/utils.ts Outdated Show resolved Hide resolved
@pi0 pi0 requested a review from danielroe March 13, 2023 10:56
oleghalin and others added 2 commits March 13, 2023 12:06
Co-authored-by: pooya parsa <[email protected]>
Co-authored-by: pooya parsa <[email protected]>
Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. But I think we need a more restrictive type for the return value of parseQuery and getQuery (maybe in a subsequent PR - it's not a result of this one). I don't think we'll ever get number/boolean out from it, for example.

@codecov
Copy link

codecov bot commented Mar 13, 2023

Codecov Report

Merging #131 (3acef09) into main (5bb737f) will increase coverage by 0.05%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
+ Coverage   94.63%   94.69%   +0.05%     
==========================================
  Files           7        7              
  Lines         802      811       +9     
  Branches      170      170              
==========================================
+ Hits          759      768       +9     
  Misses         43       43              
Files Changed Coverage Δ
src/query.ts 97.29% <100.00%> (+0.28%) ⬆️
src/utils.ts 99.10% <100.00%> (+<0.01%) ⬆️

@danielroe
Copy link
Member

Pushed some changes along those lines - feel free to revert or change if I've misssed anything 🙏

@danielroe danielroe requested a review from pi0 March 13, 2023 16:39
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ❤️

@pi0 pi0 changed the title feat: generic types for getQuery util feat: generic types for getQuery and parseQuery Jul 28, 2023
@pi0 pi0 merged commit 716cf8d into unjs:main Jul 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants