4 ms·
> testing types Right, this happens in any language where you are writing type lambdas or functions at type level, which makes sense actually. We've been doing
by throwaway247322 4y ago
> testing types
Right, this happens in any language where you are writing type lambdas or functions at type level, which makes sense actually. We've been doing this in C++ as well for years...
On another note, Redux is fundamentally a bad experience in typescript because the action type must extend from `AnyAction`, so it poisons the well.
What we need is a first-class typescript state container with a rigid API, even better would be first-class enums and pattern matching...
Writing generators isn't fun in typescript, so yes I imagine redux-saga would be painful.
- acemarke 4y agoNote that our official Redux Toolkit package, linked in the article, has complex TS types specifically _because_ we work to simplify the TS usage experience for our users. Here's all you need to do as a typical Redux app developer to get started using Redux Toolkit with TypeScript: - https://redux.js.org/tutorials/typescript-quick-start https://redux.js.org/tutorials/typescript-quick-start Note that we specifically tell you to use a `PayloadAction<MyPayloadHere>` type, which results in well-typed reducers and automatically generates strongly-typed action creators to match. If you're using Redux at all, you _should_ be using Redux Toolkit to write your Redux logic.