Releases: piotrwitek/typesafe-actions
Releases · piotrwitek/typesafe-actions
v2.1.1
Removed test files from published npm bundle
v2.1.0
Improved conditional types
Improved types for scenarios when user wants to create actions with meta
property but without payload
property.
#43
Official v2.0 Release
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
- moved tslib to deps
Hotfix 2
- fixed tsconfig exclude of spec files in the npm bundle
Hotfix 1
- include source files with npm package needed for various source map tooling
v1.1.0
(#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
API is frozen with semantic versioning:
API
createAction
getType
isActionOf
RC1
New:
isActionOf
assert specific action from union type
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 };