1.0.6 • Published 3 years ago

rd-redux-utils v1.0.6

Weekly downloads
50
License
MIT
Repository
github
Last release
3 years ago

defineAction

defineAction<TActionData> - allows to define a simple action creator which produces actions with specified props.

const MyAction = defineAction<{ value: number; }>("MY ACTION");

Now action creator could be used for creating actions:

const actionInstance = MyAction({ value: 123 });
console.log(actionInstance.value); // Outputs 123

Also action creator could be used for checking actions for conforming a type:

const action: Action = ...
if (MyAction.is(action)) {
    console.log(action.value); // action variable type now shrinked to { type: string; value: number }
}
1.0.6

3 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago