piotrwitek / typesafe-actions

Typesafe utilities for "action-creators" in Redux / Flux Architecture
https://codesandbox.io/s/github/piotrwitek/typesafe-actions/tree/master/codesandbox
MIT License
2.41k stars 98 forks source link

Add error property to action #119

Closed sjsyrek closed 5 years ago

sjsyrek commented 5 years ago

Thank you for your contribution! :thumbsup:

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

Related issues: https://github.com/piotrwitek/typesafe-actions/issues/116

For bugfixes:

For new feature:

sjsyrek commented 5 years ago

@piotrwitek First draft. I was trying to order the function overloads correctly, but it has been non-obvious to me what counts as most specific, etc. If it's not obvious, I'm rather new to TypeScript and in the process of migrating a code base over from Flow (which is how I found this library to begin with). So I appreciate your help and patience here.

I didn't update the docs in this PR yet. I was planning to do that in a separate PR and include further proofreading changes. The next step will be figuring out createAction but that can be a separate PR, if you prefer. The intended distinction between createAction and createStandardAction is still a bit fuzzy to me.

piotrwitek commented 5 years ago

@sjsyrek After above few review comments should be good to merge

piotrwitek commented 5 years ago

The intended distinction between createAction and createStandardAction is still a bit fuzzy to me.

Good that you have mentioned that. The core distinction is really the preference of the user to use generic type arguments (similar to redux-actions) or more inference driven approach, where types are inferred solely from function signature (args and returned object). With another limitation for the generic approach allowing only 2 predefined args in resulting action-creators.

sjsyrek commented 5 years ago

@piotrwitek Should be good now

piotrwitek commented 5 years ago

Thanks @sjsyrek for adding a great new feature!