Skip to content

Commit b1071f6

Browse files
committed
remove (now inaccurate) TODOs
1 parent ebb0637 commit b1071f6

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

packages/toolkit/src/listenerMiddleware/tests/listenerMiddleware.test-d.ts

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ describe('type tests', () => {
9090
addListener({
9191
actionCreator: testAction1,
9292
effect: () => {},
93-
})
93+
}),
9494
)
9595

9696
expectTypeOf(unsubscribe).toEqualTypeOf<UnsubscribeListener>()
@@ -135,7 +135,7 @@ describe('type tests', () => {
135135
predicate: (
136136
action,
137137
currentState,
138-
previousState
138+
previousState,
139139
): action is UnknownAction => {
140140
expectTypeOf(currentState).toBeUnknown()
141141

@@ -160,7 +160,7 @@ describe('type tests', () => {
160160
predicate: (
161161
action,
162162
currentState,
163-
previousState
163+
previousState,
164164
): action is UnknownAction => {
165165
expectTypeOf(currentState).toBeUnknown()
166166

@@ -191,7 +191,7 @@ describe('type tests', () => {
191191
predicate: (
192192
action,
193193
currentState,
194-
previousState
194+
previousState,
195195
): action is UnknownAction => {
196196
expectTypeOf(currentState).toBeUnknown()
197197

@@ -210,7 +210,7 @@ describe('type tests', () => {
210210
expectTypeOf(thunkState).toBeUnknown()
211211
})
212212
},
213-
})
213+
}),
214214
)
215215

216216
store.dispatch(
@@ -221,14 +221,13 @@ describe('type tests', () => {
221221

222222
expectTypeOf(listenerState).toBeUnknown()
223223

224-
// TODO Can't get the thunk dispatch types to carry through
225224
listenerApi.dispatch((dispatch, getState) => {
226225
const thunkState = getState()
227226

228227
expectTypeOf(thunkState).toBeUnknown()
229228
})
230229
},
231-
})
230+
}),
232231
)
233232
})
234233

@@ -258,7 +257,7 @@ describe('type tests', () => {
258257
predicate: (
259258
action,
260259
currentState,
261-
previousState
260+
previousState,
262261
): action is PayloadAction<number> => {
263262
return (
264263
isFluxStandardAction(action) && typeof action.payload === 'boolean'
@@ -286,7 +285,7 @@ describe('type tests', () => {
286285
effect: (action, listenerApi) => {
287286
expectTypeOf(action).toEqualTypeOf<{ type: 'abcd' }>()
288287
},
289-
})
288+
}),
290289
)
291290

292291
store.dispatch(
@@ -295,7 +294,7 @@ describe('type tests', () => {
295294
effect: (action, listenerApi) => {
296295
expectTypeOf(action).toMatchTypeOf<PayloadAction<number>>()
297296
},
298-
})
297+
}),
299298
)
300299

301300
store.dispatch(
@@ -304,7 +303,7 @@ describe('type tests', () => {
304303
effect: (action, listenerApi) => {
305304
expectTypeOf(action).toMatchTypeOf<PayloadAction<number>>()
306305
},
307-
})
306+
}),
308307
)
309308
})
310309

@@ -315,7 +314,7 @@ describe('type tests', () => {
315314
predicate: (
316315
action,
317316
currentState,
318-
previousState
317+
previousState,
319318
): action is UnknownAction => {
320319
expectTypeOf(currentState).not.toBeAny()
321320

@@ -342,11 +341,7 @@ describe('type tests', () => {
342341

343342
// Can pass a predicate function with fewer args
344343
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> => {
350345
expectTypeOf(currentState).not.toBeAny()
351346

352347
expectTypeOf(currentState).toEqualTypeOf<CounterState>()
@@ -388,7 +383,7 @@ describe('type tests', () => {
388383
predicate: (
389384
action,
390385
currentState,
391-
previousState
386+
previousState,
392387
): action is ReturnType<typeof incrementByAmount> => {
393388
expectTypeOf(currentState).not.toBeAny()
394389

@@ -411,15 +406,15 @@ describe('type tests', () => {
411406
expectTypeOf(thunkState).toEqualTypeOf<CounterState>()
412407
})
413408
},
414-
})
409+
}),
415410
)
416411

417412
store.dispatch(
418413
addTypedListenerAction({
419414
predicate: (
420415
action,
421416
currentState,
422-
previousState
417+
previousState,
423418
): action is UnknownAction => {
424419
expectTypeOf(currentState).not.toBeAny()
425420

@@ -442,7 +437,7 @@ describe('type tests', () => {
442437
expectTypeOf(thunkState).toEqualTypeOf<CounterState>()
443438
})
444439
},
445-
})
440+
}),
446441
)
447442
})
448443

@@ -454,7 +449,7 @@ describe('type tests', () => {
454449
predicate: (
455450
action,
456451
currentState,
457-
previousState
452+
previousState,
458453
): action is UnknownAction => {
459454
expectTypeOf(currentState).not.toBeAny()
460455

@@ -471,7 +466,6 @@ describe('type tests', () => {
471466

472467
expectTypeOf(listenerState).toEqualTypeOf<CounterState>()
473468

474-
// TODO Can't get the thunk dispatch types to carry through
475469
listenerApi.dispatch((dispatch, getState) => {
476470
const thunkState = listenerApi.getState()
477471

@@ -487,7 +481,6 @@ describe('type tests', () => {
487481

488482
expectTypeOf(listenerState).toEqualTypeOf<CounterState>()
489483

490-
// TODO Can't get the thunk dispatch types to carry through
491484
listenerApi.dispatch((dispatch, getState) => {
492485
const thunkState = listenerApi.getState()
493486

@@ -501,7 +494,7 @@ describe('type tests', () => {
501494
predicate: (
502495
action,
503496
currentState,
504-
previousState
497+
previousState,
505498
): action is UnknownAction => {
506499
expectTypeOf(currentState).not.toBeAny()
507500

@@ -524,7 +517,7 @@ describe('type tests', () => {
524517
expectTypeOf(thunkState).toEqualTypeOf<CounterState>()
525518
})
526519
},
527-
})
520+
}),
528521
)
529522

530523
store.dispatch(
@@ -541,7 +534,7 @@ describe('type tests', () => {
541534
expectTypeOf(thunkState).toEqualTypeOf<CounterState>()
542535
})
543536
},
544-
})
537+
}),
545538
)
546539
})
547540
})

0 commit comments

Comments
 (0)