@@ -24,7 +24,11 @@ import type {
24
24
Unsubscribe ,
25
25
ActionListenerMiddleware ,
26
26
} from '../index'
27
- import type { ActionListener , AddListenerOverloads } from '../types'
27
+ import type {
28
+ ActionListener ,
29
+ AddListenerOverloads ,
30
+ TypedRemoveListenerAction ,
31
+ } from '../types'
28
32
29
33
const middlewareApi = {
30
34
getState : expect . any ( Function ) ,
@@ -138,6 +142,10 @@ describe('createActionListenerMiddleware', () => {
138
142
139
143
let reducer : jest . Mock
140
144
let middleware : ReturnType < typeof createActionListenerMiddleware >
145
+ let addTypedListenerAction =
146
+ addListenerAction as TypedAddListenerAction < CounterState >
147
+ let removeTypedListenerAction =
148
+ removeListenerAction as TypedRemoveListenerAction < CounterState >
141
149
// let middleware: ActionListenerMiddleware<CounterState> //: ReturnType<typeof createActionListenerMiddleware>
142
150
143
151
const testAction1 = createAction < string > ( 'testAction1' )
@@ -237,15 +245,15 @@ describe('createActionListenerMiddleware', () => {
237
245
238
246
expect (
239
247
store . dispatch (
240
- middleware . removeListenerAction ( {
248
+ removeTypedListenerAction ( {
241
249
actionCreator : testAction2 ,
242
250
listener,
243
251
} )
244
252
)
245
253
) . toBe ( false )
246
254
expect (
247
255
store . dispatch (
248
- middleware . removeListenerAction ( {
256
+ removeTypedListenerAction ( {
249
257
actionCreator : testAction1 ,
250
258
listener,
251
259
} )
@@ -657,7 +665,7 @@ describe('createActionListenerMiddleware', () => {
657
665
658
666
store . dispatch ( testAction1 ( 'a' ) )
659
667
660
- middleware . clear ( )
668
+ middleware . clearListeners ( )
661
669
store . dispatch ( testAction1 ( 'b' ) )
662
670
store . dispatch ( testAction2 ( 'c' ) )
663
671
@@ -680,7 +688,7 @@ describe('createActionListenerMiddleware', () => {
680
688
681
689
store . dispatch ( testAction1 ( 'a' ) )
682
690
683
- middleware . clear ( )
691
+ middleware . clearListeners ( )
684
692
store . dispatch ( testAction1 ( 'b' ) )
685
693
686
694
expect ( await fork1Test ) . toHaveProperty ( 'status' , 'cancelled' )
@@ -1385,7 +1393,7 @@ describe('createActionListenerMiddleware', () => {
1385
1393
} )
1386
1394
1387
1395
store . dispatch (
1388
- typedMiddleware . addListenerAction ( {
1396
+ addTypedListenerAction ( {
1389
1397
predicate : (
1390
1398
action ,
1391
1399
currentState ,
@@ -1409,7 +1417,7 @@ describe('createActionListenerMiddleware', () => {
1409
1417
)
1410
1418
1411
1419
store . dispatch (
1412
- typedMiddleware . addListenerAction ( {
1420
+ addTypedListenerAction ( {
1413
1421
predicate : (
1414
1422
action ,
1415
1423
currentState ,
0 commit comments