From 282de8d987bcf9cf2df3bdb990a5d351d596d389 Mon Sep 17 00:00:00 2001 From: beckend Date: Mon, 3 Oct 2016 23:44:03 +0200 Subject: [PATCH] [TS 2] redux-mock-store tweaks (#11614) --- redux-mock-store/redux-mock-store-tests.ts | 4 ++++ redux-mock-store/redux-mock-store.d.ts | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/redux-mock-store/redux-mock-store-tests.ts b/redux-mock-store/redux-mock-store-tests.ts index 373a3f8fd1..15d51d1f23 100644 --- a/redux-mock-store/redux-mock-store-tests.ts +++ b/redux-mock-store/redux-mock-store-tests.ts @@ -41,3 +41,7 @@ store.dispatch({ type: 'INCREMENT' }); var actions: Array = store.getActions(); store.clearActions(); + +// actions access without the need to cast +var actions2 = store.getActions(); +actions2[10].payload.id; \ No newline at end of file diff --git a/redux-mock-store/redux-mock-store.d.ts b/redux-mock-store/redux-mock-store.d.ts index ad37ad4e06..9183423bfd 100644 --- a/redux-mock-store/redux-mock-store.d.ts +++ b/redux-mock-store/redux-mock-store.d.ts @@ -8,16 +8,16 @@ declare module 'redux-mock-store' { import * as Redux from 'redux' - function createMockStore(middlewares?:Redux.Middleware[]):mockStore + function createMockStore(middlewares?: Redux.Middleware[]): mockStore; - export type mockStore = (state?:T) => IStore; + export type mockStore = (state?: T) => IStore; - export type IStore = { - dispatch(action: any):any - getState():T - getActions():Object[] - clearActions():void - subscribe(listener: Function):Function + export interface IStore { + dispatch(action: any): any; + getState(): T; + getActions(): any[]; + clearActions(): void; + subscribe(listener: Function): Function; } export default createMockStore