DefinitelyTyped/types/redux-socket.io/index.d.ts
Igor Snake 68e71f0c21 Added redux-socket.io type (#22773)
* Added redux-socket.io type

* Fixed bad dependency on socket.io
2018-01-10 10:29:28 -08:00

20 lines
744 B
TypeScript

// Type definitions for redux-socket.io 1.4
// Project: https://github.com/itaylor/redux-socket.io#readme
// Definitions by: Igor Voropaev <https://github.com/snakeego>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="socket.io-client" />
import { Middleware, Action, Dispatch } from 'redux';
export interface MiddlewareOptions {
eventName?: string;
execute?: <S>(action: Action, emitBound: SocketIOClient.Socket, next: Dispatch<S>, dispatch: Dispatch<S>) => any;
}
export default function createSocketIoMiddleware(
socket: SocketIOClient.Socket,
criteria: (string | ReadonlyArray<string> | ((type: string, action: Action) => boolean)),
options?: MiddlewareOptions
): Middleware;