# @types/redux-mock-store

> TypeScript definitions for redux-mock-store

Latest version **1.5.0** (published 2024-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/redux-mock-store
pnpm add @types/redux-mock-store
yarn add @types/redux-mock-store
bun add @types/redux-mock-store
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.5.0 |
| Published | 2024-11-18 |
| First published | 2016-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51441 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/redux-mock-store
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store
- npm.io page: https://npm.io/package/@types/redux-mock-store

## Dependencies (1)

- [redux](https://npm.io/package/redux.md) ^4.0.5

## Recent versions

- 1.5.0 (latest) — 2024-11-18
- 1.0.6 (ts4.6) — 2023-11-07
- 1.0.3 (ts4.3) — 2021-07-09
- 1.0.2 (ts3.0) — 2020-01-27
- 1.0.1 (ts2.5) — 2019-04-30
- 0.0.12 (ts2.2) — 2017-10-25
- 0.0.19 — 2024-11-03
- 0.0.18 — 2023-11-07
- 0.0.17 — 2023-10-18
- 1.0.5 — 2023-10-18
- 0.0.16 — 2023-09-27
- 1.0.4 — 2023-09-27
- 0.0.15 — 2021-07-09
- 1.0.0 — 2018-06-22
- 0.0.14 — 2018-06-22
- … 12 more at https://npm.io/package/@types/redux-mock-store/versions

## README

# Installation
> `npm install --save @types/redux-mock-store`

# Summary
This package contains type definitions for redux-mock-store (https://github.com/dmitry-zaets/redux-mock-store).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store/index.d.ts)
````ts
import * as Redux from "redux";

export interface MockStore<S = any, A extends Redux.Action = Redux.AnyAction> extends Redux.Store<S, A> {
    getActions(): any[];
    clearActions(): void;
}

export type MockStoreEnhanced<S = {}, DispatchExts = {}> = MockStore<S> & { dispatch: DispatchExts };

export type MockStoreCreator<S = {}, DispatchExts = {}> = (
    state?: S | MockGetState<S>,
) => MockStoreEnhanced<S, DispatchExts>;

export type MockGetState<S = {}> = (actions: Redux.AnyAction[]) => S;

/**
 * @deprecated
 *
 * The Redux team does not recommend using this package for testing. Instead, check out our {@link https://redux.js.org/recipes/writing-tests testing docs} to learn more about testing Redux code.
 *
 * Testing with a mock store leads to potentially confusing behaviour, such as state not updating when actions are dispatched. Additionally, it's a lot less useful to assert on the actions dispatched rather than the observable state changes.
 *
 * You can test the entire combination of action creators, reducers, and selectors in a single test, for example:
 * ```js
 * it("should add a todo", () => {
 *   const store = makeStore(); // a user defined reusable store factory
 *
 *   store.dispatch(addTodo("Use Redux"));
 *
 *   expect(selectTodos(store.getState())).toEqual([{ text: "Use Redux", completed: false }]);
 * });
 * ```
 *
 * This avoids common pitfalls of testing each of these in isolation, such as mocked state shape becoming out of sync with the actual application.
 *
 * If you want to use `configureStore` without this visual deprecation warning, use the `legacy_configureStore` export instead.
 *
 * `import { legacy_configureStore as configureStore } from 'redux-mock-store';`
 */
export function configureStore<S, DispatchExts = {}>(
    middlewares?: Redux.Middleware[],
): MockStoreCreator<S, DispatchExts>;

/**
 * Create Mock Store returns a function that will create a mock store from a state
 * with the same set of set of middleware applied.
 *
 * @param middlewares The list of middleware to be applied.
 * @template S The type of state to be held by the store.
 * @template DispatchExts The additional Dispatch signatures for the middlewares applied.
 */
export const legacy_configureStore: typeof configureStore;

export default configureStore;

````

### Additional Details
 * Last updated: Mon, 18 Nov 2024 12:03:08 GMT
 * Dependencies: [redux](https://npmjs.com/package/redux)

# Credits
These definitions were written by [Marian Palkus](https://github.com/MarianPalkus), and [Cap3](http://www.cap3.de).

---
_Source: https://npm.io/package/@types/redux-mock-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
