UNPKG

@types/redux-mock-store

Version:
48 lines (36 loc) 1.73 kB
# 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; /** * 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. */ declare function createMockStore<S, DispatchExts = {}>( middlewares?: Redux.Middleware[], ): MockStoreCreator<S, DispatchExts>; export default createMockStore; ```` ### Additional Details * Last updated: Tue, 07 Nov 2023 20:08:00 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).