3 ms·
The primary issue I have with this article is that it points to redux-toolkit as having types that are done right. The same result of redux-toolkit create actio
by bblaylock 4y ago
The primary issue I have with this article is that it points to redux-toolkit as having types that are done right. The same result of redux-toolkit create actions (https://github.com/reduxjs/redux-toolkit/blob/4ab8c42cb20ae1e6f7b84a8ac0070eee54775b79/packages/toolkit/src/createAction.ts#L58 https://github.com/reduxjs/redux-toolkit/blob/4ab8c42cb20ae1...) can be made mush simpler (see https://gist.github.com/baetheus/2e16ad4118b6fcd45e45756780ebb22a https://gist.github.com/baetheus/2e16ad4118b6fcd45e45756780e...). The only real difference between these two implementations is the simpler one doesn't overload a single function with multiple strategies for datatype creation.
In my opinion, our industry is not generally exposed to type level programming or dependent types. As a result there are many popular APIs (redux, redux-toolkit, react, vue, jquery) that implement variadic and generic interfaces with many overlapping options on single functions. If the types for these interfaces had been written (or long considered) before being published then the authors' might have noticed how complicated they are at the outset and perhaps decided to solve the simpler problems first and build the complexity slowly.
"It is a poor workperson that blames her tools"