3 ms·
Agreed. I updated the blog to add an example. Copy/pasting here: I spend a decent amount of time in the redux world so `redux-toolkit` is a great library to
by qudat 4y ago
Agreed. I updated the blog to add an example. Copy/pasting here:
I spend a decent amount of time in the redux world so `redux-toolkit` is a great
library to see how types are done *correctly* in a real codebase. To be clear,
they do a fantastic job with types, but the level of complexity is pretty
startling.
https://github.com/reduxjs/redux-toolkit/blob/master/packages/toolkit/src/createAction.ts#L58 https://github.com/reduxjs/redux-toolkit/blob/master/package...
That is just one example but the codebase is riddled with complex types. Also,
when you look around, note the amount of types vs actual code.
It's pretty common in style guides to never nest ternaries. In typescript,
that's the only way to narrow types based on other types. It's a mess!
- shadowofneptune 4y agoThank you.
- nkingsy 4y agoAlong the lines of "just use a dynamic language", we use unknown and any type for a lot of our internal stuff like this. Strongly typed shell, whatever works core.