File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,12 @@ export function reportInvalidActions(
31
31
}
32
32
33
33
function isAction ( action : any ) : action is Action {
34
- return action && action . type && typeof action . type === 'string' ;
34
+ return (
35
+ typeof action !== 'function' &&
36
+ action &&
37
+ action . type &&
38
+ typeof action . type === 'string'
39
+ ) ;
35
40
}
36
41
37
42
function getEffectName ( {
Original file line number Diff line number Diff line change @@ -13,12 +13,16 @@ export class ActionsSubject extends BehaviorSubject<Action>
13
13
}
14
14
15
15
next ( action : Action ) : void {
16
- if ( typeof action === 'undefined' ) {
16
+ if ( typeof action === 'function' ) {
17
+ throw new TypeError ( `
18
+ Dispatch expected an object, instead it received a function.
19
+ If you're using the createAction function, make sure to invoke the function
20
+ before dispatching the action. For example, someAction should be someAction().` ) ;
21
+ } else if ( typeof action === 'undefined' ) {
17
22
throw new TypeError ( `Actions must be objects` ) ;
18
23
} else if ( typeof action . type === 'undefined' ) {
19
24
throw new TypeError ( `Actions must have a type property` ) ;
20
25
}
21
-
22
26
super . next ( action ) ;
23
27
}
24
28
You can’t perform that action at this time.
0 commit comments