Options
All
  • Public
  • Public/Protected
  • All
Menu

rtkex

Index

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

ActionFromReducer<R>: R extends Reducer<any, infer A> ? A : never

Infer action type from a reducer function.

Type Parameters

  • R

    Type of reducer.

ActionFromReducersMapObject<M>: M extends ReducersMapObject<any, any> ? ActionFromReducer<ReducerFromReducersMapObject<M>> : never

Infer action union type from a ReducersMapObject.

Type Parameters

  • M

    Object map of reducers as provided to combineReducers(map: M).

ActionMatchingAllOf<Matchers>: UnionToIntersection<ActionMatchingAnyOf<Matchers>>

Type Parameters

  • Matchers extends [Matcher<any>, ...Matcher<any>[]]

ActionMatchingAnyOf<Matchers>: ActionFromMatcher<Matchers[number]>

Type Parameters

  • Matchers extends [Matcher<any>, ...Matcher<any>[]]

Actions<T>: Record<T, Action>

Defines a mapping from action types to corresponding action object shapes.

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 Parameters

  • T extends keyof any = string

AsyncThunk<Returned, ThunkArg, ThunkApiConfig>: AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & { fulfilled: AsyncThunkFulfilledActionCreator<Returned, ThunkArg, ThunkApiConfig>; pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig>; rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>; typePrefix: string }

A type describing the return value of createAsyncThunk. Might be useful for wrapping createAsyncThunk in custom abstractions.

Type Parameters

  • Returned

  • ThunkArg

  • ThunkApiConfig extends AsyncThunkConfig

AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>: ((dispatch: GetDispatch<ThunkApiConfig>, getState: (() => GetState<ThunkApiConfig>), extra: GetExtra<ThunkApiConfig>) => Promise<ReturnType<AsyncThunkFulfilledActionCreator<Returned, ThunkArg>> | ReturnType<AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>>> & { arg: ThunkArg; requestId: string; abort: any; unwrap: any })

Type Parameters

  • Returned

  • ThunkArg

  • ThunkApiConfig extends AsyncThunkConfig

Type declaration

    • (dispatch: GetDispatch<ThunkApiConfig>, getState: (() => GetState<ThunkApiConfig>), extra: GetExtra<ThunkApiConfig>): Promise<ReturnType<AsyncThunkFulfilledActionCreator<Returned, ThunkArg>> | ReturnType<AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>>> & { arg: ThunkArg; requestId: string; abort: any; unwrap: any }
    • 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.

      Parameters

      • dispatch: GetDispatch<ThunkApiConfig>
      • getState: (() => GetState<ThunkApiConfig>)
          • (): GetState<ThunkApiConfig>
          • Returns GetState<ThunkApiConfig>

      • extra: GetExtra<ThunkApiConfig>

      Returns Promise<ReturnType<AsyncThunkFulfilledActionCreator<Returned, ThunkArg>> | ReturnType<AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>>> & { arg: ThunkArg; requestId: string; abort: any; unwrap: any }

AsyncThunkConfig: { dispatch?: Dispatch; extra?: unknown; fulfilledMeta?: unknown; pendingMeta?: unknown; rejectValue?: unknown; rejectedMeta?: unknown; serializedErrorType?: unknown; state?: unknown }

Type declaration

  • Optional dispatch?: Dispatch
  • Optional extra?: unknown
  • Optional fulfilledMeta?: unknown
  • Optional pendingMeta?: unknown
  • Optional rejectValue?: unknown
  • Optional rejectedMeta?: unknown
  • Optional serializedErrorType?: unknown
  • Optional state?: unknown
AsyncThunkOptions<ThunkArg, ThunkApiConfig>: { dispatchConditionRejection?: boolean; condition?: any; idGenerator?: any; serializeError?: any } & IsUnknown<GetPendingMeta<ThunkApiConfig>, { getPendingMeta?: any }, { getPendingMeta: any }>

Options object for createAsyncThunk.

Type Parameters

  • ThunkArg = void

  • ThunkApiConfig extends AsyncThunkConfig = {}

AsyncThunkPayloadCreator<Returned, ThunkArg, ThunkApiConfig>: ((arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>)

Type Parameters

  • Returned

  • ThunkArg = void

  • ThunkApiConfig extends AsyncThunkConfig = {}

Type declaration

    • A type describing the payloadCreator argument to createAsyncThunk. Might be useful for wrapping createAsyncThunk in custom abstractions.

      Parameters

      • arg: ThunkArg
      • thunkAPI: GetThunkAPI<ThunkApiConfig>

      Returns AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>

AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>: 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.

Type Parameters

  • Returned

  • ThunkApiConfig extends AsyncThunkConfig

BuildCallback<TState, TAction>: ((builder: StoreBuilder<{}, never>) => StoreBuilder<TState, TAction>)

Type Parameters

Type declaration

Callback<T>: ((e: T) => void)

Type Parameters

  • T = any

Type declaration

    • (e: T): void
    • Parameters

      • e: T

      Returns void

CaseReducer<S, A>: ((state: Draft<S>, action: A) => S | void | Draft<S>)

Type Parameters

Type declaration

    • An 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, the mutations are translated to copy operations that result in a new state.

      Parameters

      Returns S | void | Draft<S>

CaseReducerActions<CaseReducers>: { [ Type in keyof CaseReducers]: CaseReducers[Type] extends { prepare: any } ? ActionCreatorForCaseReducerWithPrepare<CaseReducers[Type]> : ActionCreatorForCaseReducer<CaseReducers[Type]> }

Derives the slice's actions property from the reducers options

Type Parameters

CaseReducerWithPrepare<State, Action>: { prepare: PrepareAction<Action["payload"]>; reducer: CaseReducer<State, Action> }

A CaseReducer with a prepare method.

Type Parameters

Type declaration

CaseReducers<S, AS>: { [ T in keyof AS]: AS[T] extends Action ? CaseReducer<S, AS[T]> : void }

A mapping from action types to case reducers for createReducer().

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 Parameters

ClonableSlice<TState, TCaseReducers, TName>: EnhancedSlice<TState, TCaseReducers, TName> & { clone: any }

Type Parameters

CombinedState<S>: EmptyObject & S

Type Parameters

  • S

Combiner<TSelectors, TResult>: ((values: { [ key in keyof TSelectors]: TSelectors[key] extends EnhancedSlice ? ReturnType<TSelectors[key]["select"]> : TSelectors[key] extends ((state: any) => infer T) ? T : never }) => TResult)

Type Parameters

  • TSelectors

  • TResult

Type declaration

    • (values: { [ key in keyof TSelectors]: TSelectors[key] extends EnhancedSlice ? ReturnType<TSelectors[key]["select"]> : TSelectors[key] extends ((state: any) => infer T) ? T : never }): TResult
    • Parameters

      • values: { [ key in keyof TSelectors]: TSelectors[key] extends EnhancedSlice ? ReturnType<TSelectors[key]["select"]> : TSelectors[key] extends ((state: any) => infer T) ? T : never }

      Returns TResult

Comparer<T>: ((a: T, b: T) => number)

Type Parameters

  • T

Type declaration

    • (a: T, b: T): number
    • Parameters

      • a: T
      • b: T

      Returns number

ConfigureEnhancersCallback: ((defaultEnhancers: readonly StoreEnhancer[]) => StoreEnhancer[])

Type declaration

CreateLoadableSlice: { <TName, TState, TCaseReducers, TArg>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, {}>, options?: LoadableOptions<TState, TArg, {}, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers>; <TName, TState, TArg, TCaseReducers, TApiConfig>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, TApiConfig>, options?: LoadableOptions<TState, TArg, TApiConfig, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers> }

Type declaration

    • <TName, TState, TCaseReducers, TArg>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, {}>, options?: LoadableOptions<TState, TArg, {}, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers>
    • <TName, TState, TArg, TCaseReducers, TApiConfig>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, TApiConfig>, options?: LoadableOptions<TState, TArg, TApiConfig, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers>
    • create loadable slice without API config

      Type Parameters

      Parameters

      Returns LoadableSlice<TName, TState, TArg, TCaseReducers>

    • create loadable slice with API config

      Type Parameters

      Parameters

      • name: TName
      • loader: LoadableLoader<TState | Promise<TState>, TArg, TApiConfig>
      • Optional options: LoadableOptions<TState, TArg, TApiConfig, TCaseReducers>

      Returns LoadableSlice<TName, TState, TArg, TCaseReducers>

DataSelectableSlice<T>: { selectData: any }

Type Parameters

  • T

Type declaration

DeepPartial<T>: { [ K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K] }

Type Parameters

  • T

DispatchableSlice<A>: { actions: A }

Type Parameters

  • A

Type declaration

  • actions: A
Draft<T>: T extends PrimitiveType ? T : T extends AtomicObject ? T : T extends IfAvailable<ReadonlyMap<infer K, infer V>> ? Map<Draft<K>, Draft<V>> : T extends IfAvailable<ReadonlySet<infer V>> ? Set<Draft<V>> : T extends WeakReferences ? T : T extends object ? WritableDraft<T> : T

Type Parameters

  • T

DynamicBuildCallback<TContext, TBuilder>: ((builder: TBuilder, context: TContext) => void)

Type Parameters

  • TContext = void

  • TBuilder = Pick<StoreBuilder, "withSlice" | "withReducer">

Type declaration

    • (builder: TBuilder, context: TContext): void
    • Parameters

      • builder: TBuilder
      • context: TContext

      Returns void

EntityId: number | string
ForkedTaskExecutor<T>: AsyncTaskExecutor<T> | SyncTaskExecutor<T>

Type Parameters

  • T

Func0<R>: (() => R)

Type Parameters

  • R

Type declaration

    • (): R
    • Returns R

Func1<T1, R>: ((a1: T1) => R)

Type Parameters

  • T1

  • R

Type declaration

    • (a1: T1): R
    • Parameters

      • a1: T1

      Returns R

Func2<T1, T2, R>: ((a1: T1, a2: T2) => R)

Type Parameters

  • T1

  • T2

  • R

Type declaration

    • (a1: T1, a2: T2): R
    • Parameters

      • a1: T1
      • a2: T2

      Returns R

Func3<T1, T2, T3, R>: ((a1: T1, a2: T2, a3: T3, ...args: any[]) => R)

Type Parameters

  • T1

  • T2

  • T3

  • R

Type declaration

    • (a1: T1, a2: T2, a3: T3, ...args: any[]): R
    • Parameters

      • a1: T1
      • a2: T2
      • a3: T3
      • Rest ...args: any[]

      Returns R

IdSelector<T>: ((model: T) => EntityId)

Type Parameters

  • T

Type declaration

Listener: { actionCreator?: any; effect?: any; matcher?: any; predicate?: any; type?: any }

Type declaration

  • Optional actionCreator?: any
  • Optional effect?: any
  • Optional matcher?: any
  • Optional predicate?: any
  • Optional type?: any
ListenerEffect<Action, State, Dispatch, ExtraArgument>: ((action: Action, api: ListenerEffectAPI<State, Dispatch, ExtraArgument>) => void | Promise<void>)

Type Parameters

Type declaration

    • (action: Action, api: ListenerEffectAPI<State, Dispatch, ExtraArgument>): void | Promise<void>
    • Parameters

      Returns void | Promise<void>

ListenerMiddleware<State, Dispatch, ExtraArgument>: Middleware<((action: Action<"listenerMiddleware/add">) => UnsubscribeListener), State, Dispatch>

Type Parameters

ListenerOverloads<R>: (<T>(when: T, effect: T extends ((...args: any[]) => any) ? ListenerEffect<ReturnType<T>, any, Dispatch, any> : T extends { predicate: infer LP } ? LP extends ListenerPredicate<AnyAction, any> ? ListenerEffect<ListenerPredicateGuardedActionType<LP>, any, Dispatch, any> : ListenerEffect<AnyAction, any, Dispatch, any> : T extends { matcher: infer M } ? M extends MatchFunction<AnyAction> ? ListenerEffect<GuardedType<M>, any, Dispatch, any> : never : T extends { type: infer TTYpe } ? ListenerEffect<Action<TTYpe>, any, Dispatch, any> : never) => R)

Type Parameters

  • R

Type declaration

LoadableLoader<TState, TArg, TApiConfig>: AsyncThunkPayloadCreator<TState, TArg, TApiConfig>

Type Parameters

LoadableOptions<TState, TThunkArg, ThunkApiConfig, TCaseReducers>: AsyncThunkOptions<TThunkArg, ThunkApiConfig> & { extraReducers?: CaseReducers<NoInfer<TState>, any> | ((builder: ActionReducerMapBuilder<NoInfer<TState>>) => void); initialState?: TState; reducers?: ValidateSliceCaseReducers<TState, TCaseReducers> }

Type Parameters

  • TState = any

  • TThunkArg = void

  • ThunkApiConfig = any

  • TCaseReducers extends SliceCaseReducers<TState> = any

LoadableSlice<TName, TState, TArg, TCaseReducers>: EnhancedSlice<Loadable<TState>, {}, TName> & { actions: Slice<TState, TCaseReducers, TName>["actions"] & { cancel: any; clearError: any; failed: any; load: any; loaded: any; loading: any }; selectData: Selector<TName, Loadable<TState>, TState> }

Type Parameters

Observable<T>: { [observable]: any; subscribe: any }

A minimal observable of state changes. For more information, see the observable proposal: https://github.com/tc39/proposal-observable

Type Parameters

  • T

Type declaration

  • [observable]:function
    • Returns Observable<T>

  • subscribe:function
    • The minimal observable subscription method.

      Parameters

      • observer: Observer<T>

        Any object that can be used as an observer. The observer object should have a next method.

      Returns { unsubscribe: Unsubscribe }

      An object with an unsubscribe method that can be used to unsubscribe the observable from the store, and prevent further emission of values from the observable.

Observer<T>: { next?: any }

An Observer is used to receive data from an Observable, and is supplied as an argument to subscribe.

Type Parameters

  • T

Type declaration

  • next?:function
    • next(value: T): void
    • Parameters

      • value: T

      Returns void

OnBuild<TContext>: ((buildCallback: DynamicBuildCallback<TContext, Pick<StoreBuilder, "withSlice" | "withReducer" | "withListener" | "withErrorCallbacks" | "withListeners">>) => TContext)

Type Parameters

  • TContext

Type declaration

    • (buildCallback: DynamicBuildCallback<TContext, Pick<StoreBuilder, "withSlice" | "withReducer" | "withListener" | "withErrorCallbacks" | "withListeners">>): TContext
    • Parameters

      Returns TContext

OnReady<TContext>: ((readyCallback: ReadyCallback<TContext>) => TContext)

Type Parameters

  • TContext

Type declaration

OutputParametricSelector<State, Props, Result, Combiner>: ParametricSelector<State, Props, Result> & OutputSelectorFields<Combiner>

A generated selector that is assumed to have one additional argument

Type Parameters

  • State

  • Props

  • Result

  • Combiner extends UnknownFunction

OutputSelector<S, Result, Combiner, Params>: Selector<GetStateFromSelectors<S>, Result, Params> & OutputSelectorFields<Combiner>

Represents the actual selectors generated by createSelector. The selector is:

  • "a function that takes this state + params and returns a result"
  • plus the attached additional fields

Type Parameters

  • S extends SelectorArray

  • Result

  • Combiner extends UnknownFunction

  • Params extends readonly any[] = never

ParametricSelector<State, Props, Result>: Selector<State, Result, [Props, ...any]>

A selector that is assumed to have one additional argument, such as the props from a React component

Type Parameters

  • State

  • Props

  • Result

PayloadAction<P, T, M, E>: { 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.

Type Parameters

  • P = void

    The type of the action's payload.

  • T extends string = string

    the type used for the action type.

  • M = never

    The type of the action's meta (optional)

  • E = never

    The type of the action's error (optional)

PayloadActionCreator<P, T, PA>: 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.

Type Parameters

  • P = void

    the payload type

  • T extends string = string

    the type of the resulting action

  • PA extends PrepareAction<P> | void = void

    if the resulting action is preprocessed by a prepare method, the signature of said method.

PreloadedState<S>: Required<S> extends EmptyObject ? S extends CombinedState<infer S1> ? { [ K in keyof S1]?: S1[K] extends object ? PreloadedState<S1[K]> : S1[K] } : S : { [ K in keyof S]: S[K] extends string | number | boolean | symbol ? S[K] : PreloadedState<S[K]> }

Recursively makes combined state objects partial. Only combined state root objects (i.e. the generated higher level object with keys mapping to individual reducers) are partial.

Type Parameters

  • S

PrepareAction<P>: ((...args: any[]) => { payload: P }) | ((...args: any[]) => { meta: any; payload: P }) | ((...args: any[]) => { error: any; payload: P }) | ((...args: any[]) => { error: any; meta: any; payload: P })

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).

Type Parameters

  • P

ReadyCallback<T>: ((api: MiddlewareAPI, context: T) => void)

Type Parameters

  • T = any

Type declaration

Reducer<S, A>: ((state: S | undefined, action: A) => S)

Type Parameters

  • S = any

    The type of state consumed and produced by this reducer.

  • A extends Action = AnyAction

    The type of actions the reducer can potentially respond to.

Type declaration

    • (state: S | undefined, action: A): S
    • A reducer (also called a reducing function) is a function that accepts an accumulation and a value and returns a new accumulation. They are used to reduce a collection of values down to a single value

      Reducers are not unique to Redux—they are a fundamental concept in functional programming. Even most non-functional languages, like JavaScript, have a built-in API for reducing. In JavaScript, it's Array.prototype.reduce().

      In Redux, the accumulated value is the state object, and the values being accumulated are actions. Reducers calculate a new state given the previous state and an action. They must be pure functions—functions that return the exact same output for given inputs. They should also be free of side-effects. This is what enables exciting features like hot reloading and time travel.

      Reducers are the most important concept in Redux.

      Do not put API calls into reducers.

      Parameters

      • state: S | undefined
      • action: A

      Returns S

ReducerFromReducersMapObject<M>: M extends { [ P in keyof M]: infer R } ? R extends Reducer<any, any> ? R : never : never

Infer reducer union type from a ReducersMapObject.

Type Parameters

  • M

    Object map of reducers as provided to combineReducers(map: M).

ReducersMapObject<S, A>: { [ K in keyof S]: Reducer<S[K], A> }

Object whose values correspond to different reducer functions.

Type Parameters

  • S = any

  • A extends Action = Action

    The type of actions the reducers can potentially respond to.

SelectableSlice<T>: { select: any }

Type Parameters

  • T

Type declaration

Selector<TName, TState, TSelected>: ((state: SelectorState<TName, TState>) => TSelected)

Type Parameters

  • TName extends string

  • TState

  • TSelected = TState

Type declaration

SelectorState<TName, TState>: { [ key in TName]: TState }

Type Parameters

  • TName extends string

  • TState

SliceActionCreator<P>: PayloadActionCreator<P>

An action creator attached to a slice.

deprecated

please use PayloadActionCreator directly

Type Parameters

  • P

SliceCaseReducers<State>: {}

The type describing a slice's reducers option.

Type Parameters

  • State

Type declaration

StateFromReducersMapObject<M>: M extends ReducersMapObject<any, any> ? { [ P in keyof M]: M[P] extends Reducer<infer S, any> ? S : never } : never

Infer a combined state shape from a ReducersMapObject.

Type Parameters

  • M

    Object map of reducers as provided to combineReducers(map: M).

StoreEnhancer<Ext, StateExt>: ((next: StoreEnhancerStoreCreator) => StoreEnhancerStoreCreator<Ext, StateExt>)

Type Parameters

  • Ext = {}

    Store extension that is mixed into the Store type.

  • StateExt = {}

    State extension that is mixed into the state type.

Type declaration

    • A store enhancer is a higher-order function that composes a store creator to return a new, enhanced store creator. This is similar to middleware in that it allows you to alter the store interface in a composable way.

      Store enhancers are much the same concept as higher-order components in React, which are also occasionally called “component enhancers”.

      Because a store is not an instance, but rather a plain-object collection of functions, copies can be easily created and modified without mutating the original store. There is an example in compose documentation demonstrating that.

      Most likely you'll never write a store enhancer, but you may use the one provided by the developer tools. It is what makes time travel possible without the app being aware it is happening. Amusingly, the Redux middleware implementation is itself a store enhancer.

      Parameters

      Returns StoreEnhancerStoreCreator<Ext, StateExt>

StoreEnhancerStoreCreator<Ext, StateExt>: (<S, A>(reducer: Reducer<S, A>, preloadedState?: PreloadedState<S>) => Store<S & StateExt, A> & Ext)

Type Parameters

  • Ext = {}

  • StateExt = {}

Type declaration

TaskCancelled: { error: TaskAbortError; status: "cancelled" }

Type declaration

TaskRejected: { error: unknown; status: "rejected" }

Type declaration

  • Readonly error: unknown
  • Readonly status: "rejected"
TaskResolved<T>: { status: "ok"; value: T }

Type Parameters

  • T

Type declaration

  • Readonly status: "ok"
  • Readonly value: T
TaskResult<Value>: TaskResolved<Value> | TaskRejected | TaskCancelled

Type Parameters

  • Value

ThunkAction<ReturnType, State, ExtraThunkArg, BasicAction>: ((dispatch: ThunkDispatch<State, ExtraThunkArg, BasicAction>, getState: (() => State), extraArgument: ExtraThunkArg) => ReturnType)

Type Parameters

  • ReturnType

    The return type of the thunk's inner function

  • State

    The redux state

  • ExtraThunkArg

    Optional extra argument passed to the inner function (if specified when setting up the Thunk middleware)

  • BasicAction extends Action

    The (non-thunk) actions that can be dispatched.

Type declaration

    • (dispatch: ThunkDispatch<State, ExtraThunkArg, BasicAction>, getState: (() => State), extraArgument: ExtraThunkArg): ReturnType
    • A "thunk" action (a callback function that can be dispatched to the Redux store.)

      Also known as the "thunk inner function", when used with the typical pattern of an action creator function that returns a thunk action.

      Parameters

      • dispatch: ThunkDispatch<State, ExtraThunkArg, BasicAction>
      • getState: (() => State)
          • (): State
          • Returns State

      • extraArgument: ExtraThunkArg

      Returns ReturnType

TypedAddListener<State, Dispatch, ExtraArgument, Payload, T>: BaseActionCreator<Payload, T> & AddListenerOverloads<PayloadAction<Payload, T>, State, Dispatch, ExtraArgument>

Type Parameters

TypedRemoveListener<State, Dispatch, Payload, T>: BaseActionCreator<Payload, T> & AddListenerOverloads<PayloadAction<Payload, T>, State, Dispatch, any, UnsubscribeListenerOptions>

Type Parameters

TypedStartListening<State, Dispatch, ExtraArgument>: AddListenerOverloads<UnsubscribeListener, State, Dispatch, ExtraArgument>

Type Parameters

TypedStopListening<State, Dispatch>: RemoveListenerOverloads<State, Dispatch>

Type Parameters

UnsubscribeListener: ((unsubscribeOptions?: UnsubscribeListenerOptions) => void)

Type declaration

Update<T>: { changes: Partial<T>; id: EntityId }

Type Parameters

  • T

Type declaration

UseSelector: { <TState, TSelected>(selector: ((state: TState) => TSelected), equalityFn?: EqualityFn<TSelected>): TSelected; <TSelectors, TSelected>(selectors: TSelectors, combiner: Combiner<TSelectors, TSelected>, equalityFn?: EqualityFn<TSelected>): TSelected; <TSelected>(slide: EnhancedSlice<TSelected, SliceCaseReducers<TSelected>, string>, equalityFn?: EqualityFn<TSelected>): TSelected }

Type declaration

    • <TState, TSelected>(selector: ((state: TState) => TSelected), equalityFn?: EqualityFn<TSelected>): TSelected
    • <TSelectors, TSelected>(selectors: TSelectors, combiner: Combiner<TSelectors, TSelected>, equalityFn?: EqualityFn<TSelected>): TSelected
    • <TSelected>(slide: EnhancedSlice<TSelected, SliceCaseReducers<TSelected>, string>, equalityFn?: EqualityFn<TSelected>): TSelected
    • A hook to access the redux store's state. This hook takes a selector function as an argument. The selector is called with the store state.

      This hook takes an optional equality comparison function as the second parameter that allows you to customize the way the selected state is compared to determine whether the component needs to be re-rendered.

      example

      import React from 'react' import { useSelector } from 'rtkex'

      export const CounterComponent = () => { const counter = useSelector(state => state.counter) return

      {counter}
      }

      Type Parameters

      • TState = unknown

      • TSelected = unknown

      Parameters

      • selector: ((state: TState) => TSelected)

        the selector function

          • (state: TState): TSelected
          • Parameters

            • state: TState

            Returns TSelected

      • Optional equalityFn: EqualityFn<TSelected>

        the function that will be used to determine equality

      Returns TSelected

      the selected state

    • A hook to access the redux store's state. This hook takes a selectors and combiner function as an arguments. The selector will be created by passing selectors and combiner to combineSelectors.

      Type Parameters

      • TSelectors

      • TSelected

      Parameters

      • selectors: TSelectors
      • combiner: Combiner<TSelectors, TSelected>
      • Optional equalityFn: EqualityFn<TSelected>

      Returns TSelected

    • Type Parameters

      • TSelected

      Parameters

      Returns TSelected

ValidateSliceCaseReducers<S, ACR>: ACR & { [ T in keyof ACR]: ACR[T] extends { reducer: any } ? { prepare: any } : {} }

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!

Type Parameters

WithBuilder: { (buildCallback: DynamicBuildCallback<void, Pick<StoreBuilder<any, AnyAction>, "withSlice" | "withReducer">>): (<C>(component: C) => C); (buildCallbacks: DynamicBuildCallback<void, Pick<StoreBuilder<any, AnyAction>, "withSlice" | "withReducer">>[]): (<C>(component: C) => C); <C>(buildCallback: DynamicBuildCallback<void, Pick<StoreBuilder<any, AnyAction>, "withSlice" | "withReducer">>, component: C): C; <C>(buildCallbacks: DynamicBuildCallback<void, Pick<StoreBuilder<any, AnyAction>, "withSlice" | "withReducer">>[], component: C): C }

Type declaration

Variables

$CombinedState: unique symbol

Internal "virtual" symbol used to make the CombinedState type unique.

addListener: TypedAddListener<unknown, ThunkDispatch<unknown, unknown, AnyAction>, unknown, ListenerEntry<unknown, ThunkDispatch<unknown, unknown, AnyAction>>, "listenerMiddleware/add">
clearAllListeners: ActionCreatorWithoutPayload
removeListener: TypedRemoveListener<unknown, ThunkDispatch<unknown, unknown, AnyAction>, ListenerEntry<unknown, ThunkDispatch<unknown, unknown, AnyAction>>, "listenerMiddleware/remove">

Functions

  • Creates a store enhancer that applies middleware to the dispatch method of the Redux store. This is handy for a variety of tasks, such as expressing asynchronous actions in a concise manner, or logging every action payload.

    See redux-thunk package as an example of the Redux middleware.

    Because middleware is potentially asynchronous, this should be the first store enhancer in the composition chain.

    Note that each middleware will be given the dispatch and getState functions as named arguments.

    Returns StoreEnhancer

    A store enhancer applying the middleware.

  • Type Parameters

    • Ext1

    • S

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext1 }>

  • Type Parameters

    • Ext1

    • Ext2

    • S

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext1 & Ext2 }>

  • Type Parameters

    • Ext1

    • Ext2

    • Ext3

    • S

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 }>

  • Type Parameters

    • Ext1

    • Ext2

    • Ext3

    • Ext4

    • S

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 & Ext4 }>

  • Type Parameters

    • Ext1

    • Ext2

    • Ext3

    • Ext4

    • Ext5

    • S

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext1 & Ext2 & Ext3 & Ext4 & Ext5 }>

  • Type Parameters

    • Ext

    • S = any

    Parameters

    Returns StoreEnhancer<{ dispatch: Ext }>

  • Turns an object whose values are action creators, into an object with the same keys, but with every function wrapped into a dispatch call so they may be invoked directly. This is just a convenience method, as you can call store.dispatch(MyActionCreators.doSomething()) yourself just fine.

    For convenience, you can also pass a single function as the first argument, and get a function in return.

    Type Parameters

    Parameters

    • actionCreator: C

      An object whose values are action creator functions. One handy way to obtain it is to use ES6 import * as syntax. You may also pass a single function.

    • dispatch: Dispatch<AnyAction>

      The dispatch function available on your Redux store.

    Returns C

    The object mimicking the original object, but with every action creator wrapped into the dispatch call. If you passed a function as actionCreator, the return value will also be a single function.

  • Type Parameters

    Parameters

    Returns B

  • Type Parameters

    Parameters

    Returns M

  • Type Parameters

    Parameters

    Returns N

  • Turns an object whose values are different reducer functions, into a single reducer function. It will call every child reducer, and gather their results into a single state object, whose keys correspond to the keys of the passed reducer functions.

    Type Parameters

    • S

      Combined state object type.

    Parameters

    • reducers: ReducersMapObject<S, any>

      An object whose values correspond to different reducer functions that need to be combined into one. One handy way to obtain it is to use ES6 import * as reducers syntax. The reducers may never return undefined for any action. Instead, they should return their initial state if the state passed to them was undefined, and the current state for any unrecognized action.

    Returns Reducer<CombinedState<S>>

    A reducer function that invokes every reducer inside the passed object, and builds a state object with the same shape.

  • Type Parameters

    Parameters

    Returns Reducer<CombinedState<S>, A>

  • Type Parameters

    Parameters

    • reducers: M

    Returns Reducer<CombinedState<StateFromReducersMapObject<M>>, ActionFromReducersMapObject<M>>

  • combineSelectors<TSelectors, TResult>(selectors: TSelectors, combiner: Combiner<TSelectors, TResult>): ((state: any) => TResult)
  • combine multiple selectors/slice selectors into one selector

    Type Parameters

    • TSelectors

    • TResult

    Parameters

    • selectors: TSelectors
    • combiner: Combiner<TSelectors, TResult>

    Returns ((state: any) => TResult)

      • (state: any): TResult
      • Parameters

        • state: any

        Returns TResult

  • compose(): (<R>(a: R) => R)
  • compose<F>(f: F): F
  • compose<A, R>(f1: ((b: A) => R), f2: Func0<A>): Func0<R>
  • compose<A, T1, R>(f1: ((b: A) => R), f2: Func1<T1, A>): Func1<T1, R>
  • compose<A, T1, T2, R>(f1: ((b: A) => R), f2: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, T1, T2, T3, R>(f1: ((b: A) => R), f2: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<A, B, R>(f1: ((b: B) => R), f2: ((a: A) => B), f3: Func0<A>): Func0<R>
  • compose<A, B, T1, R>(f1: ((b: B) => R), f2: ((a: A) => B), f3: Func1<T1, A>): Func1<T1, R>
  • compose<A, B, T1, T2, R>(f1: ((b: B) => R), f2: ((a: A) => B), f3: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, B, T1, T2, T3, R>(f1: ((b: B) => R), f2: ((a: A) => B), f3: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<A, B, C, R>(f1: ((b: C) => R), f2: ((a: B) => C), f3: ((a: A) => B), f4: Func0<A>): Func0<R>
  • compose<A, B, C, T1, R>(f1: ((b: C) => R), f2: ((a: B) => C), f3: ((a: A) => B), f4: Func1<T1, A>): Func1<T1, R>
  • compose<A, B, C, T1, T2, R>(f1: ((b: C) => R), f2: ((a: B) => C), f3: ((a: A) => B), f4: Func2<T1, T2, A>): Func2<T1, T2, R>
  • compose<A, B, C, T1, T2, T3, R>(f1: ((b: C) => R), f2: ((a: B) => C), f3: ((a: A) => B), f4: Func3<T1, T2, T3, A>): Func3<T1, T2, T3, R>
  • compose<R>(f1: ((b: any) => R), ...funcs: Function[]): ((...args: any[]) => R)
  • compose<R>(...funcs: Function[]): ((...args: any[]) => R)
  • Composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function.

    Returns (<R>(a: R) => R)

    R function obtained by composing the argument functions from right to left. For example, compose(f, g, h) is identical to doing (...args) => f(g(h(...args))).

      • <R>(a: R): R
      • Composes single-argument functions from right to left. The rightmost function can take multiple arguments as it provides the signature for the resulting composite function.

        Type Parameters

        • R

        Parameters

        • a: R

        Returns R

        R function obtained by composing the argument functions from right to left. For example, compose(f, g, h) is identical to doing (...args) => f(g(h(...args))).

  • Type Parameters

    • F extends Function

    Parameters

    • f: F

    Returns F

  • Type Parameters

    • A

    • R

    Parameters

    • f1: ((b: A) => R)
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func0<A>

    Returns Func0<R>

  • Type Parameters

    • A

    • T1

    • R

    Parameters

    • f1: ((b: A) => R)
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func1<T1, A>

    Returns Func1<T1, R>

  • Type Parameters

    • A

    • T1

    • T2

    • R

    Parameters

    • f1: ((b: A) => R)
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type Parameters

    • A

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: ((b: A) => R)
        • (b: A): R
        • Parameters

          • b: A

          Returns R

    • f2: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type Parameters

    • A

    • B

    • R

    Parameters

    • f1: ((b: B) => R)
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func0<A>

    Returns Func0<R>

  • Type Parameters

    • A

    • B

    • T1

    • R

    Parameters

    • f1: ((b: B) => R)
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func1<T1, A>

    Returns Func1<T1, R>

  • Type Parameters

    • A

    • B

    • T1

    • T2

    • R

    Parameters

    • f1: ((b: B) => R)
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type Parameters

    • A

    • B

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: ((b: B) => R)
        • (b: B): R
        • Parameters

          • b: B

          Returns R

    • f2: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f3: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type Parameters

    • A

    • B

    • C

    • R

    Parameters

    • f1: ((b: C) => R)
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: ((a: B) => C)
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func0<A>

    Returns Func0<R>

  • Type Parameters

    • A

    • B

    • C

    • T1

    • R

    Parameters

    • f1: ((b: C) => R)
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: ((a: B) => C)
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func1<T1, A>

    Returns Func1<T1, R>

  • Type Parameters

    • A

    • B

    • C

    • T1

    • T2

    • R

    Parameters

    • f1: ((b: C) => R)
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: ((a: B) => C)
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func2<T1, T2, A>

    Returns Func2<T1, T2, R>

  • Type Parameters

    • A

    • B

    • C

    • T1

    • T2

    • T3

    • R

    Parameters

    • f1: ((b: C) => R)
        • (b: C): R
        • Parameters

          • b: C

          Returns R

    • f2: ((a: B) => C)
        • (a: B): C
        • Parameters

          • a: B

          Returns C

    • f3: ((a: A) => B)
        • (a: A): B
        • Parameters

          • a: A

          Returns B

    • f4: Func3<T1, T2, T3, A>

    Returns Func3<T1, T2, T3, R>

  • Type Parameters

    • R

    Parameters

    • f1: ((b: any) => R)
        • (b: any): R
        • Parameters

          • b: any

          Returns R

    • Rest ...funcs: Function[]

    Returns ((...args: any[]) => R)

      • (...args: any[]): R
      • Parameters

        • Rest ...args: any[]

        Returns R

  • Type Parameters

    • R

    Parameters

    • Rest ...funcs: Function[]

    Returns ((...args: any[]) => R)

      • (...args: any[]): R
      • Parameters

        • Rest ...args: any[]

        Returns R

  • configureStore<TState, TAction>(buildCallback?: BuildCallback<TState, TAction>): Store<TState, TAction>
  • 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() overriden so that it returns the action type, allowing it to be used in reducer logic that is looking for that action type.

    Type Parameters

    • P = void

    • T extends string = string

    Parameters

    • type: T

      The action type to use for created actions.

    Returns PayloadActionCreator<P, 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() overriden so that it returns the action type, allowing it to be used in reducer logic that is looking for that action type.

    Type Parameters

    Parameters

    • type: T

      The action type to use for created actions.

    • prepareAction: PA

    Returns PayloadActionCreator<ReturnType<PA>["payload"], T, PA>

  • Type Parameters

    • Returned

    • ThunkArg = void

    Parameters

    Returns AsyncThunk<Returned, ThunkArg, {}>

  • Type Parameters

    • Returned

    • ThunkArg

    • ThunkApiConfig extends AsyncThunkConfig

    Parameters

    Returns AsyncThunk<Returned, ThunkArg, ThunkApiConfig>

  • createDraftSafeSelector<Selectors, Result>(...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result)]): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }
  • createDraftSafeSelector<Selectors, Result>(...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result), CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>]): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result) & { clearCache: any }> & { clearCache: any }
  • createDraftSafeSelector<Selectors, Result>(selectors: [...Selectors[]], combiner: ((...args: ExtractReturnType<Selectors>) => Result), options?: CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: 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.

    Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • Rest ...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result)]

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: 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.

    Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • Rest ...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result), CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>]

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result) & { clearCache: any }> & { clearCache: 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.

    Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • selectors: [...Selectors[]]
    • combiner: ((...args: ExtractReturnType<Selectors>) => Result)
        • (...args: ExtractReturnType<Selectors>): Result
        • Parameters

          • Rest ...args: ExtractReturnType<Selectors>

          Returns Result

    • Optional options: CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }

  • Type Parameters

    • T

    Parameters

    Returns EntityAdapter<T>

  • 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.

    Parameters

    Returns Middleware

  • createLoadableSlice<TName, TState, TCaseReducers, TArg>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, {}>, options?: LoadableOptions<TState, TArg, {}, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers>
  • createLoadableSlice<TName, TState, TArg, TCaseReducers, TApiConfig>(name: TName, loader: LoadableLoader<TState | Promise<TState>, TArg, TApiConfig>, options?: LoadableOptions<TState, TArg, TApiConfig, TCaseReducers>): LoadableSlice<TName, TState, TArg, TCaseReducers>
  • createNextState<Curried>(recipe: InferRecipeFromCurried<Curried>, initialState?: InferInitialStateFromCurried<Curried>): Curried
  • createNextState<Recipe>(recipe: Recipe): InferCurriedFromRecipe<Recipe, false>
  • createNextState<State>(recipe: ((state: Draft<State>, initialState: State) => ValidRecipeReturnType<State>)): ((state?: State) => State)
  • createNextState<State, Args>(recipe: ((state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>), initialState: State): ((state?: State, ...args: Args) => State)
  • createNextState<State>(recipe: ((state: Draft<State>) => ValidRecipeReturnType<State>)): ((state: State) => State)
  • createNextState<State, Args>(recipe: ((state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>)): ((state: State, ...args: Args) => State)
  • createNextState<State, Recipe>(recipe: Recipe, initialState: State): InferCurriedFromInitialStateAndRecipe<State, Recipe, false>
  • createNextState<Base, D>(base: Base, recipe: ((draft: D) => ValidRecipeReturnType<D>), listener?: PatchListener): Base
  • createNextState<Base, D>(base: Base, recipe: ((draft: D) => Promise<ValidRecipeReturnType<D>>), listener?: PatchListener): Promise<Base>
  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • Curried

    Parameters

    • recipe: InferRecipeFromCurried<Curried>
    • Optional initialState: InferInitialStateFromCurried<Curried>

    Returns Curried

    a new state, or the initial state if nothing was modified

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • Recipe extends AnyFunc

    Parameters

    • recipe: Recipe

    Returns InferCurriedFromRecipe<Recipe, false>

    a new state, or the initial state if nothing was modified

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • State

    Parameters

    • recipe: ((state: Draft<State>, initialState: State) => ValidRecipeReturnType<State>)
        • (state: Draft<State>, initialState: State): ValidRecipeReturnType<State>
        • Parameters

          • state: Draft<State>
          • initialState: State

          Returns ValidRecipeReturnType<State>

    Returns ((state?: State) => State)

    a new state, or the initial state if nothing was modified

      • (state?: State): State
      • Curried producer that infers curried from the State generic, which is explicitly passed in.

        Parameters

        • Optional state: State

        Returns State

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • State

    • Args extends any[]

    Parameters

    • recipe: ((state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>)
        • (state: Draft<State>, ...args: Args): ValidRecipeReturnType<State>
        • Parameters

          • state: Draft<State>
          • Rest ...args: Args

          Returns ValidRecipeReturnType<State>

    • initialState: State

    Returns ((state?: State, ...args: Args) => State)

    a new state, or the initial state if nothing was modified

      • (state?: State, ...args: Args): State
      • Parameters

        • Optional state: State
        • Rest ...args: Args

        Returns State

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • State

    Parameters

    • recipe: ((state: Draft<State>) => ValidRecipeReturnType<State>)
        • (state: Draft<State>): ValidRecipeReturnType<State>
        • Parameters

          Returns ValidRecipeReturnType<State>

    Returns ((state: State) => State)

    a new state, or the initial state if nothing was modified

      • (state: State): State
      • Parameters

        • state: State

        Returns State

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • State

    • Args extends any[]

    Parameters

    • recipe: ((state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>)
        • (state: Draft<State>, ...args: Args): ValidRecipeReturnType<State>
        • Parameters

          • state: Draft<State>
          • Rest ...args: Args

          Returns ValidRecipeReturnType<State>

    Returns ((state: State, ...args: Args) => State)

    a new state, or the initial state if nothing was modified

      • (state: State, ...args: Args): State
      • Parameters

        • state: State
        • Rest ...args: Args

        Returns State

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    • State

    • Recipe extends Function

    Parameters

    • recipe: Recipe
    • initialState: State

    Returns InferCurriedFromInitialStateAndRecipe<State, Recipe, false>

    a new state, or the initial state if nothing was modified

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    Parameters

    • base: Base

      the initial state

    • recipe: ((draft: D) => ValidRecipeReturnType<D>)
        • (draft: D): ValidRecipeReturnType<D>
        • Parameters

          • draft: D

          Returns ValidRecipeReturnType<D>

    • Optional listener: PatchListener

    Returns Base

    a new state, or the initial state if nothing was modified

  • The produce function takes a value and a "recipe function" (whose return value often depends on the base state). The recipe function is free to mutate its first argument however it wants. All mutations are only ever applied to a copy of the base state.

    Pass only a function to create a "curried producer" which relieves you from passing the recipe function every time.

    Only plain objects and arrays are made mutable. All other objects are considered uncopyable.

    Note: This function is bound to its Immer instance.

    Type Parameters

    Parameters

    • base: Base

      the initial state

    • recipe: ((draft: D) => Promise<ValidRecipeReturnType<D>>)
        • (draft: D): Promise<ValidRecipeReturnType<D>>
        • Parameters

          • draft: D

          Returns Promise<ValidRecipeReturnType<D>>

    • Optional listener: PatchListener

    Returns Promise<Base>

    a new state, or the initial state if nothing was modified

  • createReducer<S>(initialState: S | (() => S), builderCallback: ((builder: ActionReducerMapBuilder<S>) => void)): ReducerWithInitialState<S>
  • createReducer<S, CR>(initialState: S | (() => S), actionsMap: CR, actionMatchers?: ActionMatcherDescriptionCollection<S>, defaultCaseReducer?: CaseReducer<S, AnyAction>): 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.

    The body of every case reducer is implicitly wrapped with a call to produce() from the 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.

    remarks

    The body of every case reducer is implicitly wrapped with a call to produce() from the 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.

    overloadsummary

    This overload accepts a callback function 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
    import {
    createAction,
    createReducer,
    AnyAction,
    PayloadAction,
    } from "@reduxjs/toolkit";

    const increment = createAction<number>("increment");
    const decrement = createAction<number>("decrement");

    function isActionWithNumberPayload(
    action: AnyAction
    ): 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) => {});
    }
    );

    Type Parameters

    • S extends unknown

    Parameters

    • initialState: S | (() => S)

      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.

    • builderCallback: ((builder: ActionReducerMapBuilder<S>) => void)

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

    Returns 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.

    The body of every case reducer is implicitly wrapped with a call to produce() from the 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.

    overloadsummary

    This overload accepts an object where the keys are string action types, and the values are case reducer functions to handle those action types.

    example
    const counterReducer = createReducer(0, {
    increment: (state, action) => state + action.payload,
    decrement: (state, action) => state - action.payload
    })

    // Alternately, use a "lazy initializer" to provide the initial state
    // (works with either form of createReducer)
    const initialState = () => 0
    const counterReducer = createReducer(initialState, {
    increment: (state, action) => state + action.payload,
    decrement: (state, action) => state - action.payload
    })

    Action creators that were generated using createAction may be used directly as the keys here, using computed property syntax:

    const increment = createAction('increment')
    const decrement = createAction('decrement')

    const counterReducer = createReducer(0, {
    [increment]: (state, action) => state + action.payload,
    [decrement.type]: (state, action) => state - action.payload
    })

    Type Parameters

    Parameters

    • initialState: S | (() => S)

      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.

    • actionsMap: CR

      An object mapping from action types to case reducers, each of which handles one specific action type.

    • Optional actionMatchers: ActionMatcherDescriptionCollection<S>

      An array of matcher definitions in the form {matcher, reducer}. All matching reducers will be executed in order, independently if a case reducer matched or not.

    • Optional defaultCaseReducer: CaseReducer<S, AnyAction>

      A "default case" reducer that is executed if no case reducer and no matcher reducer was executed for this action.

    Returns ReducerWithInitialState<S>

  • createSelector<Selectors, Result>(...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result)]): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }
  • createSelector<Selectors, Result>(...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result), CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>]): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result) & { clearCache: any }> & { clearCache: any }
  • createSelector<Selectors, Result>(selectors: [...Selectors[]], combiner: ((...args: ExtractReturnType<Selectors>) => Result), options?: CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>): Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }
  • Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • Rest ...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result)]

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }

  • Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • Rest ...items: [...Selectors[], ((...args: ExtractReturnType<Selectors>) => Result), CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>]

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result) & { clearCache: any }> & { clearCache: any }

  • Type Parameters

    • Selectors extends readonly ((state: any, ...params: any[]) => unknown)[]

    • Result

    Parameters

    • selectors: [...Selectors[]]
    • combiner: ((...args: ExtractReturnType<Selectors>) => Result)
        • (...args: ExtractReturnType<Selectors>): Result
        • Parameters

          • Rest ...args: ExtractReturnType<Selectors>

          Returns Result

    • Optional options: CreateSelectorOptions<[equalityCheckOrOptions?: EqualityFn | DefaultMemoizeOptions]>

    Returns Selector<GetStateFromSelectors<Selectors>, Result, GetParamsFromSelectors<Selectors, Tail<ExpandItems<RemoveNames<{ [ index in string | number | symbol]: LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[index] extends LongestArray<TuplifyUnion<Transpose<ExtractParams<Selectors>>, LastOf<Transpose<ExtractParams<Selectors>>>, [Transpose<ExtractParams<Selectors>>] extends [never] ? true : false>>[number] ? IgnoreInvalidIntersections<IntersectAll<any[any]>> : never }>>>>> & OutputSelectorFields<((...args: ExtractReturnType<Selectors>) => Result & { clearCache: any })> & { clearCache: any }

  • 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.

    Parameters

    Returns Middleware

  • createSlice<TState, TCaseReducers, TName>(name: TName, initialState: TState, reducers: ValidateSliceCaseReducers<TState, TCaseReducers>, options?: Omit<CreateSliceOptions<TState, TCaseReducers, TName>, "name" | "reducers" | "initialState">): ClonableSlice<TState, TCaseReducers, TName>
  • deprecated

    We recommend using the configureStore method of the @reduxjs/toolkit package, which replaces createStore.

    Redux Toolkit is our recommended approach for writing Redux logic today, including store setup, reducers, data fetching, and more.

    For more details, please read this Redux docs page: https://redux.js.org/introduction/why-rtk-is-redux-today

    configureStore from Redux Toolkit is an improved version of createStore that simplifies setup and helps avoid common bugs.

    You should not be using the redux core package by itself today, except for learning purposes. The createStore method from the core redux package will not be removed, but we encourage all users to migrate to using Redux Toolkit for all Redux code.

    If you want to use createStore without this visual deprecation warning, use the legacy_createStore import instead:

    import { legacy_createStore as createStore} from 'redux'

    Type Parameters

    • S

    • A extends Action<any, A>

    • Ext

    • StateExt

    Parameters

    Returns Store<S & StateExt, A> & Ext

  • deprecated

    We recommend using the configureStore method of the @reduxjs/toolkit package, which replaces createStore.

    Redux Toolkit is our recommended approach for writing Redux logic today, including store setup, reducers, data fetching, and more.

    For more details, please read this Redux docs page: https://redux.js.org/introduction/why-rtk-is-redux-today

    configureStore from Redux Toolkit is an improved version of createStore that simplifies setup and helps avoid common bugs.

    You should not be using the redux core package by itself today, except for learning purposes. The createStore method from the core redux package will not be removed, but we encourage all users to migrate to using Redux Toolkit for all Redux code.

    If you want to use createStore without this visual deprecation warning, use the legacy_createStore import instead:

    import { legacy_createStore as createStore} from 'redux'

    Type Parameters

    • S

    • A extends Action<any, A>

    • Ext

    • StateExt

    Parameters

    Returns Store<S & StateExt, A> & Ext

  • current<T>(value: T): T
  • Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer.

    Type Parameters

    • T

    Parameters

    • value: T

    Returns T

  • findNonSerializableValue(value: unknown, path?: string, isSerializable?: ((value: unknown) => boolean), getEntries?: ((value: unknown) => [string, any][]), ignoredPaths?: readonly string[]): NonSerializableValue | false
  • Parameters

    • value: unknown
    • Optional path: string
    • Optional isSerializable: ((value: unknown) => boolean)
        • (value: unknown): boolean
        • Parameters

          • value: unknown

          Returns boolean

    • Optional getEntries: ((value: unknown) => [string, any][])
        • (value: unknown): [string, any][]
        • Parameters

          • value: unknown

          Returns [string, any][]

    • Optional ignoredPaths: readonly string[]

    Returns NonSerializableValue | false

  • freeze<T>(obj: T, deep?: boolean): T
  • Freezes draftable objects. Returns the original object. By default freezes shallowly, but if the second argument is true it will freeze recursively.

    Type Parameters

    • T

    Parameters

    • obj: T
    • Optional deep: boolean

    Returns T

  • getDefaultMiddleware<S, O>(options?: O): MiddlewareArray<ExcludeFromTuple<[ThunkMiddlewareFor<S, O>], never>>
  • Returns any array containing the default middleware installed by configureStore(). Useful if you want to configure your store with a custom middleware array but still keep the default set.

    deprecated

    Prefer to use the callback notation for the middleware option in configureStore to access a pre-typed getDefaultMiddleware instead.

    Type Parameters

    • S = any

    • O extends Partial<GetDefaultMiddlewareOptions> = { immutableCheck: true; serializableCheck: true; thunk: true }

    Parameters

    • Optional options: O

    Returns MiddlewareArray<ExcludeFromTuple<[ThunkMiddlewareFor<S, O>], never>>

    The default middleware used by configureStore().

  • Returns the action type of the actions created by the passed createAction()-generated action creator (arbitrary action creators are not supported).

    Type Parameters

    • T extends string

    Parameters

    Returns T

    The action type used by the action creator.

  • isAllOf<Matchers>(...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.

    Type Parameters

    • Matchers extends [Matcher<any>, ...Matcher<any>[]]

    Parameters

    • Rest ...matchers: Matchers

      The type guards or action creators to match against.

    Returns ((action: any) => action is UnionToIntersection<ActionFromMatcher<Matchers[number]>>)

      • (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.

        Parameters

        • action: any

        Returns action is UnionToIntersection<ActionFromMatcher<Matchers[number]>>

  • isAnyOf<Matchers>(...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.

    Type Parameters

    • Matchers extends [Matcher<any>, ...Matcher<any>[]]

    Parameters

    • Rest ...matchers: Matchers

      The type guards or action creators to match against.

    Returns ((action: any) => action is ActionFromMatcher<Matchers[number]>)

      • (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.

        Parameters

        • action: any

        Returns action is ActionFromMatcher<Matchers[number]>

  • isAsyncThunkAction(): ((action: any) => action is UnknownAsyncThunkAction)
  • isAsyncThunkAction<AsyncThunks>(...asyncThunks: AsyncThunks): ((action: any) => action is ActionsFromAsyncThunk<AsyncThunks[number]>)
  • isAsyncThunkAction(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.

    Returns ((action: any) => action is UnknownAsyncThunkAction)

      • (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.

        Parameters

        • action: any

        Returns action is UnknownAsyncThunkAction

  • 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.

    Type Parameters

    • AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]

    Parameters

    • Rest ...asyncThunks: AsyncThunks

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

    Returns ((action: any) => action is ActionsFromAsyncThunk<AsyncThunks[number]>)

      • (action: any): action is ActionsFromAsyncThunk<AsyncThunks[number]>
      • 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.

        Parameters

        • action: any

        Returns action is ActionsFromAsyncThunk<AsyncThunks[number]>

  • Tests if action is a thunk action

    Parameters

    • action: any

    Returns action is UnknownAsyncThunkAction

  • isDraft(value: any): boolean
  • Returns true if the given value is an Immer draft

    Parameters

    • value: any

    Returns boolean

  • isFulfilled(): ((action: any) => action is UnknownAsyncThunkFulfilledAction)
  • isFulfilled<AsyncThunks>(...asyncThunks: AsyncThunks): ((action: any) => action is FulfilledActionFromAsyncThunk<AsyncThunks[number]>)
  • isFulfilled(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.

    Returns ((action: any) => action is UnknownAsyncThunkFulfilledAction)

      • (action: any): action is UnknownAsyncThunkFulfilledAction
      • 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.

        Parameters

        • action: any

        Returns action is UnknownAsyncThunkFulfilledAction

  • 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.

    Type Parameters

    • AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]

    Parameters

    • Rest ...asyncThunks: AsyncThunks

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

    Returns ((action: any) => action is FulfilledActionFromAsyncThunk<AsyncThunks[number]>)

      • (action: any): action is FulfilledActionFromAsyncThunk<AsyncThunks[number]>
      • 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.

        Parameters

        • action: any

        Returns action is FulfilledActionFromAsyncThunk<AsyncThunks[number]>

  • Tests if action is a fulfilled thunk action

    Parameters

    • action: any

    Returns action is PayloadAction<unknown, string, { arg: unknown; requestId: string; requestStatus: "fulfilled" }, never>

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

    Parameters

    • value: unknown

    Returns boolean

  • isPending(): ((action: any) => action is UnknownAsyncThunkPendingAction)
  • isPending<AsyncThunks>(...asyncThunks: AsyncThunks): ((action: any) => action is PendingActionFromAsyncThunk<AsyncThunks[number]>)
  • isPending(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.

    Returns ((action: any) => action is UnknownAsyncThunkPendingAction)

      • (action: any): action is UnknownAsyncThunkPendingAction
      • 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.

        Parameters

        • action: any

        Returns action is UnknownAsyncThunkPendingAction

  • 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.

    Type Parameters

    • AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]

    Parameters

    • Rest ...asyncThunks: AsyncThunks

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

    Returns ((action: any) => action is PendingActionFromAsyncThunk<AsyncThunks[number]>)

      • (action: any): action is PendingActionFromAsyncThunk<AsyncThunks[number]>
      • 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.

        Parameters

        • action: any

        Returns action is PendingActionFromAsyncThunk<AsyncThunks[number]>

  • Tests if action is a pending thunk action

    Parameters

    • action: any

    Returns action is PayloadAction<undefined, string, { arg: unknown; requestId: string; requestStatus: "pending" }, never>

  • 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.

    Parameters

    • val: any

      The value to check.

    Returns boolean

  • isPlainObject(value: unknown): value is object
  • Returns true if the passed value is "plain" object, i.e. an object whose prototype is the root Object.prototype. This includes objects created using object literals, but not for instance for class instances.

    Parameters

    • value: unknown

      The value to inspect.

    Returns value is object

    True if the argument appears to be a plain object.

  • isRejected(): ((action: any) => action is UnknownAsyncThunkRejectedAction)
  • isRejected<AsyncThunks>(...asyncThunks: AsyncThunks): ((action: any) => action is RejectedActionFromAsyncThunk<AsyncThunks[number]>)
  • isRejected(action: any): action is PayloadAction<unknown, string, { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: true } & { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { 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.

    Returns ((action: any) => action is UnknownAsyncThunkRejectedAction)

      • (action: any): action is UnknownAsyncThunkRejectedAction
      • 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.

        Parameters

        • action: any

        Returns action is UnknownAsyncThunkRejectedAction

  • 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.

    Type Parameters

    • AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]

    Parameters

    • Rest ...asyncThunks: AsyncThunks

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

    Returns ((action: any) => action is RejectedActionFromAsyncThunk<AsyncThunks[number]>)

      • (action: any): action is RejectedActionFromAsyncThunk<AsyncThunks[number]>
      • 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.

        Parameters

        • action: any

        Returns action is RejectedActionFromAsyncThunk<AsyncThunks[number]>

  • Tests if action is a rejected thunk action

    Parameters

    • action: any

    Returns action is PayloadAction<unknown, string, { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: true } & { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: false } & {}, SerializedError>

  • isRejectedWithValue(): ((action: any) => action is UnknownAsyncThunkRejectedAction)
  • isRejectedWithValue<AsyncThunks>(...asyncThunks: AsyncThunks): ((action: any) => action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>)
  • isRejectedWithValue(action: any): action is PayloadAction<unknown, string, { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: true } & { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { 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.

    Returns ((action: any) => action is UnknownAsyncThunkRejectedAction)

      • (action: any): action is UnknownAsyncThunkRejectedAction
      • 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.

        Parameters

        • action: any

        Returns action is UnknownAsyncThunkRejectedAction

  • 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.

    Type Parameters

    • AsyncThunks extends [AnyAsyncThunk, ...AnyAsyncThunk[]]

    Parameters

    • Rest ...asyncThunks: AsyncThunks

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

    Returns ((action: any) => action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>)

      • (action: any): action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>
      • 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.

        Parameters

        • action: any

        Returns action is RejectedWithValueActionFromAsyncThunk<AsyncThunks[number]>

  • Tests if action is a rejected thunk action with value

    Parameters

    • action: any

    Returns action is PayloadAction<unknown, string, { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: true } & { aborted: boolean; arg: unknown; condition: boolean; requestId: string; requestStatus: "rejected" } & { rejectedWithValue: false } & {}, SerializedError>

  • Creates a Redux store that holds the state tree.

    We recommend using configureStore from the @reduxjs/toolkit package, which replaces createStore: https://redux.js.org/introduction/why-rtk-is-redux-today

    The only way to change the data in the store is to call dispatch() on it.

    There should only be a single store in your app. To specify how different parts of the state tree respond to actions, you may combine several reducers into a single reducer function by using combineReducers.

    Type Parameters

    • S

    • A extends Action<any, A>

    • Ext

    • StateExt

    Parameters

    • reducer: Reducer<S, A>

      A function that returns the next state tree, given the current state tree and the action to handle.

    • Optional enhancer: StoreEnhancer<Ext, StateExt>

    Returns Store<S & StateExt, A> & Ext

    A Redux store that lets you read the state, dispatch actions and subscribe to changes.

  • Creates a Redux store that holds the state tree.

    We recommend using configureStore from the @reduxjs/toolkit package, which replaces createStore: https://redux.js.org/introduction/why-rtk-is-redux-today

    The only way to change the data in the store is to call dispatch() on it.

    There should only be a single store in your app. To specify how different parts of the state tree respond to actions, you may combine several reducers into a single reducer function by using combineReducers.

    Type Parameters

    • S

    • A extends Action<any, A>

    • Ext

    • StateExt

    Parameters

    • reducer: Reducer<S, A>

      A function that returns the next state tree, given the current state tree and the action to handle.

    • Optional preloadedState: PreloadedState<S>
    • Optional enhancer: StoreEnhancer<Ext, {}>

    Returns Store<S & StateExt, A> & Ext

    A Redux store that lets you read the state, dispatch actions and subscribe to changes.

  • nanoid(size?: number): string
  • Parameters

    • Optional size: number

    Returns string

  • original<T>(value: T): T | undefined
  • Get the underlying object that is represented by the given draft

    Type Parameters

    • T

    Parameters

    • value: T

    Returns T | undefined

  • unwrapResult<R>(action: R): UnwrappedActionPayload<R>
  • Type Parameters

    • R extends UnwrappableAction

    Parameters

    • action: R

    Returns UnwrappedActionPayload<R>

  • useSelector<TState, TSelected>(selector: ((state: TState) => TSelected), equalityFn?: EqualityFn<TSelected>): TSelected
  • useSelector<TSelectors, TSelected>(selectors: TSelectors, combiner: Combiner<TSelectors, TSelected>, equalityFn?: EqualityFn<TSelected>): TSelected
  • useSelector<TSelected>(slide: EnhancedSlice<TSelected, SliceCaseReducers<TSelected>, string>, equalityFn?: EqualityFn<TSelected>): TSelected
  • Type Parameters

    • TState = unknown

    • TSelected = unknown

    Parameters

    • selector: ((state: TState) => TSelected)
        • (state: TState): TSelected
        • Parameters

          • state: TState

          Returns TSelected

    • Optional equalityFn: EqualityFn<TSelected>

    Returns TSelected

  • Type Parameters

    • TSelectors

    • TSelected

    Parameters

    • selectors: TSelectors
    • combiner: Combiner<TSelectors, TSelected>
    • Optional equalityFn: EqualityFn<TSelected>

    Returns TSelected

  • Type Parameters

    • TSelected

    Parameters

    Returns TSelected

Generated using TypeDoc