feature(data): add types to dispatch and select#49930
feature(data): add types to dispatch and select#49930adamziel merged 2 commits intoWordPress:trunkfrom
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 |
|
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.