Download Latest Version v5.1.0 source code.zip (333.5 kB) Google Add to Preferred Sources
Home / v5.1.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2019-11-02 2.7 kB
v5.1.0 source code.tar.gz 2019-11-02 289.5 kB
v5.1.0 source code.zip 2019-11-02 333.5 kB
Totals: 3 Items   625.8 kB 1

Breaking changes

  1. In v5 all the deprecated v4 creator functions are available under deprecated named import to help with incremental migration.

    :::ts // before import { createAction, createStandardAction, createCustomAction } from "typesafe-actions"

    // after import { deprecated } from "typesafe-actions" const { createAction, createStandardAction, createCustomAction } = deprecated;

  2. createStandardAction was renamed to createAction and .map method was removed in favor of simpler redux-actions style API.

    :::ts // 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 )();

  3. 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.

    :::ts // 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 })();

  4. createCustomAction - API was greatly simplified, now it's used like this:

    :::ts // 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 }) );

  5. AsyncActionCreator should be just renamed to AsyncActionCreatorBuilder.

    :::ts // 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)
Source: README.md, updated 2019-11-02