Skip to content

Releases: piotrwitek/typesafe-actions

v5.1.0

05 Nov 22:57
Compare
Choose a tag to compare

Breaking changes

  1. In v5 all the deprecated v4 creator functions are available under deprecated named import to help with incremental migration.
// before
import { createAction, createStandardAction, createCustomAction } from "typesafe-actions"

// after
import { deprecated } from "typesafe-actions"
const { createAction, createStandardAction, createCustomAction } = deprecated;
  1. createStandardAction was renamed to createAction and .map method was removed in favor of simpler redux-actions style API.
// before
const withMappedPayloadAndMeta = createStandardAction(
  'CREATE_STANDARD_ACTION'
).map(({ username, message }: Notification) => ({
  payload: `${username}: ${message}`,
  meta: { username, message },
}));

// after
const withMappedPayloadAndMeta = createAction(
  'CREATE_STANDARD_ACTION',
  ({ username, message }: Notification) => `${username}: ${message}`, // payload creator
  ({ username, message }: Notification) => ({ username, message }) // meta creator
)();
  1. v4 version of createAction was removed. I suggest to refactor to use a new createAction as in point 2, which was simplified and extended to support redux-actions style API.
// before
const withPayloadAndMeta = createAction('CREATE_ACTION', resolve => {
  return (id: number, token: string) => resolve(id, token);
});

// after
const withPayloadAndMeta = createAction(
  'CREATE_ACTION',
  (id: number, token: string) => id, // payload creator
  (id: number, token: string) => token // meta creator
})();
  1. createCustomAction - API was greatly simplified, now it's used like this:
// before
const add = createCustomAction('CUSTOM', type => {
  return (first: number, second: number) => ({ type, customProp1: first, customProp2: second });
});

// after
const add = createCustomAction(
  'CUSTOM',
  (first: number, second: number) => ({ customProp1: first, customProp2: second })
);
  1. AsyncActionCreator should be just renamed to AsyncActionCreatorBuilder.
// before
import { AsyncActionCreator } from "typesafe-actions"

//after
import { AsyncActionCreatorBuilder } from "typesafe-actions"

New

  • Rewrite and simplify createAction & createAsyncAction API (#192)

Improvements

  • Fixed .npmignore. Fixed #205
  • Rollup build improvements (#203)
  • Updated AsyncActionCreatorBuilder and AsyncAction types to fix cancel handler type being never (#194)
  • Fixed high memory consumption (#171)

v4.4.2

23 Jun 16:03
Compare
Choose a tag to compare

Improvements

  • Downgrade rollup ver to fix react-native prod runtime error #170

v4.4.1

14 Jun 16:41
Compare
Choose a tag to compare

Improvements

  • Resolved #164
  • Added performance tests: npm run performance:[2,10,50]

v4.4.0

21 May 11:24
Compare
Choose a tag to compare

Improvements

  • Updated build pipeline to use babel for code transformation and bundle optimizations #155

v4.3.0

13 May 10:05
Compare
Choose a tag to compare

New API

  • Added new type AsyncActionCreator (#148)

v4.2.1

09 May 12:56
Compare
Choose a tag to compare

Improvements

  • Removed implicit dependency on tslib (Resolved #147)

v4.2.0

27 Apr 18:29
Compare
Choose a tag to compare

New API

  • Added optional cancel action to the createAsyncAction API (#146)

v4.1.4

27 Apr 14:16
Compare
Choose a tag to compare

Improvements

  • Updated createReducer handlers property type to show the correct type of only already added handlers

v4.1.3

27 Apr 00:20
Compare
Choose a tag to compare

Improvements

  • Fixed error - createReducer cannot be called when handling more than 2 actions #145

v4.1.2

23 Apr 00:08
Compare
Choose a tag to compare

Improvements

  • Fixed error - no exported member RootAction #141