-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feature(data): add types to dispatch and select #49930
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
Conversation
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @johnhooks! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
|
Awesome, thank you! I‘ll give this a try as soon as I am back from vacation. I think after this, thunks are the remaining main thing still without proper types. |
d1b5930 to
59a9957
Compare
|
This seems to work well in my project 👍 |
|
@swissspidy that's awesome. This is my very first PR to Gutenberg that has had an "approved" review! I'm really new to this, what is the next step? |
|
Normally I would just merge the PR, but since I am not super familiar with the |
adamziel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
|
I'm so pumped, my first ever PR merged into Gutenberg 🎉 |
What?
Add TypeScript types to
dispatchandselectof@wordpress/data.Why?
I and others are using these function with custom stores and would like to use them fully typed. I am currently hacking the type system to accomplish this in the
wp-feature-notificationsproject, but it would be better if these were typed correctly.How?
I moved the functions to individual TypeScript files because I couldn't provide the correct generic arguments in the
index.jsfile like inuseSelectbecause the types would be exports from packages with the generic arguments. Moving them to a separate file solved this issue, I made them individual files because it seemed appropriate.@swissspidy @adamziel @dmsnell
Issues
The automatically built docs don't appropriately show the generic type arguments.