[TS 2] redux-mock-store tweaks (#11614)

This commit is contained in:
beckend 2016-10-03 23:44:03 +02:00 committed by Mohamed Hegazy
parent 82ed03dce3
commit 282de8d987
2 changed files with 12 additions and 8 deletions

View File

@ -41,3 +41,7 @@ store.dispatch({ type: 'INCREMENT' });
var actions: Array<any> = store.getActions();
store.clearActions();
// actions access without the need to cast
var actions2 = store.getActions();
actions2[10].payload.id;

View File

@ -8,16 +8,16 @@
declare module 'redux-mock-store' {
import * as Redux from 'redux'
function createMockStore<T>(middlewares?:Redux.Middleware[]):mockStore<T>
function createMockStore<T>(middlewares?: Redux.Middleware[]): mockStore<T>;
export type mockStore<T> = (state?:T) => IStore<T>;
export type mockStore<T> = (state?: T) => IStore<T>;
export type IStore<T> = {
dispatch(action: any):any
getState():T
getActions():Object[]
clearActions():void
subscribe(listener: Function):Function
export interface IStore<T> {
dispatch(action: any): any;
getState(): T;
getActions(): any[];
clearActions(): void;
subscribe(listener: Function): Function;
}
export default createMockStore