-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix improper type inference in hooks. #80
Comments
Yeah sounds like your assessment of the issue is right. I'm guessing it might work when you annotate the response like this:
One module per hook could help.. other ideas:
|
I agree with the common For the type inference to work with |
I opened up a PR with the suggestion of a new type for hooks response: #81 |
:chefs-kiss: You two are literally the best OSS contributors I've ever worked with ❤️. I'm going to check internally about getting you write access to the repo so you can push branches directly, which I think will make it easier to test and verify one another's changes locally. |
cc/ @gugahoa @Schmavery I'm not totally sure how to fix this one, so reaching out for help.
In
examples/2-query
inMonster.re
, change L37 from this:to this:
and add this at the top:
When doing this, I get an interesting type error:
I'm not totally sure why this is happening. I'm wondering if Reason is searching for the record type associated with the destrucutred
{ response }
and it's saying, "Hey, that record istype useSubscriptionResponse
" That's my best guess. If so, I'm thinking we may need to do one-offmodule UseQuery = UrqlUseQuery;
such that only the definitions fromUrqlUseQuery
are brought into scope and the proper record typeuseQueryResponse
is inferred. Any other thoughts? I also tried adding a top-leveltype hookReponse('ret)
since our hooks have consistent return structures, but I got an error w/ theuseSubscription
GADT b/ctype ret
there would escape its scope.The text was updated successfully, but these errors were encountered: