Closed piotrwitek closed 6 years ago
Fixed bug in createAction
and added consistent behaviour throughout the entire API surface:
From now on you can do:
const action = (meta: string) => action(undefined, meta);
action('token'); // { type: 'WITH_META', meta: 'token' }
const action2 = createAction('WITH_META', resolve => {
return (meta: string) => resolve(undefined, meta);
});
action2('token'); // { type: 'WITH_META', meta: 'token' }
const action3 = createStandardAction('WITH_META').map(
(meta: string) => ({ meta })
);
action3('token'); // { type: 'WITH_META', meta: 'token' }
const action4 = createStandardAction('WITH_META')<void, string>();
action4(undefined, 'token'); // { type: 'WITH_META', meta: 'token' }
Added missing test scenario for createAction when payload is undefined and only meta should be returned. Test case: