UNPKG

1.73 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/redux-mock-store`
3
4# Summary
5This package contains type definitions for redux-mock-store (https://github.com/dmitry-zaets/redux-mock-store).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-mock-store/index.d.ts)
10````ts
11import * as Redux from "redux";
12
13export interface MockStore<S = any, A extends Redux.Action = Redux.AnyAction> extends Redux.Store<S, A> {
14 getActions(): any[];
15 clearActions(): void;
16}
17
18export type MockStoreEnhanced<S = {}, DispatchExts = {}> = MockStore<S> & { dispatch: DispatchExts };
19
20export type MockStoreCreator<S = {}, DispatchExts = {}> = (
21 state?: S | MockGetState<S>,
22) => MockStoreEnhanced<S, DispatchExts>;
23
24export type MockGetState<S = {}> = (actions: Redux.AnyAction[]) => S;
25
26/**
27 * Create Mock Store returns a function that will create a mock store from a state
28 * with the same set of set of middleware applied.
29 *
30 * @param middlewares The list of middleware to be applied.
31 * @template S The type of state to be held by the store.
32 * @template DispatchExts The additional Dispatch signatures for the middlewares applied.
33 */
34declare function createMockStore<S, DispatchExts = {}>(
35 middlewares?: Redux.Middleware[],
36): MockStoreCreator<S, DispatchExts>;
37
38export default createMockStore;
39
40````
41
42### Additional Details
43 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
44 * Dependencies: [redux](https://npmjs.com/package/redux)
45
46# Credits
47These definitions were written by [Marian Palkus](https://github.com/MarianPalkus), and [Cap3](http://www.cap3.de).
48
\No newline at end of file