DefinitelyTyped/types/redux-cablecar/index.d.ts
Christoph Flick 4c52cecef4 Add types for redux-cablecar (#38944)
* Add types for redux-cablecar

* Make payload for the perform function optional
2019-10-10 16:26:17 -07:00

31 lines
925 B
TypeScript

// Type definitions for redux-cablecar 3.0
// Project: https://github.com/ndhays/redux-cablecar#readme
// Definitions by: Christoph Flick <https://github.com/ChFlick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
import { Action, Middleware, Store } from 'redux';
export interface Options {
connected?: () => void;
disconnected?: () => void;
params?: object;
prefix?: string;
optimisticOnFail?: boolean;
}
export interface CableCar {
changeChannel: (channel: string, options?: Options) => void;
getChannel: () => string;
getParams: () => object;
perform: (method: string, payload?: any) => void;
send: (action: string) => void;
}
declare var middleware: Middleware & {
connect: (store: Store, channel: string, options?: Options) => CableCar;
setProvider: (actionCableProvider: string) => void;
};
export default middleware;