Skip to content

Releases: piotrwitek/typesafe-actions

v2.1.1

26 Dec 16:02
Compare
Choose a tag to compare

Removed test files from published npm bundle

v2.1.0

26 Dec 16:02
Compare
Choose a tag to compare
  • Extended isOfType to accept array of types to be consistent with isActionOf (#86)
  • Added better redux-actions compatibility for easier migration (#96)

Improved conditional types

27 May 12:50
Compare
Choose a tag to compare

Improved types for scenarios when user wants to create actions with meta property but without payload property.
#43

Official v2.0 Release

15 May 09:39
Compare
Choose a tag to compare

Added a bunch of new API to cover 95% of common use-cases people encounter while working with Redux Action Creators in TypeScript:

  • those who wants quickly and easily generate Discriminated Union Type from action creator module (ActionType)
  • those who likes to preserve action-creator parameters names (action & createAction)
  • those who uses Generic Interface for payload/meta arguments (createStandardAction)
  • those who wants to cut boilerplate for composite actions when handling network requests (createAsyncAction)

There was also internal refactoring, added lots of new test cases for runtime and types, and improved build process using Rollup, which generates nice bundles for different build workflows (commonjs, es-modules, amd for browser)

Hotfix

09 May 07:58
Compare
Choose a tag to compare
  • moved tslib to deps

Hotfix 2

02 Jan 08:37
Compare
Choose a tag to compare
  • fixed tsconfig exclude of spec files in the npm bundle

Hotfix 1

02 Jan 08:37
Compare
Choose a tag to compare
  • include source files with npm package needed for various source map tooling

v1.1.0

29 Dec 17:59
Compare
Choose a tag to compare

(#8) - enhanced isActionOf to accept array of actions

// multiple actions
const logTodoAction: Epic<RootAction, RootState> =
  (action$, store) => action$
    .filter(isActionOf([addTodo, toggleTodo]))
    .switchMap((action) => { // action is asserted as: { type: "ADD_TODO", payload: string } | { type: "TOGGLE_TODO", payload: string }
      const log = `Dispatched action: ${action.type}`;
...

Production ready release

28 Dec 09:50
Compare
Choose a tag to compare

API is frozen with semantic versioning:

API

  • createAction
  • getType
  • isActionOf

RC1

26 Dec 12:12
Compare
Choose a tag to compare
RC1 Pre-release
Pre-release

New:

isActionOf

assert specific action from union type

> Advanced Usage

function isActionOf(actionCreator: AC<T>): (action: A<T>) => action is T

// AC<T> extends (...args: any[]) => A<T>

Examples:

import { addTodo } from './actions';

// in epics
const addTodoToast: Epic<RootAction, RootState> =
  (action$, store) => action$
    .filter(isActionOf(addTodo))
    .concatMap((action) => { // action is asserted as addTodo Action Type
      const toast = { text: action.payload };