File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import combineReducers from './combineReducers'
44import bindActionCreators from './bindActionCreators'
55import applyMiddleware from './applyMiddleware'
66import compose from './compose'
7+ import isAction from './utils/isAction'
78import __DO_NOT_USE__ActionTypes from './utils/actionTypes'
89
910// types
@@ -42,5 +43,6 @@ export {
4243 bindActionCreators ,
4344 applyMiddleware ,
4445 compose ,
46+ isAction ,
4547 __DO_NOT_USE__ActionTypes
4648}
Original file line number Diff line number Diff line change 1+ import { Action } from '../types/actions'
2+ import isPlainObject from './isPlainObject'
3+
4+ export default function isAction ( action : unknown ) : action is Action < string > {
5+ return (
6+ isPlainObject ( action ) &&
7+ 'type' in action &&
8+ typeof ( action as Record < 'type' , unknown > ) . type === 'string'
9+ )
10+ }
Original file line number Diff line number Diff line change 22 * @param obj The object to inspect.
33 * @returns True if the argument appears to be a plain object.
44 */
5- export default function isPlainObject ( obj : any ) : boolean {
5+ export default function isPlainObject ( obj : any ) : obj is object {
66 if ( typeof obj !== 'object' || obj === null ) return false
77
88 let proto = obj
You can’t perform that action at this time.
0 commit comments