Closed grumd closed 5 months ago
Additional thoughts: from the TS perspective, working with an array of configs is difficult because of generics around Value type. An easier approach in terms of TS would be API like this:
withSlices(countSlice).and(textSlice);
Hmm, I'm not sure if people like it. I'm neutral or a bit negative.
But as always, the question is do I want to think typescript-first, or api-first? Or is it possible to prioritize both at the same time?
Yeah, well, my proposition is Zustand API is API-first (and then we have mutator hacks), and Jotai API is TS-first.
So, for now,
withSlices(countSlice, textSlice);
seems good. But, I can change my mind with user feedback in the future.
Additional thoughts: from the TS perspective, working with an array of configs is difficult because of generics around Value type. An easier approach in terms of TS would be API like this:
Which also means that you can get rid of "createSlice"
Any pipe-type API like this would be way more robust and easy to write in TS.
But as always, the question is do I want to think typescript-first, or api-first? Or is it possible to prioritize both at the same time?