Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Create ActionUnion #41

Merged
merged 3 commits into from
Nov 21, 2018
Merged

Create ActionUnion #41

merged 3 commits into from
Nov 21, 2018

Conversation

codeBelt
Copy link
Owner

@ccheney @n8rzz what do you think of this change?

@codeBelt codeBelt added question WIP Work In Progress labels Nov 21, 2018
@codeBelt codeBelt requested review from ccheney and n8rzz November 21, 2018 03:55
Copy link
Collaborator

@n8rzz n8rzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the union type, I'm sure that makes things a little easier to trace (even in webstorm). I am a little curious about why you moved the static methods back to within the switch statement? That will probably make testing these reducers just a little more difficult.

@codeBelt
Copy link
Owner Author

@n8rzz The static methods are private so you wouldn't test those. The only thing I was testing was to make sure the static methods in the reducer had the same action payload type as the action. With the union you now have to tell TypeScript what the payload type is.

currentUser: action.payload as UserModel,

@codeBelt codeBelt merged commit d41c3e8 into master Nov 21, 2018
@codeBelt codeBelt deleted the action-refactor branch November 21, 2018 16:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question WIP Work In Progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants