Add more redux types

This commit is contained in:
Jordan Eldredge 2018-10-06 14:06:18 -07:00
parent f3c5b04286
commit 5bcb97c14f
2 changed files with 23 additions and 3 deletions

View file

@ -7,7 +7,14 @@ import { merge } from "./utils";
import { UPDATE_TIME_ELAPSED, STEP_MARQUEE } from "./actionTypes";
import Media from "./media";
import Emitter from "./emitter";
import { Extras, MiddlewareStore, Dispatch, Action, AppState } from "./types";
import {
Extras,
MiddlewareStore,
Dispatch,
Action,
AppState,
Middleware
} from "./types";
const compose = composeWithDevTools({
actionsBlacklist: [UPDATE_TIME_ELAPSED, STEP_MARQUEE]
@ -16,8 +23,8 @@ const compose = composeWithDevTools({
export default function(
media: Media,
actionEmitter: Emitter,
customMiddlewares = [],
stateOverrides: DeepPartial<AppState>,
customMiddlewares: Middleware[] = [],
stateOverrides: DeepPartial<AppState> | undefined,
extras: Extras
) {
let initialState;

View file

@ -474,6 +474,19 @@ export interface DispatchObject {
export type Dispatch = (action: Dispatchable) => void;
export type Reducer = (state: AppState, action: Action) => AppState;
export type Middleware = (
store: Store
) => (next: Dispatch) => (action: Action) => any;
export interface Store {
subscribe(cb: () => void): () => void;
dispatch: Dispatch;
getState: GetState;
replaceReducer(reducer: Reducer): void;
}
export interface MiddlewareStore {
dispatch: Dispatch;
getState: GetState;