Fix types when using select with queries #14
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently when select transforms data shape(say, you fetch an array but then use select to get its length) - typescript will complain that select's return type is incompatible with data type.
This PR addressed that - now if you don't use select the type will be kept as is from procedure output. If you do - query data property type will be of whatever is returned by select function
Also fixed key type a little bit - it doesn't get inferred literally even tho theoretically that's doable(user.reviews.findAll -> [['user','reviews','findAll']] can be done), but at least it's of your QueryKey type instead of unknown now.
Also closes #10 - infinite queries now return correct type with page and page params and also next page parameter gets inferred correctly from cursor instead of unkown.