We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4febe6f commit 254903eCopy full SHA for 254903e
src/createAction.ts
@@ -11,15 +11,17 @@ export function clearRegistry() : any {
11
actionsRegistry.clear();
12
}
13
14
-export default function createAction(type: string, paramsCreator: paramsCreator = () => ({})): any {
+const defaultTransform = (...args) => ({ ...args });
15
+
16
+export default function createAction(type: string, transform = defaultTransform): any {
17
if (actionsRegistry.has(type)) {
18
throw `Duplicate action ${type}`;
19
} else {
20
actionsRegistry.add(type);
21
22
23
const actionCreator = (...args) => {
- const params = paramsCreator(...args);
24
+ const params = transform(...args);
25
if ('type' in params) {
26
console.warn('Property type is reserved by action');
27
0 commit comments