Skip to content

Commit 39a1fc9

Browse files
committed
Throw error if no valid action matcher provided
1 parent 8ea3f75 commit 39a1fc9

File tree

1 file changed

+5
-1
lines changed
  • packages/action-listener-middleware/src

1 file changed

+5
-1
lines changed

packages/action-listener-middleware/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,12 @@ export const createListenerEntry: TypedCreateListenerEntry<unknown> = (
114114
predicate = options.actionCreator.match
115115
} else if ('matcher' in options) {
116116
predicate = options.matcher
117-
} else {
117+
} else if ('predicate' in options) {
118118
predicate = options.predicate
119+
} else {
120+
throw new Error(
121+
'Creating a listener requires one of the known fields for matching against actions'
122+
)
119123
}
120124

121125
const id = nanoid()

0 commit comments

Comments
 (0)