Socket
Socket
Sign inDemoInstall

ts-redux-actions

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta2 to 1.0.0-beta3

2

package.json
{
"name": "ts-redux-actions",
"version": "1.0.0-beta2",
"version": "1.0.0-beta3",
"description": "Typed Redux Actions for TypeScript Projects",

@@ -5,0 +5,0 @@ "author": "Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)",

# TS Redux Actions
> Redux helpers for Type-safety (action types & action creators)
> Typed Redux Action Creators for TypeScript

@@ -15,2 +15,3 @@ From now on no type errors will sneak in unnoticed through your action creators!

- [Installation](#installation)
- [Motivation](#motivation)

@@ -24,10 +25,26 @@ - [Usage](#usage)

## Installation
For NPM users
```bash
$ npm install --save ts-redux-actions
```
For Yarn users
```bash
$ yarn add ts-redux-actions
```
---
## Motivation
I wasn't satisfied with the API design in [redux-actions](https://redux-actions.js.org/). The reason was because of the specific API design (allowing multiple args for action creator) and separate payload, meta map functions which is not good for static typing in TypeScript.
It doesn't allow for correct type inference and it will force you to do an extra effort for explicit type annotations and produce more boilerplate.
I wasn't satisfied with the API design in [redux-actions](https://redux-actions.js.org/) because of separate payload & meta map callback functions.
It doesn't allow for correct type inference when using TypeScript and it will force you to do an extra effort for explicit type annotations and probably result in more boilerplate when trying to work around it.
The most issues with `redux-actions` types and similar solutions are related to losing your function definition inference and intellisense (named arguments and arity) in resulting action creator function which for me is unacceptable.
The other common issue with `redux-actions` types and similar solutions are related to losing your function definition type inference and intellisense (named arguments and arity) in resulting "action creator" function which for me is unacceptable.
As a bonus you can use a convenient `type` static property on every action creator for reducer switch case scenarios (working with narrowing of union types):
As a bonus there is a convenient `type` static property on every action creator for common reducer switch case scenarios (working with narrowing of union types):
```ts

@@ -34,0 +51,0 @@ const increment = createAction('INCREMENT');

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc