@reduxjs/toolkit

  • Version 2.2.3
  • Published
  • 5.44 MB
  • 4 dependencies
  • MIT license

Install

npm i @reduxjs/toolkit
yarn add @reduxjs/toolkit
pnpm add @reduxjs/toolkit

Overview

The official, opinionated, batteries-included toolset for efficient Redux development

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Variables

variable addListener

const addListener: BaseActionCreator<
ListenerEntry<unknown, ThunkDispatch<StateType, unknown, UnknownAction>>,
'listenerMiddleware/add',
never,
never
> &
AddListenerOverloads<
{
payload: ListenerEntry<
unknown,
ThunkDispatch<StateType, unknown, UnknownAction>
>;
type: 'listenerMiddleware/add';
},
unknown,
ThunkDispatch<StateType, unknown, UnknownAction>,
unknown,
unknown
> & {
withTypes: <
OverrideStateType extends unknown,
OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
OverrideStateType,
unknown,
UnknownAction
>
>() => TypedAddListener<
OverrideStateType,
OverrideDispatchType,
unknown,
ListenerEntry<OverrideStateType, OverrideDispatchType>,
'listenerMiddleware/add'
>;
};
  • Modifiers

    • @public

variable asyncThunkCreator

const asyncThunkCreator: { [asyncThunkSymbol]: typeof _createAsyncThunk };

    variable clearAllListeners

    const clearAllListeners: ActionCreatorWithoutPayload<'listenerMiddleware/removeAll'>;
    • Modifiers

      • @public

    variable createAsyncThunk

    const createAsyncThunk: CreateAsyncThunk<AsyncThunkConfig>;

      variable createDraftSafeSelector

      const createDraftSafeSelector: any;
      • "Draft-Safe" version of reselect's createSelector: If an immer-drafted object is passed into the resulting selector's first argument, the selector will act on the current draft value, instead of returning a cached value that might be possibly outdated if the draft has been modified since.

        Modifiers

        • @public

      variable createDraftSafeSelectorCreator

      const createDraftSafeSelectorCreator: any;

        variable removeListener

        const removeListener: BaseActionCreator<
        ListenerEntry<unknown, ThunkDispatch<StateType, unknown, UnknownAction>>,
        'listenerMiddleware/remove',
        never,
        never
        > &
        AddListenerOverloads<
        {
        payload: ListenerEntry<
        unknown,
        ThunkDispatch<StateType, unknown, UnknownAction>
        >;
        type: 'listenerMiddleware/remove';
        },
        unknown,
        ThunkDispatch<StateType, unknown, UnknownAction>,
        any,
        UnsubscribeListenerOptions
        > & {
        withTypes: <
        OverrideStateType extends unknown,
        OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
        OverrideStateType,
        unknown,
        UnknownAction
        >
        >() => TypedRemoveListener<
        OverrideStateType,
        OverrideDispatchType,
        ListenerEntry<OverrideStateType, OverrideDispatchType>,
        'listenerMiddleware/remove'
        >;
        };
        • Modifiers

          • @public

        variable SHOULD_AUTOBATCH

        const SHOULD_AUTOBATCH: string;

          Functions

          function autoBatchEnhancer

          autoBatchEnhancer: (options?: AutoBatchOptions) => StoreEnhancer;
          • A Redux store enhancer that watches for "low-priority" actions, and delays notifying subscribers until either the queued callback executes or the next "standard-priority" action is dispatched.

            This allows dispatching multiple "low-priority" actions in a row with only a single subscriber notification to the UI after the sequence of actions is finished, thus improving UI re-render performance.

            Watches for actions with the action.meta[SHOULD_AUTOBATCH] attribute. This can be added to action.meta manually, or by using the prepareAutoBatched helper.

            By default, it will queue a notification for the end of the event loop tick. However, you can pass several other options to configure the behavior: - {type: 'tick'}: queues using queueMicrotask - {type: 'timer', timeout: number}: queues using setTimeout - {type: 'raf'}: queues using requestAnimationFrame (default) - {type: 'callback', queueNotification: (notify: () => void) => void}: lets you provide your own callback

          function buildCreateSlice

          buildCreateSlice: ({
          creators,
          }?: BuildCreateSliceConfig) => <
          State,
          CaseReducers extends SliceCaseReducers<State>,
          Name extends string,
          Selectors extends SliceSelectors<State>,
          ReducerPath extends string = Name
          >(
          options: CreateSliceOptions<State, CaseReducers, Name, ReducerPath, Selectors>
          ) => Slice<State, CaseReducers, Name, ReducerPath, Selectors>;

            function combineSlices

            combineSlices: <Slices extends (AnySliceLike | ReducerMap)[]>(
            ...slices: Slices
            ) => CombinedSliceReducer<Id<InitialState<Slices>>>;

              function configureStore

              configureStore: <
              S = any,
              A extends Action = UnknownAction,
              M extends Tuple<Middlewares<S>> = Tuple<[ThunkMiddleware<S, UnknownAction>]>,
              E extends Tuple<Enhancers> = Tuple<
              [StoreEnhancer<{ dispatch: ExtractDispatchExtensions<M> }>, StoreEnhancer]
              >,
              P = S
              >(
              options: ConfigureStoreOptions<S, A, M, E, P>
              ) => EnhancedStore<S, A, E>;
              • A friendly abstraction over the standard Redux createStore() function.

                Parameter options

                The store configuration.

                Returns

                A configured Redux store.

                Modifiers

                • @public

              function createAction

              createAction: {
              <P = void, T extends string = string>(type: T): PayloadActionCreator<P, T>;
              <PA extends PrepareAction<any>, T extends string = string>(
              type: T,
              prepareAction: PA
              ): IfPrepareActionMethodProvided<
              PA,
              _ActionCreatorWithPreparedPayload<PA, T>,
              IsAny<
              ReturnType<PA>['payload'],
              ActionCreatorWithPayload<any, T>,
              IsUnknown<
              ReturnType<PA>['payload'],
              ActionCreatorWithNonInferrablePayload<T>,
              IfVoid<
              ReturnType<PA>['payload'],
              ActionCreatorWithoutPayload<T>,
              IfMaybeUndefined<
              ReturnType<PA>['payload'],
              ActionCreatorWithOptionalPayload<
              ReturnType<PA>['payload'],
              T
              >,
              ActionCreatorWithPayload<ReturnType<PA>['payload'], T>
              >
              >
              >
              >
              >;
              };
              • A utility function to create an action creator for the given action type string. The action creator accepts a single argument, which will be included in the action object as a field called payload. The action creator function will also have its toString() overridden so that it returns the action type.

                Parameter type

                The action type to use for created actions.

                Parameter prepare

                (optional) a method that takes any number of arguments and returns { payload } or { payload, meta }. If this is given, the resulting action creator will pass its arguments to this method to calculate payload & meta.

                Modifiers

                • @public

              function createActionCreatorInvariantMiddleware

              createActionCreatorInvariantMiddleware: (
              options?: ActionCreatorInvariantMiddlewareOptions
              ) => Middleware;

                function createDynamicMiddleware

                createDynamicMiddleware: <
                State = any,
                Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>
                >() => DynamicMiddlewareInstance<State, Dispatch>;

                  function createEntityAdapter

                  createEntityAdapter: {
                  <T, Id extends EntityId>(
                  options: WithRequiredProp<EntityAdapterOptions<T, Id>, 'selectId'>
                  ): EntityAdapter<T, Id>;
                  <T extends { id: EntityId }>(
                  options?: Omit<EntityAdapterOptions<T, T['id']>, 'selectId'>
                  ): EntityAdapter<T, T['id']>;
                  };

                    function createImmutableStateInvariantMiddleware

                    createImmutableStateInvariantMiddleware: (
                    options?: ImmutableStateInvariantMiddlewareOptions
                    ) => Middleware;
                    • Creates a middleware that checks whether any state was mutated in between dispatches or during a dispatch. If any mutations are detected, an error is thrown.

                      Parameter options

                      Middleware options.

                      Modifiers

                      • @public

                    function createListenerMiddleware

                    createListenerMiddleware: <
                    StateType = unknown,
                    DispatchType extends Dispatch<Action> = ThunkDispatch<
                    StateType,
                    unknown,
                    UnknownAction
                    >,
                    ExtraArgument = unknown
                    >(
                    middlewareOptions?: CreateListenerMiddlewareOptions<ExtraArgument>
                    ) => ListenerMiddlewareInstance<StateType, DispatchType, ExtraArgument>;
                    • Modifiers

                      • @public

                    function createReducer

                    createReducer: <S extends unknown>(
                    initialState: S | (() => S),
                    mapOrBuilderCallback: (builder: ActionReducerMapBuilder<S>) => void
                    ) => ReducerWithInitialState<S>;
                    • A utility function that allows defining a reducer as a mapping from action type to *case reducer* functions that handle these action types. The reducer's initial state is passed as the first argument.

                      Parameter initialState

                      State | (() => State): The initial state that should be used when the reducer is called the first time. This may also be a "lazy initializer" function, which should return an initial state value when called. This will be used whenever the reducer is called with undefined as its state value, and is primarily useful for cases like reading initial state from localStorage.

                      Parameter builderCallback

                      (builder: Builder) => void A callback that receives a *builder* object to define case reducers via calls to builder.addCase(actionCreatorOrType, reducer).

                      Remarks

                      The body of every case reducer is implicitly wrapped with a call to produce() from the [immer](https://github.com/mweststrate/immer) library. This means that rather than returning a new state object, you can also mutate the passed-in state object directly; these mutations will then be automatically and efficiently translated into copies, giving you both convenience and immutability.

                      This function accepts a callback that receives a builder object as its argument. That builder provides addCase, addMatcher and addDefaultCase functions that may be called to define what actions this reducer will handle.

                      Example 1

                      import {
                      createAction,
                      createReducer,
                      UnknownAction,
                      PayloadAction,
                      } from "@reduxjs/toolkit";
                      const increment = createAction<number>("increment");
                      const decrement = createAction<number>("decrement");
                      function isActionWithNumberPayload(
                      action: UnknownAction
                      ): action is PayloadAction<number> {
                      return typeof action.payload === "number";
                      }
                      const reducer = createReducer(
                      {
                      counter: 0,
                      sumOfNumberPayloads: 0,
                      unhandledActions: 0,
                      },
                      (builder) => {
                      builder
                      .addCase(increment, (state, action) => {
                      // action is inferred correctly here
                      state.counter += action.payload;
                      })
                      // You can chain calls, or have separate `builder.addCase()` lines each time
                      .addCase(decrement, (state, action) => {
                      state.counter -= action.payload;
                      })
                      // You can apply a "matcher function" to incoming actions
                      .addMatcher(isActionWithNumberPayload, (state, action) => {})
                      // and provide a default case if no other handlers matched
                      .addDefaultCase((state, action) => {});
                      }
                      );

                      Modifiers

                      • @public

                    function createSerializableStateInvariantMiddleware

                    createSerializableStateInvariantMiddleware: (
                    options?: SerializableStateInvariantMiddlewareOptions
                    ) => Middleware;
                    • Creates a middleware that, after every state change, checks if the new state is serializable. If a non-serializable value is found within the state, an error is printed to the console.

                      Parameter options

                      Middleware options.

                      Modifiers

                      • @public

                    function createSlice

                    createSlice: <
                    State,
                    CaseReducers extends SliceCaseReducers<State>,
                    Name extends string,
                    Selectors extends SliceSelectors<State>,
                    ReducerPath extends string = Name
                    >(
                    options: CreateSliceOptions<State, CaseReducers, Name, ReducerPath, Selectors>
                    ) => Slice<State, CaseReducers, Name, ReducerPath, Selectors>;
                    • A function that accepts an initial state, an object full of reducer functions, and a "slice name", and automatically generates action creators and action types that correspond to the reducers and state.

                      Modifiers

                      • @public

                    function findNonSerializableValue

                    findNonSerializableValue: (
                    value: unknown,
                    path?: string,
                    isSerializable?: (value: unknown) => boolean,
                    getEntries?: (value: unknown) => [string, any][],
                    ignoredPaths?: IgnorePaths,
                    cache?: WeakSet<object>
                    ) => NonSerializableValue | false;
                    • Modifiers

                      • @public

                    function formatProdErrorMessage

                    formatProdErrorMessage: (code: number) => string;
                    • Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js

                      Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes during build.

                      Parameter code

                    function isActionCreator

                    isActionCreator: (
                    action: unknown
                    ) => action is BaseActionCreator<unknown, string, never, never> & Function;
                    • Returns true if value is an RTK-like action creator, with a static type property and match method.

                    function isAllOf

                    isAllOf: <Matchers extends Matcher<any>[]>(
                    ...matchers: Matchers
                    ) => (
                    action: any
                    ) => action is UnionToIntersection<ActionFromMatcher<Matchers[number]>>;
                    • A higher-order function that returns a function that may be used to check whether an action matches all of the supplied type guards or action creators.

                      Parameter matchers

                      The type guards or action creators to match against.

                      Modifiers

                      • @public

                    function isAnyOf

                    isAnyOf: <Matchers extends Matcher<any>[]>(
                    ...matchers: Matchers
                    ) => (action: any) => action is ActionFromMatcher<Matchers[number]>;
                    • A higher-order function that returns a function that may be used to check whether an action matches any one of the supplied type guards or action creators.

                      Parameter matchers

                      The type guards or action creators to match against.

                      Modifiers

                      • @public

                    function isAsyncThunkAction

                    isAsyncThunkAction: {
                    (): (action: any) => action is UnknownAsyncThunkAction;
                    <AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(
                    ...asyncThunks: AsyncThunks
                    ): (action: any) => action is ActionsFromAsyncThunk<AsyncThunks[number]>;
                    (action: any): action is UnknownAsyncThunkAction;
                    };
                    • A higher-order function that returns a function that may be used to check whether an action was created by an async thunk action creator.

                      Modifiers

                      • @public
                    • A higher-order function that returns a function that may be used to check whether an action belongs to one of the provided async thunk action creators.

                      Parameter asyncThunks

                      (optional) The async thunk action creators to match against.

                      Modifiers

                      • @public
                    • Tests if action is a thunk action

                      Modifiers

                      • @public

                    function isFluxStandardAction

                    isFluxStandardAction: (
                    action: unknown
                    ) => action is { type: string; payload?: unknown; error?: unknown; meta?: unknown };
                    • Returns true if value is an action with a string type and valid Flux Standard Action keys.

                    function isFulfilled

                    isFulfilled: {
                    (): (
                    action: any
                    ) => action is PayloadAction<
                    unknown,
                    string,
                    { arg: unknown; requestId: string; requestStatus: 'fulfilled' },
                    never
                    >;
                    <AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(
                    ...asyncThunks: AsyncThunks
                    ): (
                    action: any
                    ) => action is ActionFromMatcher<AsyncThunks[number]['fulfilled']>;
                    (action: any): action is PayloadAction<
                    unknown,
                    string,
                    { arg: unknown; requestId: string; requestStatus: 'fulfilled' },
                    never
                    >;
                    };
                    • A higher-order function that returns a function that may be used to check whether an action was created by an async thunk action creator, and that the action is fulfilled.

                      Modifiers

                      • @public
                    • A higher-order function that returns a function that may be used to check whether an action belongs to one of the provided async thunk action creators, and that the action is fulfilled.

                      Parameter asyncThunks

                      (optional) The async thunk action creators to match against.

                      Modifiers

                      • @public
                    • Tests if action is a fulfilled thunk action

                      Modifiers

                      • @public

                    function isImmutableDefault

                    isImmutableDefault: (value: unknown) => boolean;
                    • The default isImmutable function.

                      Modifiers

                      • @public

                    function isPending

                    isPending: {
                    (): (
                    action: any
                    ) => action is PayloadAction<
                    undefined,
                    string,
                    { arg: unknown; requestId: string; requestStatus: 'pending' },
                    never
                    >;
                    <AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(
                    ...asyncThunks: AsyncThunks
                    ): (action: any) => action is ActionFromMatcher<AsyncThunks[number]['pending']>;
                    (action: any): action is PayloadAction<
                    undefined,
                    string,
                    { arg: unknown; requestId: string; requestStatus: 'pending' },
                    never
                    >;
                    };
                    • A higher-order function that returns a function that may be used to check whether an action was created by an async thunk action creator, and that the action is pending.

                      Modifiers

                      • @public
                    • A higher-order function that returns a function that may be used to check whether an action belongs to one of the provided async thunk action creators, and that the action is pending.

                      Parameter asyncThunks

                      (optional) The async thunk action creators to match against.

                      Modifiers

                      • @public
                    • Tests if action is a pending thunk action

                      Modifiers

                      • @public

                    function isPlain

                    isPlain: (val: any) => boolean;
                    • Returns true if the passed value is "plain", i.e. a value that is either directly JSON-serializable (boolean, number, string, array, plain object) or undefined.

                      Parameter val

                      The value to check.

                      Modifiers

                      • @public

                    function isRejected

                    isRejected: {
                    (): (
                    action: any
                    ) => action is PayloadAction<
                    unknown,
                    string,
                    {
                    arg: unknown;
                    requestId: string;
                    requestStatus: 'rejected';
                    aborted: boolean;
                    condition: boolean;
                    } & ({ rejectedWithValue: true } | ({ rejectedWithValue: false } & {})),
                    SerializedError
                    >;
                    <AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(
                    ...asyncThunks: AsyncThunks
                    ): (action: any) => action is ActionFromMatcher<AsyncThunks[number]['rejected']>;
                    (action: any): action is PayloadAction<
                    unknown,
                    string,
                    {
                    arg: unknown;
                    requestId: string;
                    requestStatus: 'rejected';
                    aborted: boolean;
                    condition: boolean;
                    } & ({ rejectedWithValue: true } | ({ rejectedWithValue: false } & {})),
                    SerializedError
                    >;
                    };
                    • A higher-order function that returns a function that may be used to check whether an action was created by an async thunk action creator, and that the action is rejected.

                      Modifiers

                      • @public
                    • A higher-order function that returns a function that may be used to check whether an action belongs to one of the provided async thunk action creators, and that the action is rejected.

                      Parameter asyncThunks

                      (optional) The async thunk action creators to match against.

                      Modifiers

                      • @public
                    • Tests if action is a rejected thunk action

                      Modifiers

                      • @public

                    function isRejectedWithValue

                    isRejectedWithValue: {
                    (): (
                    action: any
                    ) => action is PayloadAction<
                    unknown,
                    string,
                    {
                    arg: unknown;
                    requestId: string;
                    requestStatus: 'rejected';
                    aborted: boolean;
                    condition: boolean;
                    } & ({ rejectedWithValue: true } | ({ rejectedWithValue: false } & {})),
                    SerializedError
                    >;
                    <AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]>(
                    ...asyncThunks: AsyncThunks
                    ): (
                    action: any
                    ) => action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>;
                    (action: any): action is PayloadAction<
                    unknown,
                    string,
                    {
                    arg: unknown;
                    requestId: string;
                    requestStatus: 'rejected';
                    aborted: boolean;
                    condition: boolean;
                    } & ({ rejectedWithValue: true } | ({ rejectedWithValue: false } & {})),
                    SerializedError
                    >;
                    };
                    • A higher-order function that returns a function that may be used to check whether an action was created by an async thunk action creator, and that the action is rejected with value.

                      Modifiers

                      • @public
                    • A higher-order function that returns a function that may be used to check whether an action belongs to one of the provided async thunk action creators, and that the action is rejected with value.

                      Parameter asyncThunks

                      (optional) The async thunk action creators to match against.

                      Modifiers

                      • @public
                    • Tests if action is a rejected thunk action with value

                      Modifiers

                      • @public

                    function miniSerializeError

                    miniSerializeError: (value: any) => SerializedError;
                    • Serializes an error into a plain object. Reworked from https://github.com/sindresorhus/serialize-error

                      Modifiers

                      • @public

                    function nanoid

                    nanoid: (size?: number) => string;
                    • Modifiers

                      • @public

                    function prepareAutoBatched

                    prepareAutoBatched: <T>() => (payload: T) => { payload: T; meta: unknown };

                      function unwrapResult

                      unwrapResult: <R extends UnwrappableAction>(
                      action: R
                      ) => UnwrappedActionPayload<R>;
                      • Modifiers

                        • @public

                      Classes

                      class TaskAbortError

                      class TaskAbortError implements SerializedError {}

                        constructor

                        constructor(code: string);

                          property code

                          code: string;

                            property message

                            message: string;

                              property name

                              name: string;

                                class Tuple

                                class Tuple<Items extends ReadonlyArray<unknown> = []> extends Array<
                                Items[number]
                                > {}

                                  constructor

                                  constructor(length: number);

                                    constructor

                                    constructor(...items: readonly unknown[]);

                                      property [Symbol.species]

                                      static readonly [Symbol.species]: any;

                                        method concat

                                        concat: {
                                        <AdditionalItems extends readonly unknown[]>(
                                        items: Tuple<AdditionalItems>
                                        ): Tuple<[...Items, ...AdditionalItems]>;
                                        <AdditionalItems extends readonly unknown[]>(items: AdditionalItems): Tuple<
                                        [...Items, ...AdditionalItems]
                                        >;
                                        <AdditionalItems extends readonly unknown[]>(
                                        ...items: AdditionalItems
                                        ): Tuple<[...Items, ...AdditionalItems]>;
                                        };

                                          method prepend

                                          prepend: {
                                          <AdditionalItems extends readonly unknown[]>(
                                          items: Tuple<AdditionalItems>
                                          ): Tuple<[...AdditionalItems, ...Items]>;
                                          <AdditionalItems extends readonly unknown[]>(items: AdditionalItems): Tuple<
                                          [...AdditionalItems, ...Items]
                                          >;
                                          <AdditionalItems extends readonly unknown[]>(
                                          ...items: AdditionalItems
                                          ): Tuple<[...AdditionalItems, ...Items]>;
                                          };

                                            Interfaces

                                            interface ActionCreatorInvariantMiddlewareOptions

                                            interface ActionCreatorInvariantMiddlewareOptions {}

                                              property isActionCreator

                                              isActionCreator?: (action: unknown) => action is Function & {
                                              type?: unknown;
                                              };
                                              • The function to identify whether a value is an action creator. The default checks for a function with a static type property and match method.

                                              interface ActionCreatorWithNonInferrablePayload

                                              interface ActionCreatorWithNonInferrablePayload<T extends string = string>
                                              extends BaseActionCreator<unknown, T> {}
                                              • An action creator of type T whose payload type could not be inferred. Accepts everything as payload.

                                                {redux#ActionCreator}

                                                Modifiers

                                                • @public

                                              call signature

                                              <PT extends unknown>(payload: PT): PayloadAction<PT, T>;

                                              interface ActionCreatorWithOptionalPayload

                                              interface ActionCreatorWithOptionalPayload<P, T extends string = string>
                                              extends BaseActionCreator<P, T> {}
                                              • An action creator of type T that takes an optional payload of type P.

                                                {redux#ActionCreator}

                                                Modifiers

                                                • @public

                                              call signature

                                              (payload?: P): PayloadAction<P, T>;
                                              • Calling this redux#ActionCreator with an argument will return a PayloadAction of type T with a payload of P. Calling it without an argument will return a PayloadAction with a payload of undefined.

                                              interface ActionCreatorWithoutPayload

                                              interface ActionCreatorWithoutPayload<T extends string = string>
                                              extends BaseActionCreator<undefined, T> {}
                                              • An action creator of type T that takes no payload.

                                                {redux#ActionCreator}

                                                Modifiers

                                                • @public

                                              call signature

                                              (noArgument: void): PayloadAction<undefined, T>;

                                              interface ActionCreatorWithPayload

                                              interface ActionCreatorWithPayload<P, T extends string = string>
                                              extends BaseActionCreator<P, T> {}
                                              • An action creator of type T that requires a payload of type P.

                                                {redux#ActionCreator}

                                                Modifiers

                                                • @public

                                              call signature

                                              (payload: P): PayloadAction<P, T>;

                                              interface ActionCreatorWithPreparedPayload

                                              interface ActionCreatorWithPreparedPayload<
                                              Args extends unknown[],
                                              P,
                                              T extends string = string,
                                              E = never,
                                              M = never
                                              > extends BaseActionCreator<P, T, M, E> {}
                                              • An action creator that takes multiple arguments that are passed to a PrepareAction method to create the final Action.

                                                Modifiers

                                                • @public

                                              call signature

                                              (...args: Args): PayloadAction<P, T, M, E>;
                                              • Calling this redux#ActionCreator with Args will return an Action with a payload of type P and (depending on the PrepareAction method used) a meta- and error property of types M and E respectively.

                                              interface ActionReducerMapBuilder

                                              interface ActionReducerMapBuilder<State> {}
                                              • A builder for an action <-> reducer map.

                                                Modifiers

                                                • @public

                                              method addCase

                                              addCase: {
                                              <ActionCreator extends TypedActionCreator<string>>(
                                              actionCreator: ActionCreator,
                                              reducer: CaseReducer<State, ReturnType<ActionCreator>>
                                              ): ActionReducerMapBuilder<State>;
                                              <Type extends string, A extends Action<Type>>(
                                              type: Type,
                                              reducer: CaseReducer<State, A>
                                              ): ActionReducerMapBuilder<State>;
                                              };
                                              • Adds a case reducer to handle a single exact action type.

                                                Parameter actionCreator

                                                Either a plain action type string, or an action creator generated by [createAction](./createAction) that can be used to determine the action type.

                                                Parameter reducer

                                                The actual case reducer function.

                                                Remarks

                                                All calls to builder.addCase must come before any calls to builder.addMatcher or builder.addDefaultCase.

                                              method addDefaultCase

                                              addDefaultCase: (reducer: CaseReducer<State, Action>) => {};
                                              • Adds a "default case" reducer that is executed if no case reducer and no matcher reducer was executed for this action.

                                                Parameter reducer

                                                The fallback "default case" reducer function.

                                                Example 1

                                                ```ts import { createReducer } from '@reduxjs/toolkit' const initialState = { otherActions: 0 } const reducer = createReducer(initialState, builder => { builder // .addCase(...) // .addMatcher(...) .addDefaultCase((state, action) => { state.otherActions++ }) }) ```

                                              method addMatcher

                                              addMatcher: <A>(
                                              matcher: TypeGuard<A> | ((action: any) => boolean),
                                              reducer: CaseReducer<State, A extends Action ? A : A & Action>
                                              ) => Omit<ActionReducerMapBuilder<State>, 'addCase'>;
                                              • Allows you to match your incoming actions against your own filter function instead of only the action.type property.

                                                Parameter matcher

                                                A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates) function

                                                Parameter reducer

                                                The actual case reducer function.

                                                Remarks

                                                If multiple matcher reducers match, all of them will be executed in the order they were defined in - even if a case reducer already matched. All calls to builder.addMatcher must come after any calls to builder.addCase and before any calls to builder.addDefaultCase.

                                                Example 1

                                                ```ts import { createAction, createReducer, AsyncThunk, UnknownAction, } from "@reduxjs/toolkit";

                                                type GenericAsyncThunk = AsyncThunk<unknown, unknown, any>;

                                                type PendingAction = ReturnType<GenericAsyncThunk["pending"]>; type RejectedAction = ReturnType<GenericAsyncThunk["rejected"]>; type FulfilledAction = ReturnType<GenericAsyncThunk["fulfilled"]>;

                                                const initialState: Record<string, string> = {}; const resetAction = createAction("reset-tracked-loading-state");

                                                function isPendingAction(action: UnknownAction): action is PendingAction { return typeof action.type === "string" && action.type.endsWith("/pending"); }

                                                const reducer = createReducer(initialState, (builder) => { builder .addCase(resetAction, () => initialState) // matcher can be defined outside as a type predicate function .addMatcher(isPendingAction, (state, action) => { state[action.meta.requestId] = "pending"; }) .addMatcher( // matcher can be defined inline as a type predicate function (action): action is RejectedAction => action.type.endsWith("/rejected"), (state, action) => { state[action.meta.requestId] = "rejected"; } ) // matcher can just return boolean and the matcher can receive a generic argument .addMatcher( (action) => action.type.endsWith("/fulfilled"), (state, action) => { state[action.meta.requestId] = "fulfilled"; } ); }); ```

                                              interface AsyncTaskExecutor

                                              interface AsyncTaskExecutor<T> {}
                                              • Modifiers

                                                • @public

                                              call signature

                                              (forkApi: ForkedTaskAPI): Promise<T>;

                                                interface ConfigureStoreOptions

                                                interface ConfigureStoreOptions<
                                                S = any,
                                                A extends Action = UnknownAction,
                                                M extends Tuple<Middlewares<S>> = Tuple<Middlewares<S>>,
                                                E extends Tuple<Enhancers> = Tuple<Enhancers>,
                                                P = S
                                                > {}
                                                • Options for configureStore().

                                                  Modifiers

                                                  • @public

                                                property devTools

                                                devTools?: boolean | DevToolsOptions;
                                                • Whether to enable Redux DevTools integration. Defaults to true.

                                                  Additional configuration can be done by passing Redux DevTools options

                                                property enhancers

                                                enhancers?: (getDefaultEnhancers: GetDefaultEnhancers<M>) => E;
                                                • The store enhancers to apply. See Redux's createStore(). All enhancers will be included before the DevTools Extension enhancer. If you need to customize the order of enhancers, supply a callback function that will receive a getDefaultEnhancers function that returns a Tuple, and should return a Tuple of enhancers (such as getDefaultEnhancers().concat(offline)). If you only need to add middleware, you can use the middleware parameter instead.

                                                property middleware

                                                middleware?: (getDefaultMiddleware: GetDefaultMiddleware<S>) => M;
                                                • An array of Redux middleware to install, or a callback receiving getDefaultMiddleware and returning a Tuple of middleware. If not supplied, defaults to the set of middleware returned by getDefaultMiddleware().

                                                  Example 1

                                                  middleware: (gDM) => gDM().concat(logger, apiMiddleware, yourCustomMiddleware)

                                                  See Also

                                                  • https://redux-toolkit.js.org/api/getDefaultMiddleware#intended-usage

                                                property preloadedState

                                                preloadedState?: P;
                                                • The initial state, same as Redux's createStore. You may optionally specify it to hydrate the state from the server in universal apps, or to restore a previously serialized user session. If you use combineReducers() to produce the root reducer function (either directly or indirectly by passing an object as reducer), this must be an object with the same shape as the reducer map keys.

                                                property reducer

                                                reducer: Reducer<S, A, P> | ReducersMapObject<S, A, P>;
                                                • A single reducer function that will be used as the root reducer, or an object of slice reducers that will be passed to combineReducers().

                                                interface CreateListenerMiddlewareOptions

                                                interface CreateListenerMiddlewareOptions<ExtraArgument = unknown> {}
                                                • Modifiers

                                                  • @public

                                                property extra

                                                extra?: ExtraArgument;

                                                  property onError

                                                  onError?: ListenerErrorHandler;
                                                  • Receives synchronous errors that are raised by listener and listenerOption.predicate.

                                                  interface CreateSliceOptions

                                                  interface CreateSliceOptions<
                                                  State = any,
                                                  CR extends SliceCaseReducers<State> = SliceCaseReducers<State>,
                                                  Name extends string = string,
                                                  ReducerPath extends string = Name,
                                                  Selectors extends SliceSelectors<State> = SliceSelectors<State>
                                                  > {}
                                                  • Options for createSlice().

                                                    Modifiers

                                                    • @public

                                                  property extraReducers

                                                  extraReducers?: (builder: ActionReducerMapBuilder<State>) => void;
                                                  • A callback that receives a *builder* object to define case reducers via calls to builder.addCase(actionCreatorOrType, reducer).

                                                    Example 1

                                                    ```ts import { createAction, createSlice, Action } from '@reduxjs/toolkit' const incrementBy = createAction('incrementBy') const decrement = createAction('decrement')

                                                    interface RejectedAction extends Action { error: Error }

                                                    function isRejectedAction(action: Action): action is RejectedAction { return action.type.endsWith('rejected') }

                                                    createSlice({ name: 'counter', initialState: 0, reducers: {}, extraReducers: builder => { builder .addCase(incrementBy, (state, action) => { // action is inferred correctly here if using TS }) // You can chain calls, or have separate builder.addCase() lines each time .addCase(decrement, (state, action) => {}) // You can match a range of action types .addMatcher( isRejectedAction, // action will be inferred as a RejectedAction due to isRejectedAction being defined as a type guard (state, action) => {} ) // and provide a default case if no other handlers matched .addDefaultCase((state, action) => {}) } }) ```

                                                  property initialState

                                                  initialState: State | (() => State);
                                                  • The initial state that should be used when the reducer is called the first time. This may also be a "lazy initializer" function, which should return an initial state value when called. This will be used whenever the reducer is called with undefined as its state value, and is primarily useful for cases like reading initial state from localStorage.

                                                  property name

                                                  name: Name;
                                                  • The slice's name. Used to namespace the generated action types.

                                                  property reducerPath

                                                  reducerPath?: ReducerPath;
                                                  • The slice's reducer path. Used when injecting into a combined slice reducer.

                                                  property reducers

                                                  reducers:
                                                  | ValidateSliceCaseReducers<State, CR>
                                                  | ((creators: ReducerCreators<State>) => CR);
                                                  • A mapping from action types to action-type-specific *case reducer* functions. For every action type, a matching action creator will be generated using createAction().

                                                  property selectors

                                                  selectors?: Selectors;
                                                  • A map of selectors that receive the slice's state and any additional arguments, and return a result.

                                                  interface DevToolsEnhancerOptions

                                                  interface DevToolsEnhancerOptions {}
                                                  • Modifiers

                                                    • @public

                                                  property actionCreators

                                                  actionCreators?:
                                                  | ActionCreator<any>[]
                                                  | {
                                                  [key: string]: ActionCreator<any>;
                                                  };
                                                  • action creators functions to be available in the Dispatcher.

                                                  property actionsAllowlist

                                                  actionsAllowlist?: string | string[];
                                                  • *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers). If actionsAllowlist specified, actionsDenylist is ignored.

                                                  property actionSanitizer

                                                  actionSanitizer?: <A extends Action>(action: A, id: number) => A;
                                                  • function which takes action object and id number as arguments, and should return action object back.

                                                  property actionsDenylist

                                                  actionsDenylist?: string | string[];
                                                  • *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers). If actionsAllowlist specified, actionsDenylist is ignored.

                                                  property autoPause

                                                  autoPause?: boolean;
                                                  • auto pauses when the extension’s window is not opened, and so has zero impact on your app when not in use. Not available for Redux enhancer (as it already does it but storing the data to be sent).

                                                    false

                                                  property features

                                                  features?: {
                                                  /**
                                                  * start/pause recording of dispatched actions
                                                  */
                                                  pause?: boolean;
                                                  /**
                                                  * lock/unlock dispatching actions and side effects
                                                  */
                                                  lock?: boolean;
                                                  /**
                                                  * persist states on page reloading
                                                  */
                                                  persist?: boolean;
                                                  /**
                                                  * export history of actions in a file
                                                  */
                                                  export?: boolean | 'custom';
                                                  /**
                                                  * import history of actions from a file
                                                  */
                                                  import?: boolean | 'custom';
                                                  /**
                                                  * jump back and forth (time travelling)
                                                  */
                                                  jump?: boolean;
                                                  /**
                                                  * skip (cancel) actions
                                                  */
                                                  skip?: boolean;
                                                  /**
                                                  * drag and drop actions in the history list
                                                  */
                                                  reorder?: boolean;
                                                  /**
                                                  * dispatch custom actions or action creators
                                                  */
                                                  dispatch?: boolean;
                                                  /**
                                                  * generate tests for the selected actions
                                                  */
                                                  test?: boolean;
                                                  };
                                                  • If you want to restrict the extension, specify the features you allow. If not specified, all of the features are enabled. When set as an object, only those included as true will be allowed. Note that except true/false, import and export can be set as custom (which is by default for Redux enhancer), meaning that the importing/exporting occurs on the client side. Otherwise, you'll get/set the data right from the monitor part.

                                                  property latency

                                                  latency?: number;
                                                  • if more than one action is dispatched in the indicated interval, all new actions will be collected and sent at once. It is the joint between performance and speed. When set to 0, all actions will be sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).

                                                    500 ms.

                                                  property maxAge

                                                  maxAge?: number;
                                                  • (> 1) - maximum allowed actions to be stored in the history tree. The oldest actions are removed once maxAge is reached. It's critical for performance.

                                                    50

                                                  property name

                                                  name?: string;
                                                  • the instance name to be showed on the monitor page. Default value is document.title. If not specified and there's no document title, it will consist of tabId and instanceId.

                                                  property pauseActionType

                                                  pauseActionType?: string;
                                                  • if specified, whenever clicking on Pause recording button and there are actions in the history log, will add this action type. If not specified, will commit when paused. Available only for Redux enhancer.

                                                    "@@PAUSED""

                                                  property predicate

                                                  predicate?: <S, A extends Action>(state: S, action: A) => boolean;
                                                  • called for every action before sending, takes state and action object, and returns true in case it allows sending the current data to the monitor. Use it as a more advanced version of actionsDenylist/actionsAllowlist parameters.

                                                  property serialize

                                                  serialize?:
                                                  | boolean
                                                  | {
                                                  /**
                                                  * - `undefined` - will use regular `JSON.stringify` to send data (it's the fast mode).
                                                  * - `false` - will handle also circular references.
                                                  * - `true` - will handle also date, regex, undefined, error objects, symbols, maps, sets and functions.
                                                  * - object, which contains `date`, `regex`, `undefined`, `error`, `symbol`, `map`, `set` and `function` keys.
                                                  * For each of them you can indicate if to include (by setting as `true`).
                                                  * For `function` key you can also specify a custom function which handles serialization.
                                                  * See [`jsan`](https://github.com/kolodny/jsan) for more details.
                                                  */
                                                  options?:
                                                  | undefined
                                                  | boolean
                                                  | {
                                                  date?: true;
                                                  regex?: true;
                                                  undefined?: true;
                                                  error?: true;
                                                  symbol?: true;
                                                  map?: true;
                                                  set?: true;
                                                  function?: true | ((fn: (...args: any[]) => any) => string);
                                                  };
                                                  /**
                                                  * [JSON replacer function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) used for both actions and states stringify.
                                                  * In addition, you can specify a data type by adding a [`__serializedType__`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/helpers/index.js#L4)
                                                  * key. So you can deserialize it back while importing or persisting data.
                                                  * Moreover, it will also [show a nice preview showing the provided custom type](https://cloud.githubusercontent.com/assets/7957859/21814330/a17d556a-d761-11e6-85ef-159dd12f36c5.png):
                                                  */
                                                  replacer?: (key: string, value: unknown) => any;
                                                  /**
                                                  * [JSON `reviver` function](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter)
                                                  * used for parsing the imported actions and states. See [`remotedev-serialize`](https://github.com/zalmoxisus/remotedev-serialize/blob/master/immutable/serialize.js#L8-L41)
                                                  * as an example on how to serialize special data types and get them back.
                                                  */
                                                  reviver?: (key: string, value: unknown) => any;
                                                  /**
                                                  * Automatically serialize/deserialize immutablejs via [remotedev-serialize](https://github.com/zalmoxisus/remotedev-serialize).
                                                  * Just pass the Immutable library. It will support all ImmutableJS structures. You can even export them into a file and get them back.
                                                  * The only exception is `Record` class, for which you should pass this in addition the references to your classes in `refs`.
                                                  */
                                                  immutable?: any;
                                                  /**
                                                  * ImmutableJS `Record` classes used to make possible restore its instances back when importing, persisting...
                                                  */
                                                  refs?: any;
                                                  };
                                                  • Customizes how actions and state are serialized and deserialized. Can be a boolean or object. If given a boolean, the behavior is the same as if you were to pass an object and specify options as a boolean. Giving an object allows fine-grained customization using the replacer and reviver functions.

                                                  property shouldCatchErrors

                                                  shouldCatchErrors?: boolean;
                                                  • if specified as true, whenever there's an exception in reducers, the monitors will show the error message, and next actions will not be dispatched.

                                                    false

                                                  property shouldHotReload

                                                  shouldHotReload?: boolean;
                                                  • if set to false, will not recompute the states on hot reloading (or on replacing the reducers). Available only for Redux enhancer.

                                                    true

                                                  property shouldRecordChanges

                                                  shouldRecordChanges?: boolean;
                                                  • if specified as false, it will not record the changes till clicking on Start recording button. Available only for Redux enhancer, for others use autoPause.

                                                    true

                                                  property shouldStartLocked

                                                  shouldStartLocked?: boolean;
                                                  • if specified as true, it will not allow any non-monitor actions to be dispatched till clicking on Unlock changes button. Available only for Redux enhancer.

                                                    false

                                                  property stateSanitizer

                                                  stateSanitizer?: <S>(state: S, index: number) => S;
                                                  • function which takes state object and index as arguments, and should return state object back.

                                                  property trace

                                                  trace?: boolean | (<A extends Action>(action: A) => string);
                                                  • Set to true or a stacktrace-returning function to record call stack traces for dispatched actions. Defaults to false.

                                                  property traceLimit

                                                  traceLimit?: number;
                                                  • The maximum number of stack trace entries to record per action. Defaults to 10.

                                                  interface EntityAdapter

                                                  interface EntityAdapter<T, Id extends EntityId>
                                                  extends EntityStateAdapter<T, Id>,
                                                  EntityStateFactory<T, Id>,
                                                  Required<EntityAdapterOptions<T, Id>> {}
                                                  • Modifiers

                                                    • @public

                                                  method getSelectors

                                                  getSelectors: {
                                                  (selectState?: undefined, options?: GetSelectorsOptions): EntitySelectors<
                                                  T,
                                                  EntityState<T, Id>,
                                                  Id
                                                  >;
                                                  <V>(
                                                  selectState: (state: V) => EntityState<T, Id>,
                                                  options?: GetSelectorsOptions
                                                  ): EntitySelectors<T, V, Id>;
                                                  };

                                                    interface EntitySelectors

                                                    interface EntitySelectors<T, V, Id extends EntityId> {}
                                                    • Modifiers

                                                      • @public

                                                    property selectAll

                                                    selectAll: (state: V) => T[];

                                                      property selectById

                                                      selectById: (state: V, id: Id) => Compute<UncheckedIndexedAccess<T>>;

                                                        property selectEntities

                                                        selectEntities: (state: V) => Record<Id, T>;

                                                          property selectIds

                                                          selectIds: (state: V) => Id[];

                                                            property selectTotal

                                                            selectTotal: (state: V) => number;

                                                              interface EntityState

                                                              interface EntityState<T, Id extends EntityId> {}
                                                              • Modifiers

                                                                • @public

                                                              property entities

                                                              entities: Record<Id, T>;

                                                                property ids

                                                                ids: Id[];

                                                                  interface EntityStateAdapter

                                                                  interface EntityStateAdapter<T, Id extends EntityId> {}
                                                                  • Modifiers

                                                                    • @public

                                                                  method addMany

                                                                  addMany: {
                                                                  <S extends unknown>(
                                                                  state: PreventAny<S, T, Id>,
                                                                  entities: readonly T[] | Record<Id, T>
                                                                  ): S;
                                                                  <S extends unknown>(
                                                                  state: IsAny<S, EntityState<T, Id>, S>,
                                                                  entities: { payload: readonly T[] | Record<Id, T>; type: string }
                                                                  ): S;
                                                                  };

                                                                    method addOne

                                                                    addOne: {
                                                                    <S extends unknown>(state: PreventAny<S, T, Id>, entity: T): S;
                                                                    <S extends unknown>(
                                                                    state: IsAny<S, EntityState<T, Id>, S>,
                                                                    action: { payload: T; type: string }
                                                                    ): S;
                                                                    };

                                                                      method removeAll

                                                                      removeAll: <S extends unknown>(state: PreventAny<S, T, Id>) => S;

                                                                        method removeMany

                                                                        removeMany: {
                                                                        <S extends unknown>(state: PreventAny<S, T, Id>, keys: readonly Id[]): S;
                                                                        <S extends unknown>(
                                                                        state: IsAny<S, EntityState<T, Id>, S>,
                                                                        keys: { payload: readonly Id[]; type: string }
                                                                        ): S;
                                                                        };

                                                                          method removeOne

                                                                          removeOne: {
                                                                          <S extends unknown>(state: PreventAny<S, T, Id>, key: Id): S;
                                                                          <S extends unknown>(
                                                                          state: IsAny<S, EntityState<T, Id>, S>,
                                                                          key: { payload: Id; type: string }
                                                                          ): S;
                                                                          };

                                                                            method setAll

                                                                            setAll: {
                                                                            <S extends unknown>(
                                                                            state: PreventAny<S, T, Id>,
                                                                            entities: readonly T[] | Record<Id, T>
                                                                            ): S;
                                                                            <S extends unknown>(
                                                                            state: IsAny<S, EntityState<T, Id>, S>,
                                                                            entities: { payload: readonly T[] | Record<Id, T>; type: string }
                                                                            ): S;
                                                                            };

                                                                              method setMany

                                                                              setMany: {
                                                                              <S extends unknown>(
                                                                              state: PreventAny<S, T, Id>,
                                                                              entities: readonly T[] | Record<Id, T>
                                                                              ): S;
                                                                              <S extends unknown>(
                                                                              state: IsAny<S, EntityState<T, Id>, S>,
                                                                              entities: { payload: readonly T[] | Record<Id, T>; type: string }
                                                                              ): S;
                                                                              };

                                                                                method setOne

                                                                                setOne: {
                                                                                <S extends unknown>(state: PreventAny<S, T, Id>, entity: T): S;
                                                                                <S extends unknown>(
                                                                                state: IsAny<S, EntityState<T, Id>, S>,
                                                                                action: { payload: T; type: string }
                                                                                ): S;
                                                                                };

                                                                                  method updateMany

                                                                                  updateMany: {
                                                                                  <S extends unknown>(
                                                                                  state: PreventAny<S, T, Id>,
                                                                                  updates: ReadonlyArray<Update<T, Id>>
                                                                                  ): S;
                                                                                  <S extends unknown>(
                                                                                  state: IsAny<S, EntityState<T, Id>, S>,
                                                                                  updates: { payload: readonly Update<T, Id>[]; type: string }
                                                                                  ): S;
                                                                                  };

                                                                                    method updateOne

                                                                                    updateOne: {
                                                                                    <S extends unknown>(state: PreventAny<S, T, Id>, update: Update<T, Id>): S;
                                                                                    <S extends unknown>(
                                                                                    state: IsAny<S, EntityState<T, Id>, S>,
                                                                                    update: { payload: Update<T, Id>; type: string }
                                                                                    ): S;
                                                                                    };

                                                                                      method upsertMany

                                                                                      upsertMany: {
                                                                                      <S extends unknown>(
                                                                                      state: PreventAny<S, T, Id>,
                                                                                      entities: readonly T[] | Record<Id, T>
                                                                                      ): S;
                                                                                      <S extends unknown>(
                                                                                      state: IsAny<S, EntityState<T, Id>, S>,
                                                                                      entities: { payload: readonly T[] | Record<Id, T>; type: string }
                                                                                      ): S;
                                                                                      };

                                                                                        method upsertOne

                                                                                        upsertOne: {
                                                                                        <S extends unknown>(state: PreventAny<S, T, Id>, entity: T): S;
                                                                                        <S extends unknown>(
                                                                                        state: IsAny<S, EntityState<T, Id>, S>,
                                                                                        entity: { payload: T; type: string }
                                                                                        ): S;
                                                                                        };

                                                                                          interface ForkedTask

                                                                                          interface ForkedTask<T> {}
                                                                                          • Modifiers

                                                                                            • @public

                                                                                          property result

                                                                                          result: Promise<TaskResult<T>>;
                                                                                          • A promise that resolves when the task is either completed or cancelled or rejects if parent listener execution is cancelled or completed.

                                                                                            ### Example

                                                                                            const result = await fork(async (forkApi) => Promise.resolve(4)).result
                                                                                            if(result.status === 'ok') {
                                                                                            console.log(result.value) // logs 4
                                                                                            }}

                                                                                          method cancel

                                                                                          cancel: () => void;
                                                                                          • Cancel task if it is in progress or not yet started, it is noop otherwise.

                                                                                          interface ForkedTaskAPI

                                                                                          interface ForkedTaskAPI {}
                                                                                          • Modifiers

                                                                                            • @public

                                                                                          property signal

                                                                                          signal: AbortSignal;
                                                                                          • An abort signal whose aborted property is set to true if the task execution is either aborted or completed.

                                                                                            See Also

                                                                                            • https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

                                                                                          method delay

                                                                                          delay: (timeoutMs: number) => Promise<void>;
                                                                                          • Returns a promise that resolves after timeoutMs or rejects if the task or the parent listener has been cancelled or is completed.

                                                                                            Parameter timeoutMs

                                                                                          method pause

                                                                                          pause: <W>(waitFor: Promise<W>) => Promise<W>;
                                                                                          • Returns a promise that resolves when waitFor resolves or rejects if the task or the parent listener has been cancelled or is completed.

                                                                                          interface ImmutableStateInvariantMiddlewareOptions

                                                                                          interface ImmutableStateInvariantMiddlewareOptions {}
                                                                                          • Options for createImmutableStateInvariantMiddleware().

                                                                                            Modifiers

                                                                                            • @public

                                                                                          property ignoredPaths

                                                                                          ignoredPaths?: IgnorePaths;
                                                                                          • An array of dot-separated path strings that match named nodes from the root state to ignore when checking for immutability. Defaults to undefined

                                                                                          property isImmutable

                                                                                          isImmutable?: IsImmutableFunc;
                                                                                          • Callback function to check if a value is considered to be immutable. This function is applied recursively to every value contained in the state. The default implementation will return true for primitive types (like numbers, strings, booleans, null and undefined).

                                                                                          property warnAfter

                                                                                          warnAfter?: number;
                                                                                          • Print a warning if checks take longer than N ms. Default: 32ms

                                                                                          interface ListenerEffectAPI

                                                                                          interface ListenerEffectAPI<
                                                                                          State,
                                                                                          Dispatch extends ReduxDispatch,
                                                                                          ExtraArgument = unknown
                                                                                          > extends MiddlewareAPI<Dispatch, State> {}
                                                                                          • Modifiers

                                                                                            • @public

                                                                                          property cancel

                                                                                          cancel: () => void;
                                                                                          • Cancels the instance of this listener that made this call.

                                                                                          property cancelActiveListeners

                                                                                          cancelActiveListeners: () => void;
                                                                                          • Cancels all other running instances of this same listener except for the one that made this call.

                                                                                          property condition

                                                                                          condition: ConditionFunction<State>;
                                                                                          • Returns a promise that resolves when the input predicate returns true or rejects if the listener has been cancelled or is completed.

                                                                                            The return value is true if the predicate succeeds or false if a timeout is provided and expires first.

                                                                                            ### Example

                                                                                            const updateBy = createAction<number>('counter/updateBy');
                                                                                            middleware.startListening({
                                                                                            actionCreator: updateBy,
                                                                                            async effect(_, { condition }) {
                                                                                            // wait at most 3s for `updateBy` actions.
                                                                                            if(await condition(updateBy.match, 3_000)) {
                                                                                            // `updateBy` has been dispatched twice in less than 3s.
                                                                                            }
                                                                                            }
                                                                                            })

                                                                                          property extra

                                                                                          extra: ExtraArgument;

                                                                                            property getOriginalState

                                                                                            getOriginalState: () => State;
                                                                                            • Returns the store state as it existed when the action was originally dispatched, _before_ the reducers ran.

                                                                                              ### Synchronous invocation

                                                                                              This function can **only** be invoked **synchronously**, it throws error otherwise.

                                                                                              Example 1

                                                                                              middleware.startListening({
                                                                                              predicate: () => true,
                                                                                              async effect(_, { getOriginalState }) {
                                                                                              getOriginalState(); // sync: OK!
                                                                                              setTimeout(getOriginalState, 0); // async: throws Error
                                                                                              await Promise().resolve();
                                                                                              getOriginalState() // async: throws Error
                                                                                              }
                                                                                              })

                                                                                            property signal

                                                                                            signal: AbortSignal;
                                                                                            • An abort signal whose aborted property is set to true if the listener execution is either aborted or completed.

                                                                                              See Also

                                                                                              • https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

                                                                                            property take

                                                                                            take: TakePattern<State>;
                                                                                            • Returns a promise that resolves when the input predicate returns true or rejects if the listener has been cancelled or is completed.

                                                                                              The return value is the [action, currentState, previousState] combination that the predicate saw as arguments.

                                                                                              The promise resolves to null if a timeout is provided and expires first,

                                                                                              ### Example

                                                                                              const updateBy = createAction<number>('counter/updateBy');
                                                                                              middleware.startListening({
                                                                                              actionCreator: updateBy,
                                                                                              async effect(_, { take }) {
                                                                                              const [{ payload }] = await take(updateBy.match);
                                                                                              console.log(payload); // logs 5;
                                                                                              }
                                                                                              })
                                                                                              store.dispatch(updateBy(5));

                                                                                            property throwIfCancelled

                                                                                            throwIfCancelled: () => void;
                                                                                            • Throws a TaskAbortError if this listener has been cancelled

                                                                                            method delay

                                                                                            delay: (timeoutMs: number) => Promise<void>;
                                                                                            • Returns a promise that resolves after timeoutMs or rejects if the listener has been cancelled or is completed.

                                                                                            method fork

                                                                                            fork: <T>(
                                                                                            executor: ForkedTaskExecutor<T>,
                                                                                            options?: ForkOptions
                                                                                            ) => ForkedTask<T>;
                                                                                            • Queues in the next microtask the execution of a task.

                                                                                              Parameter executor

                                                                                              Parameter options

                                                                                            method pause

                                                                                            pause: <M>(promise: Promise<M>) => Promise<M>;
                                                                                            • Returns a promise that resolves when waitFor resolves or rejects if the listener has been cancelled or is completed.

                                                                                              Parameter promise

                                                                                            method subscribe

                                                                                            subscribe: () => void;
                                                                                            • It will subscribe a listener if it was previously removed, noop otherwise.

                                                                                            method unsubscribe

                                                                                            unsubscribe: () => void;
                                                                                            • Removes the listener entry from the middleware and prevent future instances of the listener from running.

                                                                                              It does **not** cancel any active instances.

                                                                                            interface ListenerErrorHandler

                                                                                            interface ListenerErrorHandler {}
                                                                                            • Gets notified with synchronous and asynchronous errors raised by listeners or predicates.

                                                                                              Parameter error

                                                                                              The thrown error.

                                                                                              Parameter errorInfo

                                                                                              Additional information regarding the thrown error.

                                                                                              Modifiers

                                                                                              • @public

                                                                                            call signature

                                                                                            (error: unknown, errorInfo: ListenerErrorInfo): void;

                                                                                              interface ListenerMiddlewareInstance

                                                                                              interface ListenerMiddlewareInstance<
                                                                                              StateType = unknown,
                                                                                              DispatchType extends ThunkDispatch<
                                                                                              StateType,
                                                                                              unknown,
                                                                                              ReduxAction
                                                                                              > = ThunkDispatch<StateType, unknown, UnknownAction>,
                                                                                              ExtraArgument = unknown
                                                                                              > {}
                                                                                              • Modifiers

                                                                                                • @public

                                                                                              property clearListeners

                                                                                              clearListeners: () => void;
                                                                                              • Unsubscribes all listeners, cancels running listeners and tasks.

                                                                                              property middleware

                                                                                              middleware: ListenerMiddleware<StateType, DispatchType, ExtraArgument>;

                                                                                                property startListening

                                                                                                startListening: AddListenerOverloads<
                                                                                                UnsubscribeListener,
                                                                                                StateType,
                                                                                                DispatchType,
                                                                                                ExtraArgument
                                                                                                > &
                                                                                                TypedStartListening<StateType, DispatchType, ExtraArgument>;

                                                                                                  property stopListening

                                                                                                  stopListening: RemoveListenerOverloads<StateType, DispatchType> &
                                                                                                  TypedStopListening<StateType, DispatchType>;

                                                                                                    interface ReducerCreators

                                                                                                    interface ReducerCreators<State> {}

                                                                                                      property asyncThunk

                                                                                                      asyncThunk: AsyncThunkCreator<State>;

                                                                                                        method preparedReducer

                                                                                                        preparedReducer: <Prepare extends PrepareAction<any>>(
                                                                                                        prepare: Prepare,
                                                                                                        reducer: CaseReducer<
                                                                                                        State,
                                                                                                        ReturnType<_ActionCreatorWithPreparedPayload<Prepare>>
                                                                                                        >
                                                                                                        ) => {
                                                                                                        _reducerDefinitionType: ReducerType.reducerWithPrepare;
                                                                                                        prepare: Prepare;
                                                                                                        reducer: CaseReducer<
                                                                                                        State,
                                                                                                        ReturnType<_ActionCreatorWithPreparedPayload<Prepare>>
                                                                                                        >;
                                                                                                        };

                                                                                                          method reducer

                                                                                                          reducer: {
                                                                                                          (caseReducer: CaseReducer<State, PayloadAction>): CaseReducerDefinition<
                                                                                                          State,
                                                                                                          PayloadAction
                                                                                                          >;
                                                                                                          <Payload>(
                                                                                                          caseReducer: CaseReducer<State, { payload: Payload; type: string }>
                                                                                                          ): CaseReducerDefinition<State, { payload: Payload; type: string }>;
                                                                                                          };

                                                                                                            interface SerializableStateInvariantMiddlewareOptions

                                                                                                            interface SerializableStateInvariantMiddlewareOptions {}
                                                                                                            • Options for createSerializableStateInvariantMiddleware().

                                                                                                              Modifiers

                                                                                                              • @public

                                                                                                            property disableCache

                                                                                                            disableCache?: boolean;
                                                                                                            • Opt out of caching the results. The cache uses a WeakSet and speeds up repeated checking processes. The cache is automatically disabled if no browser support for WeakSet is present.

                                                                                                            property getEntries

                                                                                                            getEntries?: (value: any) => [string, any][];
                                                                                                            • The function that will be used to retrieve entries from each value. If unspecified, Object.entries will be used. Defaults to undefined.

                                                                                                            property ignoreActions

                                                                                                            ignoreActions?: boolean;
                                                                                                            • Opt out of checking actions. When set to true, other action-related params will be ignored.

                                                                                                            property ignoredActionPaths

                                                                                                            ignoredActionPaths?: (string | RegExp)[];
                                                                                                            • An array of dot-separated path strings or regular expressions to ignore when checking for serializability, Defaults to ['meta.arg', 'meta.baseQueryMeta']

                                                                                                            property ignoredActions

                                                                                                            ignoredActions?: string[];
                                                                                                            • An array of action types to ignore when checking for serializability. Defaults to []

                                                                                                            property ignoredPaths

                                                                                                            ignoredPaths?: (string | RegExp)[];
                                                                                                            • An array of dot-separated path strings or regular expressions to ignore when checking for serializability, Defaults to []

                                                                                                            property ignoreState

                                                                                                            ignoreState?: boolean;
                                                                                                            • Opt out of checking state. When set to true, other state-related params will be ignored.

                                                                                                            property isSerializable

                                                                                                            isSerializable?: (value: any) => boolean;
                                                                                                            • The function to check if a value is considered serializable. This function is applied recursively to every value contained in the state. Defaults to isPlain().

                                                                                                            property warnAfter

                                                                                                            warnAfter?: number;
                                                                                                            • Execution time warning threshold. If the middleware takes longer than warnAfter ms, a warning will be displayed in the console. Defaults to 32ms.

                                                                                                            interface SerializedError

                                                                                                            interface SerializedError {}
                                                                                                            • Modifiers

                                                                                                              • @public

                                                                                                            property code

                                                                                                            code?: string;

                                                                                                              property message

                                                                                                              message?: string;

                                                                                                                property name

                                                                                                                name?: string;

                                                                                                                  property stack

                                                                                                                  stack?: string;

                                                                                                                    interface Slice

                                                                                                                    interface Slice<
                                                                                                                    State = any,
                                                                                                                    CaseReducers extends SliceCaseReducers<State> = SliceCaseReducers<State>,
                                                                                                                    Name extends string = string,
                                                                                                                    ReducerPath extends string = Name,
                                                                                                                    Selectors extends SliceSelectors<State> = SliceSelectors<State>
                                                                                                                    > {}
                                                                                                                    • The return value of createSlice

                                                                                                                      Modifiers

                                                                                                                      • @public

                                                                                                                    property actions

                                                                                                                    actions: CaseReducerActions<CaseReducers, Name>;
                                                                                                                    • Action creators for the types of actions that are handled by the slice reducer.

                                                                                                                    property caseReducers

                                                                                                                    caseReducers: SliceDefinedCaseReducers<CaseReducers>;
                                                                                                                    • The individual case reducer functions that were passed in the reducers parameter. This enables reuse and testing if they were defined inline when calling createSlice.

                                                                                                                    property getInitialState

                                                                                                                    getInitialState: () => State;
                                                                                                                    • Provides access to the initial state value given to the slice. If a lazy state initializer was provided, it will be called and a fresh value returned.

                                                                                                                    property name

                                                                                                                    name: Name;
                                                                                                                    • The slice name.

                                                                                                                    property reducer

                                                                                                                    reducer: Reducer<State>;
                                                                                                                    • The slice's reducer.

                                                                                                                    property reducerPath

                                                                                                                    reducerPath: ReducerPath;
                                                                                                                    • The slice reducer path.

                                                                                                                    method getSelectors

                                                                                                                    getSelectors: {
                                                                                                                    (): Id<SliceDefinedSelectors<State, Selectors, State>>;
                                                                                                                    <RootState>(selectState: (rootState: RootState) => State): {
                                                                                                                    [K in keyof SliceDefinedSelectors<
                                                                                                                    State,
                                                                                                                    Selectors,
                                                                                                                    RootState
                                                                                                                    >]: SliceDefinedSelectors<State, Selectors, RootState>[K];
                                                                                                                    };
                                                                                                                    };
                                                                                                                    • Get localised slice selectors (expects to be called with *just* the slice's state as the first parameter)

                                                                                                                    • Get globalised slice selectors (selectState callback is expected to receive first parameter and return slice state)

                                                                                                                    method injectInto

                                                                                                                    injectInto: <NewReducerPath extends string = ReducerPath>(
                                                                                                                    this: this,
                                                                                                                    injectable: {
                                                                                                                    inject: (
                                                                                                                    slice: { reducerPath: string; reducer: Reducer },
                                                                                                                    config?: InjectConfig
                                                                                                                    ) => void;
                                                                                                                    },
                                                                                                                    config?: InjectIntoConfig<NewReducerPath>
                                                                                                                    ) => InjectedSlice<State, CaseReducers, Name, NewReducerPath, Selectors>;
                                                                                                                    • Inject slice into provided reducer (return value from combineSlices), and return injected slice.

                                                                                                                    method selectSlice

                                                                                                                    selectSlice: (state: { [K in ReducerPath]: State }) => State;
                                                                                                                    • Select the slice state, using the slice's current reducerPath.

                                                                                                                      Will throw an error if slice is not found.

                                                                                                                    index signature

                                                                                                                    get selectors(): Id<
                                                                                                                    SliceDefinedSelectors<
                                                                                                                    State,
                                                                                                                    Selectors,
                                                                                                                    {
                                                                                                                    [K in ReducerPath]: State;
                                                                                                                    }
                                                                                                                    >
                                                                                                                    >;
                                                                                                                    • Selectors that assume the slice's state is rootState[slice.reducerPath] (which is usually the case)

                                                                                                                      Equivalent to slice.getSelectors((state: RootState) => state[slice.reducerPath]).

                                                                                                                    interface SyncTaskExecutor

                                                                                                                    interface SyncTaskExecutor<T> {}
                                                                                                                    • Modifiers

                                                                                                                      • @public

                                                                                                                    call signature

                                                                                                                    (forkApi: ForkedTaskAPI): T;

                                                                                                                      interface UnsubscribeListenerOptions

                                                                                                                      interface UnsubscribeListenerOptions {}
                                                                                                                      • Modifiers

                                                                                                                        • @public

                                                                                                                      property cancelActive

                                                                                                                      cancelActive?: true;

                                                                                                                        Enums

                                                                                                                        enum ReducerType

                                                                                                                        enum ReducerType {
                                                                                                                        reducer = 'reducer',
                                                                                                                        reducerWithPrepare = 'reducerWithPrepare',
                                                                                                                        asyncThunk = 'asyncThunk',
                                                                                                                        }

                                                                                                                          member asyncThunk

                                                                                                                          asyncThunk = 'asyncThunk'

                                                                                                                            member reducer

                                                                                                                            reducer = 'reducer'

                                                                                                                              member reducerWithPrepare

                                                                                                                              reducerWithPrepare = 'reducerWithPrepare'

                                                                                                                                Type Aliases

                                                                                                                                type ActionMatchingAllOf

                                                                                                                                type ActionMatchingAllOf<Matchers extends [...Matcher<any>[]]> = UnionToIntersection<
                                                                                                                                ActionMatchingAnyOf<Matchers>
                                                                                                                                >;
                                                                                                                                • Modifiers

                                                                                                                                  • @public

                                                                                                                                type ActionMatchingAnyOf

                                                                                                                                type ActionMatchingAnyOf<Matchers extends [...Matcher<any>[]]> = ActionFromMatcher<
                                                                                                                                Matchers[number]
                                                                                                                                >;
                                                                                                                                • Modifiers

                                                                                                                                  • @public

                                                                                                                                type Actions

                                                                                                                                type Actions<T extends keyof any = string> = Record<T, Action>;
                                                                                                                                • Defines a mapping from action types to corresponding action object shapes.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                  Deprecated

                                                                                                                                  This should not be used manually - it is only used for internal inference purposes and should not have any further value. It might be removed in the future.

                                                                                                                                type AsyncThunk

                                                                                                                                type AsyncThunk<
                                                                                                                                Returned,
                                                                                                                                ThunkArg,
                                                                                                                                ThunkApiConfig extends AsyncThunkConfig
                                                                                                                                > = AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
                                                                                                                                pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig>;
                                                                                                                                rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>;
                                                                                                                                fulfilled: AsyncThunkFulfilledActionCreator<Returned, ThunkArg, ThunkApiConfig>;
                                                                                                                                settled: (
                                                                                                                                action: any
                                                                                                                                ) => action is ReturnType<
                                                                                                                                | AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
                                                                                                                                | AsyncThunkFulfilledActionCreator<Returned, ThunkArg, ThunkApiConfig>
                                                                                                                                >;
                                                                                                                                typePrefix: string;
                                                                                                                                };
                                                                                                                                • A type describing the return value of createAsyncThunk. Might be useful for wrapping createAsyncThunk in custom abstractions.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                type AsyncThunkAction

                                                                                                                                type AsyncThunkAction<
                                                                                                                                Returned,
                                                                                                                                ThunkArg,
                                                                                                                                ThunkApiConfig extends AsyncThunkConfig
                                                                                                                                > = (
                                                                                                                                dispatch: GetDispatch<ThunkApiConfig>,
                                                                                                                                getState: () => GetState<ThunkApiConfig>,
                                                                                                                                extra: GetExtra<ThunkApiConfig>
                                                                                                                                ) => SafePromise<
                                                                                                                                | ReturnType<AsyncThunkFulfilledActionCreator<Returned, ThunkArg>>
                                                                                                                                | ReturnType<AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>>
                                                                                                                                > & {
                                                                                                                                abort: (reason?: string) => void;
                                                                                                                                requestId: string;
                                                                                                                                arg: ThunkArg;
                                                                                                                                unwrap: () => Promise<Returned>;
                                                                                                                                };
                                                                                                                                • A ThunkAction created by createAsyncThunk. Dispatching it returns a Promise for either a fulfilled or rejected action. Also, the returned value contains an abort() method that allows the asyncAction to be cancelled from the outside.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                type AsyncThunkOptions

                                                                                                                                type AsyncThunkOptions<
                                                                                                                                ThunkArg = void,
                                                                                                                                ThunkApiConfig extends AsyncThunkConfig = {}
                                                                                                                                > = {
                                                                                                                                /**
                                                                                                                                * A method to control whether the asyncThunk should be executed. Has access to the
                                                                                                                                * `arg`, `api.getState()` and `api.extra` arguments.
                                                                                                                                *
                                                                                                                                * @returns `false` if it should be skipped
                                                                                                                                */
                                                                                                                                condition?(
                                                                                                                                arg: ThunkArg,
                                                                                                                                api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>
                                                                                                                                ): MaybePromise<boolean | undefined>;
                                                                                                                                /**
                                                                                                                                * If `condition` returns `false`, the asyncThunk will be skipped.
                                                                                                                                * This option allows you to control whether a `rejected` action with `meta.condition == false`
                                                                                                                                * will be dispatched or not.
                                                                                                                                *
                                                                                                                                * @default `false`
                                                                                                                                */
                                                                                                                                dispatchConditionRejection?: boolean;
                                                                                                                                serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>;
                                                                                                                                /**
                                                                                                                                * A function to use when generating the `requestId` for the request sequence.
                                                                                                                                *
                                                                                                                                * @default `nanoid`
                                                                                                                                */
                                                                                                                                idGenerator?: (arg: ThunkArg) => string;
                                                                                                                                } & IsUnknown<
                                                                                                                                GetPendingMeta<ThunkApiConfig>,
                                                                                                                                {
                                                                                                                                /**
                                                                                                                                * A method to generate additional properties to be added to `meta` of the pending action.
                                                                                                                                *
                                                                                                                                * Using this optional overload will not modify the types correctly, this overload is only in place to support JavaScript users.
                                                                                                                                * Please use the `ThunkApiConfig` parameter `pendingMeta` to get access to a correctly typed overload
                                                                                                                                */
                                                                                                                                getPendingMeta?(
                                                                                                                                base: {
                                                                                                                                arg: ThunkArg;
                                                                                                                                requestId: string;
                                                                                                                                },
                                                                                                                                api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>
                                                                                                                                ): GetPendingMeta<ThunkApiConfig>;
                                                                                                                                },
                                                                                                                                {
                                                                                                                                /**
                                                                                                                                * A method to generate additional properties to be added to `meta` of the pending action.
                                                                                                                                */
                                                                                                                                getPendingMeta(
                                                                                                                                base: {
                                                                                                                                arg: ThunkArg;
                                                                                                                                requestId: string;
                                                                                                                                },
                                                                                                                                api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>
                                                                                                                                ): GetPendingMeta<ThunkApiConfig>;
                                                                                                                                }
                                                                                                                                >;
                                                                                                                                • Options object for createAsyncThunk.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                type AsyncThunkPayloadCreator

                                                                                                                                type AsyncThunkPayloadCreator<
                                                                                                                                Returned,
                                                                                                                                ThunkArg = void,
                                                                                                                                ThunkApiConfig extends AsyncThunkConfig = {}
                                                                                                                                > = (
                                                                                                                                arg: ThunkArg,
                                                                                                                                thunkAPI: GetThunkAPI<ThunkApiConfig>
                                                                                                                                ) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>;
                                                                                                                                • A type describing the payloadCreator argument to createAsyncThunk. Might be useful for wrapping createAsyncThunk in custom abstractions.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                type AsyncThunkPayloadCreatorReturnValue

                                                                                                                                type AsyncThunkPayloadCreatorReturnValue<
                                                                                                                                Returned,
                                                                                                                                ThunkApiConfig extends AsyncThunkConfig
                                                                                                                                > = MaybePromise<
                                                                                                                                | IsUnknown<
                                                                                                                                GetFulfilledMeta<ThunkApiConfig>,
                                                                                                                                Returned,
                                                                                                                                FulfillWithMeta<Returned, GetFulfilledMeta<ThunkApiConfig>>
                                                                                                                                >
                                                                                                                                | RejectWithValue<
                                                                                                                                GetRejectValue<ThunkApiConfig>,
                                                                                                                                GetRejectedMeta<ThunkApiConfig>
                                                                                                                                >
                                                                                                                                >;
                                                                                                                                • A type describing the return value of the payloadCreator argument to createAsyncThunk. Might be useful for wrapping createAsyncThunk in custom abstractions.

                                                                                                                                  Modifiers

                                                                                                                                  • @public

                                                                                                                                type AutoBatchOptions

                                                                                                                                type AutoBatchOptions =
                                                                                                                                | {
                                                                                                                                type: 'tick';
                                                                                                                                }
                                                                                                                                | {
                                                                                                                                type: 'timer';
                                                                                                                                timeout: number;
                                                                                                                                }
                                                                                                                                | {
                                                                                                                                type: 'raf';
                                                                                                                                }
                                                                                                                                | {
                                                                                                                                type: 'callback';
                                                                                                                                queueNotification: (notify: () => void) => void;
                                                                                                                                };

                                                                                                                                  type CaseReducer

                                                                                                                                  type CaseReducer<S = any, A extends Action = UnknownAction> = (
                                                                                                                                  state: Draft<S>,
                                                                                                                                  action: A
                                                                                                                                  ) => NoInfer<S> | void | Draft<NoInfer<S>>;
                                                                                                                                  • A *case reducer* is a reducer function for a specific action type. Case reducers can be composed to full reducers using createReducer().

                                                                                                                                    Unlike a normal Redux reducer, a case reducer is never called with an undefined state to determine the initial state. Instead, the initial state is explicitly specified as an argument to createReducer().

                                                                                                                                    In addition, a case reducer can choose to mutate the passed-in state value directly instead of returning a new state. This does not actually cause the store state to be mutated directly; instead, thanks to [immer](https://github.com/mweststrate/immer), the mutations are translated to copy operations that result in a new state.

                                                                                                                                    Modifiers

                                                                                                                                    • @public

                                                                                                                                  type CaseReducerActions

                                                                                                                                  type CaseReducerActions<
                                                                                                                                  CaseReducers extends SliceCaseReducers<any>,
                                                                                                                                  SliceName extends string
                                                                                                                                  > = {
                                                                                                                                  [Type in keyof CaseReducers]: CaseReducers[Type] extends infer Definition
                                                                                                                                  ? Definition extends {
                                                                                                                                  prepare: any;
                                                                                                                                  }
                                                                                                                                  ? ActionCreatorForCaseReducerWithPrepare<
                                                                                                                                  Definition,
                                                                                                                                  SliceActionType<SliceName, Type>
                                                                                                                                  >
                                                                                                                                  : Definition extends AsyncThunkSliceReducerDefinition<
                                                                                                                                  any,
                                                                                                                                  infer ThunkArg,
                                                                                                                                  infer Returned,
                                                                                                                                  infer ThunkApiConfig
                                                                                                                                  >
                                                                                                                                  ? AsyncThunk<Returned, ThunkArg, ThunkApiConfig>
                                                                                                                                  : Definition extends {
                                                                                                                                  reducer: any;
                                                                                                                                  }
                                                                                                                                  ? ActionCreatorForCaseReducer<
                                                                                                                                  Definition['reducer'],
                                                                                                                                  SliceActionType<SliceName, Type>
                                                                                                                                  >
                                                                                                                                  : ActionCreatorForCaseReducer<
                                                                                                                                  Definition,
                                                                                                                                  SliceActionType<SliceName, Type>
                                                                                                                                  >
                                                                                                                                  : never;
                                                                                                                                  };
                                                                                                                                  • Derives the slice's actions property from the reducers options

                                                                                                                                    Modifiers

                                                                                                                                    • @public

                                                                                                                                  type CaseReducers

                                                                                                                                  type CaseReducers<S, AS extends Actions> = {
                                                                                                                                  [T in keyof AS]: AS[T] extends Action ? CaseReducer<S, AS[T]> : void;
                                                                                                                                  };
                                                                                                                                  • A mapping from action types to case reducers for createReducer().

                                                                                                                                    Modifiers

                                                                                                                                    • @public

                                                                                                                                    Deprecated

                                                                                                                                    This should not be used manually - it is only used for internal inference purposes and using it manually would lead to type erasure. It might be removed in the future.

                                                                                                                                  type CaseReducerWithPrepare

                                                                                                                                  type CaseReducerWithPrepare<State, Action extends PayloadAction> = {
                                                                                                                                  reducer: CaseReducer<State, Action>;
                                                                                                                                  prepare: PrepareAction<Action['payload']>;
                                                                                                                                  };
                                                                                                                                  • A CaseReducer with a prepare method.

                                                                                                                                    Modifiers

                                                                                                                                    • @public

                                                                                                                                  type Comparer

                                                                                                                                  type Comparer<T> = (a: T, b: T) => number;
                                                                                                                                  • Modifiers

                                                                                                                                    • @public

                                                                                                                                  type DynamicMiddlewareInstance

                                                                                                                                  type DynamicMiddlewareInstance<
                                                                                                                                  State = unknown,
                                                                                                                                  Dispatch extends ReduxDispatch<UnknownAction> = ReduxDispatch<UnknownAction>
                                                                                                                                  > = {
                                                                                                                                  middleware: DynamicMiddleware<State, Dispatch>;
                                                                                                                                  addMiddleware: AddMiddleware<State, Dispatch>;
                                                                                                                                  withMiddleware: WithMiddleware<State, Dispatch>;
                                                                                                                                  instanceId: string;
                                                                                                                                  };

                                                                                                                                    type EnhancedStore

                                                                                                                                    type EnhancedStore<
                                                                                                                                    S = any,
                                                                                                                                    A extends Action = UnknownAction,
                                                                                                                                    E extends Enhancers = Enhancers
                                                                                                                                    > = ExtractStoreExtensions<E> &
                                                                                                                                    Store<S, A, UnknownIfNonSpecific<ExtractStateExtensions<E>>>;
                                                                                                                                    • A Redux store returned by configureStore(). Supports dispatching side-effectful _thunks_ in addition to plain actions.

                                                                                                                                      Modifiers

                                                                                                                                      • @public

                                                                                                                                    type EntityId

                                                                                                                                    type EntityId = number | string;
                                                                                                                                    • Modifiers

                                                                                                                                      • @public

                                                                                                                                    type ForkedTaskExecutor

                                                                                                                                    type ForkedTaskExecutor<T> = AsyncTaskExecutor<T> | SyncTaskExecutor<T>;
                                                                                                                                    • Modifiers

                                                                                                                                      • @public

                                                                                                                                    type GetDispatch

                                                                                                                                    type GetDispatch<MiddlewareApiConfig> = MiddlewareApiConfig extends {
                                                                                                                                    dispatch: infer Dispatch;
                                                                                                                                    }
                                                                                                                                    ? FallbackIfUnknown<Dispatch, ReduxDispatch>
                                                                                                                                    : ReduxDispatch;

                                                                                                                                      type GetState

                                                                                                                                      type GetState<MiddlewareApiConfig> = MiddlewareApiConfig extends {
                                                                                                                                      state: infer State;
                                                                                                                                      }
                                                                                                                                      ? State
                                                                                                                                      : unknown;

                                                                                                                                        type IdSelector

                                                                                                                                        type IdSelector<T, Id extends EntityId> = (model: T) => Id;
                                                                                                                                        • Modifiers

                                                                                                                                          • @public

                                                                                                                                        type ListenerEffect

                                                                                                                                        type ListenerEffect<
                                                                                                                                        Action extends ReduxAction,
                                                                                                                                        State,
                                                                                                                                        Dispatch extends ReduxDispatch,
                                                                                                                                        ExtraArgument = unknown
                                                                                                                                        > = (
                                                                                                                                        action: Action,
                                                                                                                                        api: ListenerEffectAPI<State, Dispatch, ExtraArgument>
                                                                                                                                        ) => void | Promise<void>;
                                                                                                                                        • Modifiers

                                                                                                                                          • @public

                                                                                                                                        type ListenerMiddleware

                                                                                                                                        type ListenerMiddleware<
                                                                                                                                        State = unknown,
                                                                                                                                        Dispatch extends ThunkDispatch<State, unknown, ReduxAction> = ThunkDispatch<
                                                                                                                                        State,
                                                                                                                                        unknown,
                                                                                                                                        UnknownAction
                                                                                                                                        >,
                                                                                                                                        ExtraArgument = unknown
                                                                                                                                        > = Middleware<
                                                                                                                                        {
                                                                                                                                        (action: ReduxAction<'listenerMiddleware/add'>): UnsubscribeListener;
                                                                                                                                        },
                                                                                                                                        State,
                                                                                                                                        Dispatch
                                                                                                                                        >;
                                                                                                                                        • Modifiers

                                                                                                                                          • @public

                                                                                                                                        type MiddlewareApiConfig

                                                                                                                                        type MiddlewareApiConfig = {
                                                                                                                                        state?: unknown;
                                                                                                                                        dispatch?: ReduxDispatch;
                                                                                                                                        };

                                                                                                                                          type PayloadAction

                                                                                                                                          type PayloadAction<P = void, T extends string = string, M = never, E = never> = {
                                                                                                                                          payload: P;
                                                                                                                                          type: T;
                                                                                                                                          } & ([M] extends [never]
                                                                                                                                          ? {}
                                                                                                                                          : {
                                                                                                                                          meta: M;
                                                                                                                                          }) &
                                                                                                                                          ([E] extends [never]
                                                                                                                                          ? {}
                                                                                                                                          : {
                                                                                                                                          error: E;
                                                                                                                                          });
                                                                                                                                          • An action with a string type and an associated payload. This is the type of action returned by createAction() action creators.

                                                                                                                                            P The type of the action's payload. T the type used for the action type. M The type of the action's meta (optional) E The type of the action's error (optional)

                                                                                                                                            Modifiers

                                                                                                                                            • @public

                                                                                                                                          type PayloadActionCreator

                                                                                                                                          type PayloadActionCreator<
                                                                                                                                          P = void,
                                                                                                                                          T extends string = string,
                                                                                                                                          PA extends PrepareAction<P> | void = void
                                                                                                                                          > = IfPrepareActionMethodProvided<
                                                                                                                                          PA,
                                                                                                                                          _ActionCreatorWithPreparedPayload<PA, T>,
                                                                                                                                          IsAny<
                                                                                                                                          P,
                                                                                                                                          ActionCreatorWithPayload<any, T>,
                                                                                                                                          IsUnknownOrNonInferrable<
                                                                                                                                          P,
                                                                                                                                          ActionCreatorWithNonInferrablePayload<T>,
                                                                                                                                          IfVoid<
                                                                                                                                          P,
                                                                                                                                          ActionCreatorWithoutPayload<T>,
                                                                                                                                          IfMaybeUndefined<
                                                                                                                                          P,
                                                                                                                                          ActionCreatorWithOptionalPayload<P, T>,
                                                                                                                                          ActionCreatorWithPayload<P, T>
                                                                                                                                          >
                                                                                                                                          >
                                                                                                                                          >
                                                                                                                                          >
                                                                                                                                          >;
                                                                                                                                          • An action creator that produces actions with a payload attribute.

                                                                                                                                            Modifiers

                                                                                                                                            • @public

                                                                                                                                          type PrepareAction

                                                                                                                                          type PrepareAction<P> =
                                                                                                                                          | ((...args: any[]) => {
                                                                                                                                          payload: P;
                                                                                                                                          })
                                                                                                                                          | ((...args: any[]) => {
                                                                                                                                          payload: P;
                                                                                                                                          meta: any;
                                                                                                                                          })
                                                                                                                                          | ((...args: any[]) => {
                                                                                                                                          payload: P;
                                                                                                                                          error: any;
                                                                                                                                          })
                                                                                                                                          | ((...args: any[]) => {
                                                                                                                                          payload: P;
                                                                                                                                          meta: any;
                                                                                                                                          error: any;
                                                                                                                                          });
                                                                                                                                          • A "prepare" method to be used as the second parameter of createAction. Takes any number of arguments and returns a Flux Standard Action without type (will be added later) that *must* contain a payload (might be undefined).

                                                                                                                                            Modifiers

                                                                                                                                            • @public

                                                                                                                                          type SafePromise

                                                                                                                                          type SafePromise<T> = Promise<T> & {
                                                                                                                                          __linterBrands: 'SafePromise';
                                                                                                                                          };
                                                                                                                                          • A Promise that will never reject.

                                                                                                                                            See Also

                                                                                                                                            • https://github.com/reduxjs/redux-toolkit/issues/4101

                                                                                                                                          type SliceCaseReducers

                                                                                                                                          type SliceCaseReducers<State> =
                                                                                                                                          | Record<
                                                                                                                                          string,
                                                                                                                                          | CaseReducerDefinition<State, PayloadAction<any>>
                                                                                                                                          | CaseReducerWithPrepareDefinition<
                                                                                                                                          State,
                                                                                                                                          PayloadAction<any, string, any, any>
                                                                                                                                          >
                                                                                                                                          | AsyncThunkSliceReducerDefinition<State, any, any, any>
                                                                                                                                          >
                                                                                                                                          | Record<
                                                                                                                                          string,
                                                                                                                                          | CaseReducer<State, PayloadAction<any>>
                                                                                                                                          | CaseReducerWithPrepare<State, PayloadAction<any, string, any, any>>
                                                                                                                                          >;
                                                                                                                                          • The type describing a slice's reducers option.

                                                                                                                                            Modifiers

                                                                                                                                            • @public

                                                                                                                                          type SliceSelectors

                                                                                                                                          type SliceSelectors<State> = {
                                                                                                                                          [K: string]: (sliceState: State, ...args: any[]) => any;
                                                                                                                                          };
                                                                                                                                          • The type describing a slice's selectors option.

                                                                                                                                          type TaskCancelled

                                                                                                                                          type TaskCancelled = {
                                                                                                                                          readonly status: 'cancelled';
                                                                                                                                          readonly error: TaskAbortError;
                                                                                                                                          };
                                                                                                                                          • Modifiers

                                                                                                                                            • @public

                                                                                                                                          type TaskRejected

                                                                                                                                          type TaskRejected = {
                                                                                                                                          readonly status: 'rejected';
                                                                                                                                          readonly error: unknown;
                                                                                                                                          };
                                                                                                                                          • Modifiers

                                                                                                                                            • @public

                                                                                                                                          type TaskResolved

                                                                                                                                          type TaskResolved<T> = {
                                                                                                                                          readonly status: 'ok';
                                                                                                                                          readonly value: T;
                                                                                                                                          };
                                                                                                                                          • Modifiers

                                                                                                                                            • @public

                                                                                                                                          type TaskResult

                                                                                                                                          type TaskResult<Value> = TaskResolved<Value> | TaskRejected | TaskCancelled;
                                                                                                                                          • Modifiers

                                                                                                                                            • @public

                                                                                                                                          type TSHelpersExtractDispatchExtensions

                                                                                                                                          type ExtractDispatchExtensions<M> = M extends Tuple<infer MiddlewareTuple>
                                                                                                                                          ? ExtractDispatchFromMiddlewareTuple<MiddlewareTuple, {}>
                                                                                                                                          : M extends ReadonlyArray<Middleware>
                                                                                                                                          ? ExtractDispatchFromMiddlewareTuple<[...M], {}>
                                                                                                                                          : never;

                                                                                                                                            type TypedAddListener

                                                                                                                                            type TypedAddListener<
                                                                                                                                            StateType,
                                                                                                                                            DispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            StateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >,
                                                                                                                                            ExtraArgument = unknown,
                                                                                                                                            Payload = ListenerEntry<StateType, DispatchType>,
                                                                                                                                            T extends string = 'listenerMiddleware/add'
                                                                                                                                            > = BaseActionCreator<Payload, T> &
                                                                                                                                            AddListenerOverloads<
                                                                                                                                            PayloadAction<Payload, T>,
                                                                                                                                            StateType,
                                                                                                                                            DispatchType,
                                                                                                                                            ExtraArgument
                                                                                                                                            > & {
                                                                                                                                            /**
                                                                                                                                            * Creates a "pre-typed" version of `addListener`
                                                                                                                                            * where the `state` and `dispatch` types are predefined.
                                                                                                                                            *
                                                                                                                                            * This allows you to set the `state` and `dispatch` types once,
                                                                                                                                            * eliminating the need to specify them with every `addListener` call.
                                                                                                                                            *
                                                                                                                                            * @returns A pre-typed `addListener` with the state and dispatch types already defined.
                                                                                                                                            *
                                                                                                                                            * @example
                                                                                                                                            * ```ts
                                                                                                                                            * import { addListener } from '@reduxjs/toolkit'
                                                                                                                                            *
                                                                                                                                            * export const addAppListener = addListener.withTypes<RootState, AppDispatch>()
                                                                                                                                            * ```
                                                                                                                                            *
                                                                                                                                            * @template OverrideStateType - The specific type of state the middleware listener operates on.
                                                                                                                                            * @template OverrideDispatchType - The specific type of the dispatch function.
                                                                                                                                            *
                                                                                                                                            * @since 2.1.0
                                                                                                                                            */
                                                                                                                                            withTypes: <
                                                                                                                                            OverrideStateType extends StateType,
                                                                                                                                            OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            OverrideStateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >
                                                                                                                                            >() => TypedAddListener<OverrideStateType, OverrideDispatchType>;
                                                                                                                                            };
                                                                                                                                            • A "pre-typed" version of addListenerAction, so the listener args are well-typed

                                                                                                                                              Modifiers

                                                                                                                                              • @public

                                                                                                                                            type TypedRemoveListener

                                                                                                                                            type TypedRemoveListener<
                                                                                                                                            StateType,
                                                                                                                                            DispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            StateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >,
                                                                                                                                            Payload = ListenerEntry<StateType, DispatchType>,
                                                                                                                                            T extends string = 'listenerMiddleware/remove'
                                                                                                                                            > = BaseActionCreator<Payload, T> &
                                                                                                                                            AddListenerOverloads<
                                                                                                                                            PayloadAction<Payload, T>,
                                                                                                                                            StateType,
                                                                                                                                            DispatchType,
                                                                                                                                            any,
                                                                                                                                            UnsubscribeListenerOptions
                                                                                                                                            > & {
                                                                                                                                            /**
                                                                                                                                            * Creates a "pre-typed" version of `removeListener`
                                                                                                                                            * where the `state` and `dispatch` types are predefined.
                                                                                                                                            *
                                                                                                                                            * This allows you to set the `state` and `dispatch` types once,
                                                                                                                                            * eliminating the need to specify them with every `removeListener` call.
                                                                                                                                            *
                                                                                                                                            * @returns A pre-typed `removeListener` with the state and dispatch types already defined.
                                                                                                                                            *
                                                                                                                                            * @example
                                                                                                                                            * ```ts
                                                                                                                                            * import { removeListener } from '@reduxjs/toolkit'
                                                                                                                                            *
                                                                                                                                            * export const removeAppListener = removeListener.withTypes<RootState, AppDispatch>()
                                                                                                                                            * ```
                                                                                                                                            *
                                                                                                                                            * @template OverrideStateType - The specific type of state the middleware listener operates on.
                                                                                                                                            * @template OverrideDispatchType - The specific type of the dispatch function.
                                                                                                                                            *
                                                                                                                                            * @since 2.1.0
                                                                                                                                            */
                                                                                                                                            withTypes: <
                                                                                                                                            OverrideStateType extends StateType,
                                                                                                                                            OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            OverrideStateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >
                                                                                                                                            >() => TypedRemoveListener<OverrideStateType, OverrideDispatchType>;
                                                                                                                                            };
                                                                                                                                            • A "pre-typed" version of removeListenerAction, so the listener args are well-typed

                                                                                                                                              Modifiers

                                                                                                                                              • @public

                                                                                                                                            type TypedStartListening

                                                                                                                                            type TypedStartListening<
                                                                                                                                            StateType,
                                                                                                                                            DispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            StateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >,
                                                                                                                                            ExtraArgument = unknown
                                                                                                                                            > = AddListenerOverloads<
                                                                                                                                            UnsubscribeListener,
                                                                                                                                            StateType,
                                                                                                                                            DispatchType,
                                                                                                                                            ExtraArgument
                                                                                                                                            > & {
                                                                                                                                            /**
                                                                                                                                            * Creates a "pre-typed" version of
                                                                                                                                            * {@linkcode ListenerMiddlewareInstance.startListening startListening}
                                                                                                                                            * where the `state` and `dispatch` types are predefined.
                                                                                                                                            *
                                                                                                                                            * This allows you to set the `state` and `dispatch` types once,
                                                                                                                                            * eliminating the need to specify them with every
                                                                                                                                            * {@linkcode ListenerMiddlewareInstance.startListening startListening} call.
                                                                                                                                            *
                                                                                                                                            * @returns A pre-typed `startListening` with the state and dispatch types already defined.
                                                                                                                                            *
                                                                                                                                            * @example
                                                                                                                                            * ```ts
                                                                                                                                            * import { createListenerMiddleware } from '@reduxjs/toolkit'
                                                                                                                                            *
                                                                                                                                            * const listenerMiddleware = createListenerMiddleware()
                                                                                                                                            *
                                                                                                                                            * export const startAppListening = listenerMiddleware.startListening.withTypes<
                                                                                                                                            * RootState,
                                                                                                                                            * AppDispatch
                                                                                                                                            * >()
                                                                                                                                            * ```
                                                                                                                                            *
                                                                                                                                            * @template OverrideStateType - The specific type of state the middleware listener operates on.
                                                                                                                                            * @template OverrideDispatchType - The specific type of the dispatch function.
                                                                                                                                            *
                                                                                                                                            * @since 2.1.0
                                                                                                                                            */
                                                                                                                                            withTypes: <
                                                                                                                                            OverrideStateType extends StateType,
                                                                                                                                            OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            OverrideStateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >
                                                                                                                                            >() => TypedStartListening<OverrideStateType, OverrideDispatchType>;
                                                                                                                                            };
                                                                                                                                            • A "pre-typed" version of middleware.startListening, so the listener args are well-typed

                                                                                                                                              Modifiers

                                                                                                                                              • @public

                                                                                                                                            type TypedStopListening

                                                                                                                                            type TypedStopListening<
                                                                                                                                            StateType,
                                                                                                                                            DispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            StateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >
                                                                                                                                            > = RemoveListenerOverloads<StateType, DispatchType> & {
                                                                                                                                            /**
                                                                                                                                            * Creates a "pre-typed" version of
                                                                                                                                            * {@linkcode ListenerMiddlewareInstance.stopListening stopListening}
                                                                                                                                            * where the `state` and `dispatch` types are predefined.
                                                                                                                                            *
                                                                                                                                            * This allows you to set the `state` and `dispatch` types once,
                                                                                                                                            * eliminating the need to specify them with every
                                                                                                                                            * {@linkcode ListenerMiddlewareInstance.stopListening stopListening} call.
                                                                                                                                            *
                                                                                                                                            * @returns A pre-typed `stopListening` with the state and dispatch types already defined.
                                                                                                                                            *
                                                                                                                                            * @example
                                                                                                                                            * ```ts
                                                                                                                                            * import { createListenerMiddleware } from '@reduxjs/toolkit'
                                                                                                                                            *
                                                                                                                                            * const listenerMiddleware = createListenerMiddleware()
                                                                                                                                            *
                                                                                                                                            * export const stopAppListening = listenerMiddleware.stopListening.withTypes<
                                                                                                                                            * RootState,
                                                                                                                                            * AppDispatch
                                                                                                                                            * >()
                                                                                                                                            * ```
                                                                                                                                            *
                                                                                                                                            * @template OverrideStateType - The specific type of state the middleware listener operates on.
                                                                                                                                            * @template OverrideDispatchType - The specific type of the dispatch function.
                                                                                                                                            *
                                                                                                                                            * @since 2.1.0
                                                                                                                                            */
                                                                                                                                            withTypes: <
                                                                                                                                            OverrideStateType extends StateType,
                                                                                                                                            OverrideDispatchType extends ReduxDispatch = ThunkDispatch<
                                                                                                                                            OverrideStateType,
                                                                                                                                            unknown,
                                                                                                                                            UnknownAction
                                                                                                                                            >
                                                                                                                                            >() => TypedStopListening<OverrideStateType, OverrideDispatchType>;
                                                                                                                                            };
                                                                                                                                            • A "pre-typed" version of middleware.stopListening, so the listener args are well-typed

                                                                                                                                              Modifiers

                                                                                                                                              • @public

                                                                                                                                            type UnsubscribeListener

                                                                                                                                            type UnsubscribeListener = (unsubscribeOptions?: UnsubscribeListenerOptions) => void;
                                                                                                                                            • Modifiers

                                                                                                                                              • @public

                                                                                                                                            type Update

                                                                                                                                            type Update<T, Id extends EntityId> = {
                                                                                                                                            id: Id;
                                                                                                                                            changes: Partial<T>;
                                                                                                                                            };
                                                                                                                                            • Modifiers

                                                                                                                                              • @public

                                                                                                                                            type ValidateSliceCaseReducers

                                                                                                                                            type ValidateSliceCaseReducers<S, ACR extends SliceCaseReducers<S>> = ACR & {
                                                                                                                                            [T in keyof ACR]: ACR[T] extends {
                                                                                                                                            reducer(s: S, action?: infer A): any;
                                                                                                                                            }
                                                                                                                                            ? {
                                                                                                                                            prepare(...a: never[]): Omit<A, 'type'>;
                                                                                                                                            }
                                                                                                                                            : {};
                                                                                                                                            };
                                                                                                                                            • Used on a SliceCaseReducers object. Ensures that if a CaseReducer is a CaseReducerWithPrepare, that the reducer and the prepare function use the same type of payload.

                                                                                                                                              Might do additional such checks in the future.

                                                                                                                                              This type is only ever useful if you want to write your own wrapper around createSlice. Please don't use it otherwise!

                                                                                                                                              Modifiers

                                                                                                                                              • @public

                                                                                                                                            type WithSlice

                                                                                                                                            type WithSlice<A extends AnySliceLike> = {
                                                                                                                                            [Path in SliceLikeReducerPath<A>]: SliceLikeState<A>;
                                                                                                                                            };

                                                                                                                                              Package Files (26)

                                                                                                                                              Dependencies (4)

                                                                                                                                              Dev Dependencies (45)

                                                                                                                                              Peer Dependencies (2)

                                                                                                                                              Badge

                                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@reduxjs/toolkit.

                                                                                                                                              • Markdown
                                                                                                                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@reduxjs/toolkit)
                                                                                                                                              • HTML
                                                                                                                                                <a href="https://www.jsdocs.io/package/@reduxjs/toolkit"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>