Closed joshburgess closed 6 years ago
Could you maybe sketch out how you'd like to be able to configure this?
I actually don't really have any sort of solution off the top of my head. I would need to familiarize myself with how the library works and think about it a bit, I think.
Closing this because I misunderstood something about the library and this issue is not relevant anymore.
While testing the viability of using unionize for actions & reducers in an existing Redux app, I discovered that, despite being able to alias
tag
astype
andvalue
aspayload
, to provide a bit of Redux-compatibility, there is no real way to handle being able to adderror
andmeta
keys on the same level aspayload
.You could, of course, lump those keys under your
value
/payload
property and then use some extra mapping step to extract those things out & create an FSA style action object, but that takes away from a lot of the convenience & nicety of using a solution like unionize.Is there anyway around this?
Somewhat unrelated, but I'm also curious about the viability of approaching a library like this that doesn't rely on records but instead allows the type constructors for each member of the union to accept multiple arguments. I'm thinking along the lines of something like the way
daggy
works, but typed with TS. Any thoughts on this? Any caveats that would make it very difficult/not possible?