Skip to content

Commit 83bc90a

Browse files
authored
Merge pull request #3906 from reduxjs/listener-fixes
2 parents d289a46 + 53803a5 commit 83bc90a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
createAction,
44
createSlice,
55
isAnyOf,
6-
isFSA,
6+
isFluxStandardAction,
77
} from '@reduxjs/toolkit'
88
import type { Mock } from 'vitest'
99
import { vi } from 'vitest'
@@ -1521,7 +1521,9 @@ describe('createListenerMiddleware', () => {
15211521
currentState,
15221522
previousState
15231523
): action is PayloadAction<number> => {
1524-
return isFSA(action) && typeof action.payload === 'boolean'
1524+
return (
1525+
isFluxStandardAction(action) && typeof action.payload === 'boolean'
1526+
)
15251527
},
15261528
effect: (action, listenerApi) => {
15271529
expectExactType<PayloadAction<number>>(action)
@@ -1530,7 +1532,9 @@ describe('createListenerMiddleware', () => {
15301532

15311533
startListening({
15321534
predicate: (action, currentState) => {
1533-
return isFSA(action) && typeof action.payload === 'number'
1535+
return (
1536+
isFluxStandardAction(action) && typeof action.payload === 'number'
1537+
)
15341538
},
15351539
effect: (action, listenerApi) => {
15361540
expectExactType<UnknownAction>(action)

packages/toolkit/src/listenerMiddleware/types.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
} from 'redux'
99
import type { ThunkDispatch } from 'redux-thunk'
1010
import type { TaskAbortError } from './exceptions'
11+
import { NoInfer } from '../tsHelpers'
1112

1213
/**
1314
* @internal
@@ -444,7 +445,7 @@ export interface AddListenerOverloads<
444445
): Return
445446

446447
/** Accepts an RTK matcher function, such as `incrementByAmount.match` */
447-
<MA extends ReduxAction, M extends MatchFunction<MA>>(
448+
<M extends MatchFunction<UnknownAction>>(
448449
options: {
449450
actionCreator?: never
450451
type?: never
@@ -581,10 +582,7 @@ export type FallbackAddListenerOptions = {
581582
*/
582583

583584
/** @public */
584-
export type GuardedType<T> = T extends (
585-
x: any,
586-
...args: unknown[]
587-
) => x is infer T
585+
export type GuardedType<T> = T extends (x: any, ...args: any[]) => x is infer T
588586
? T
589587
: never
590588

0 commit comments

Comments
 (0)