@@ -90,7 +90,7 @@ describe('type tests', () => {
90
90
addListener ( {
91
91
actionCreator : testAction1 ,
92
92
effect : ( ) => { } ,
93
- } )
93
+ } ) ,
94
94
)
95
95
96
96
expectTypeOf ( unsubscribe ) . toEqualTypeOf < UnsubscribeListener > ( )
@@ -135,7 +135,7 @@ describe('type tests', () => {
135
135
predicate : (
136
136
action ,
137
137
currentState ,
138
- previousState
138
+ previousState ,
139
139
) : action is UnknownAction => {
140
140
expectTypeOf ( currentState ) . toBeUnknown ( )
141
141
@@ -160,7 +160,7 @@ describe('type tests', () => {
160
160
predicate : (
161
161
action ,
162
162
currentState ,
163
- previousState
163
+ previousState ,
164
164
) : action is UnknownAction => {
165
165
expectTypeOf ( currentState ) . toBeUnknown ( )
166
166
@@ -191,7 +191,7 @@ describe('type tests', () => {
191
191
predicate : (
192
192
action ,
193
193
currentState ,
194
- previousState
194
+ previousState ,
195
195
) : action is UnknownAction => {
196
196
expectTypeOf ( currentState ) . toBeUnknown ( )
197
197
@@ -210,7 +210,7 @@ describe('type tests', () => {
210
210
expectTypeOf ( thunkState ) . toBeUnknown ( )
211
211
} )
212
212
} ,
213
- } )
213
+ } ) ,
214
214
)
215
215
216
216
store . dispatch (
@@ -221,14 +221,13 @@ describe('type tests', () => {
221
221
222
222
expectTypeOf ( listenerState ) . toBeUnknown ( )
223
223
224
- // TODO Can't get the thunk dispatch types to carry through
225
224
listenerApi . dispatch ( ( dispatch , getState ) => {
226
225
const thunkState = getState ( )
227
226
228
227
expectTypeOf ( thunkState ) . toBeUnknown ( )
229
228
} )
230
229
} ,
231
- } )
230
+ } ) ,
232
231
)
233
232
} )
234
233
@@ -258,7 +257,7 @@ describe('type tests', () => {
258
257
predicate : (
259
258
action ,
260
259
currentState ,
261
- previousState
260
+ previousState ,
262
261
) : action is PayloadAction < number > => {
263
262
return (
264
263
isFluxStandardAction ( action ) && typeof action . payload === 'boolean'
@@ -286,7 +285,7 @@ describe('type tests', () => {
286
285
effect : ( action , listenerApi ) => {
287
286
expectTypeOf ( action ) . toEqualTypeOf < { type : 'abcd' } > ( )
288
287
} ,
289
- } )
288
+ } ) ,
290
289
)
291
290
292
291
store . dispatch (
@@ -295,7 +294,7 @@ describe('type tests', () => {
295
294
effect : ( action , listenerApi ) => {
296
295
expectTypeOf ( action ) . toMatchTypeOf < PayloadAction < number > > ( )
297
296
} ,
298
- } )
297
+ } ) ,
299
298
)
300
299
301
300
store . dispatch (
@@ -304,7 +303,7 @@ describe('type tests', () => {
304
303
effect : ( action , listenerApi ) => {
305
304
expectTypeOf ( action ) . toMatchTypeOf < PayloadAction < number > > ( )
306
305
} ,
307
- } )
306
+ } ) ,
308
307
)
309
308
} )
310
309
@@ -315,7 +314,7 @@ describe('type tests', () => {
315
314
predicate : (
316
315
action ,
317
316
currentState ,
318
- previousState
317
+ previousState ,
319
318
) : action is UnknownAction => {
320
319
expectTypeOf ( currentState ) . not . toBeAny ( )
321
320
@@ -342,11 +341,7 @@ describe('type tests', () => {
342
341
343
342
// Can pass a predicate function with fewer args
344
343
typedMiddleware . startListening ( {
345
- // TODO Why won't this infer the listener's `action` with implicit argument types?
346
- predicate : (
347
- action : UnknownAction ,
348
- currentState : CounterState
349
- ) : action is PayloadAction < number > => {
344
+ predicate : ( action , currentState ) : action is PayloadAction < number > => {
350
345
expectTypeOf ( currentState ) . not . toBeAny ( )
351
346
352
347
expectTypeOf ( currentState ) . toEqualTypeOf < CounterState > ( )
@@ -388,7 +383,7 @@ describe('type tests', () => {
388
383
predicate : (
389
384
action ,
390
385
currentState ,
391
- previousState
386
+ previousState ,
392
387
) : action is ReturnType < typeof incrementByAmount > => {
393
388
expectTypeOf ( currentState ) . not . toBeAny ( )
394
389
@@ -411,15 +406,15 @@ describe('type tests', () => {
411
406
expectTypeOf ( thunkState ) . toEqualTypeOf < CounterState > ( )
412
407
} )
413
408
} ,
414
- } )
409
+ } ) ,
415
410
)
416
411
417
412
store . dispatch (
418
413
addTypedListenerAction ( {
419
414
predicate : (
420
415
action ,
421
416
currentState ,
422
- previousState
417
+ previousState ,
423
418
) : action is UnknownAction => {
424
419
expectTypeOf ( currentState ) . not . toBeAny ( )
425
420
@@ -442,7 +437,7 @@ describe('type tests', () => {
442
437
expectTypeOf ( thunkState ) . toEqualTypeOf < CounterState > ( )
443
438
} )
444
439
} ,
445
- } )
440
+ } ) ,
446
441
)
447
442
} )
448
443
@@ -454,7 +449,7 @@ describe('type tests', () => {
454
449
predicate : (
455
450
action ,
456
451
currentState ,
457
- previousState
452
+ previousState ,
458
453
) : action is UnknownAction => {
459
454
expectTypeOf ( currentState ) . not . toBeAny ( )
460
455
@@ -471,7 +466,6 @@ describe('type tests', () => {
471
466
472
467
expectTypeOf ( listenerState ) . toEqualTypeOf < CounterState > ( )
473
468
474
- // TODO Can't get the thunk dispatch types to carry through
475
469
listenerApi . dispatch ( ( dispatch , getState ) => {
476
470
const thunkState = listenerApi . getState ( )
477
471
@@ -487,7 +481,6 @@ describe('type tests', () => {
487
481
488
482
expectTypeOf ( listenerState ) . toEqualTypeOf < CounterState > ( )
489
483
490
- // TODO Can't get the thunk dispatch types to carry through
491
484
listenerApi . dispatch ( ( dispatch , getState ) => {
492
485
const thunkState = listenerApi . getState ( )
493
486
@@ -501,7 +494,7 @@ describe('type tests', () => {
501
494
predicate : (
502
495
action ,
503
496
currentState ,
504
- previousState
497
+ previousState ,
505
498
) : action is UnknownAction => {
506
499
expectTypeOf ( currentState ) . not . toBeAny ( )
507
500
@@ -524,7 +517,7 @@ describe('type tests', () => {
524
517
expectTypeOf ( thunkState ) . toEqualTypeOf < CounterState > ( )
525
518
} )
526
519
} ,
527
- } )
520
+ } ) ,
528
521
)
529
522
530
523
store . dispatch (
@@ -541,7 +534,7 @@ describe('type tests', () => {
541
534
expectTypeOf ( thunkState ) . toEqualTypeOf < CounterState > ( )
542
535
} )
543
536
} ,
544
- } )
537
+ } ) ,
545
538
)
546
539
} )
547
540
} )
0 commit comments