Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix isFSA import and avoid unnecessary type param #3906

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
createAction,
createSlice,
isAnyOf,
isFSA,
isFluxStandardAction,
} from '@reduxjs/toolkit'
import type { Mock } from 'vitest'
import { vi } from 'vitest'
Expand Down Expand Up @@ -1521,7 +1521,9 @@ describe('createListenerMiddleware', () => {
currentState,
previousState
): action is PayloadAction<number> => {
return isFSA(action) && typeof action.payload === 'boolean'
return (
isFluxStandardAction(action) && typeof action.payload === 'boolean'
)
},
effect: (action, listenerApi) => {
expectExactType<PayloadAction<number>>(action)
Expand All @@ -1530,7 +1532,9 @@ describe('createListenerMiddleware', () => {

startListening({
predicate: (action, currentState) => {
return isFSA(action) && typeof action.payload === 'number'
return (
isFluxStandardAction(action) && typeof action.payload === 'number'
)
},
effect: (action, listenerApi) => {
expectExactType<UnknownAction>(action)
Expand Down
8 changes: 3 additions & 5 deletions packages/toolkit/src/listenerMiddleware/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
} from 'redux'
import type { ThunkDispatch } from 'redux-thunk'
import type { TaskAbortError } from './exceptions'
import { NoInfer } from '../tsHelpers'

/**
* @internal
Expand Down Expand Up @@ -444,7 +445,7 @@ export interface AddListenerOverloads<
): Return

/** Accepts an RTK matcher function, such as `incrementByAmount.match` */
<MA extends ReduxAction, M extends MatchFunction<MA>>(
<M extends MatchFunction<UnknownAction>>(
options: {
actionCreator?: never
type?: never
Expand Down Expand Up @@ -581,10 +582,7 @@ export type FallbackAddListenerOptions = {
*/

/** @public */
export type GuardedType<T> = T extends (
x: any,
...args: unknown[]
) => x is infer T
export type GuardedType<T> = T extends (x: any, ...args: any[]) => x is infer T
EskiMojo14 marked this conversation as resolved.
Show resolved Hide resolved
? T
: never

Expand Down
Loading