diff --git a/index.d.ts b/index.d.ts index 305680376c..027c2c1751 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,8 +1,8 @@ -export interface ActionCreator { - (...args: any[]): any; +export interface Action { + type: string; } -export type Reducer = (state: S, action: any) => S; +export type Reducer = (state: S, action: Action) => S; export type Dispatch = (action: any) => any; @@ -15,25 +15,34 @@ export interface Middleware { (api: MiddlewareAPI): (next: Dispatch) => Dispatch; } -export class Store { +export interface Store { dispatch: Dispatch; getState: () => S; subscribe: (listener: () => void) => () => void; replaceReducer: (reducer: Reducer) => void; } -export type StoreCreator = (reducer: Reducer, initialState?: S) => Store; +export interface StoreCreator { + (reducer: Reducer): Store; + (reducer: Reducer, enhancer: StoreEnhancer): Store; + (reducer: Reducer, initialState: S): Store; + (reducer: Reducer, initialState: S, enhancer: StoreEnhancer): Store; +} export type StoreEnhancer = (next: StoreCreator) => StoreCreator; -export function createStore(reducer: Reducer, initialState?: S, - enhancer?: StoreEnhancer): Store; - -export function bindActionCreators(actionCreators: T, dispatch: Dispatch): T; +export const createStore: StoreCreator; export function combineReducers(reducers: {[key: string]: Reducer}): Reducer; export function applyMiddleware(...middlewares: Middleware[]): StoreEnhancer; + +export interface ActionCreator { + (...args: any[]): any; +} + +export function bindActionCreators(actionCreators: T, dispatch: Dispatch): T; + // from DefinitelyTyped/compose-function // Hardcoded signatures for 2-4 parameters export function compose(f1: (b: B) => C,