Open parkerault opened 4 years ago
Hey @parkerault Thanks for sharing your ideas. It makes sense, I'll have to think about how to break it down and take out redux-observables from a core to make it a recipe instead. I need some time to get down to this as I have scheduled some other work in my other OSS projects.
First of all, thanks for all the hard work you've put into this fantastic guide; if I had tried to migrate my team's codebase to typescript without
typsafe-actions
it would have turned into a total dumpster fire. Having end-to-end type data for the redux store makes the entire application such a breeze to work on. All that being said, I do have some gripes about the guide:It seems really odd that there's such a heavy emphasis on redux-observable. It's great that there is some guidance for people that are using it, but in my experience it's a pretty uncommon middleware. It would be much less frustrating for typescript novices if the documentation was limited to redux-thunk, as that's pretty much the bare bones vanilla redux stack. I've been following the guide and I'm stuck on trying to create the store with the dispatch function constrained to the RootAction type, and my web searches have only turned up a bunch of outdated, garbage blog posts. The lack of typescript examples is of course a huge flaw in the official redux documentation, but since this repository is the de facto guide to type-safe react, it would be much easier to follow if the examples used a very basic store configuration. It would be great to include examples with redux saga and redux observable in the recipes, but it clutters up the basic examples, which should ideally be something that anyone can copy and paste to get a store set up quickly. This applies to the playground as well. As it stands:
I think it would be better to limit this to what we've already seen in the guide:
Now there's nothing in there to distract from the purpose of the guide, which is learning how to use redux without losing type information. Unfortunately, when setting up the store this way, it has an
AnyAction
constraint ondispatch
:Store<RootState, AnyAction>
. I can't figure out how to get a store instance withdispatch
constrained toRootAction
. Thanks again for all the great work you've done.