You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
redux-promise-listener doesn't have typescript type definitions at the moment. I tried to convert existing flow type definitions and I ended up with this:
declare module 'redux-promise-listener' {
import { Store } from 'redux';
export type State = any;
export interface Action {
type: string;
payload?: any;
}
export type Next = (action: Action) => State;
export type SetPayload = (action: Action, payload: any) => Action;
export type GetPayload = (action: Action) => any;
// I'm not sure about this generic
export type Middleware<S = any> = (store: Store<S>) => (
(next: Next) => (
(action: Action) => State
)
);
export interface Config {
start: string;
resolve: string;
reject: string;
setPayload?: SetPayload;
getPayload?: GetPayload;
getError?: GetPayload;
}
export interface AsyncFunction {
asyncFunction: (...args: Array<any>) => Promise<any>;
unsubscribe: () => void;
}
export type PromiseListener = {
middleware: Middleware,
createAsyncFunction: (config: Config) => AsyncFunction
};
export default function createListener(): PromiseListener;
}
I'm not proposing a pull request because I'm not sure if this declaration is correct and whether you find this idea useful.
Thank you.
The text was updated successfully, but these errors were encountered:
Hi,
redux-promise-listener
doesn't have typescript type definitions at the moment. I tried to convert existing flow type definitions and I ended up with this:I'm not proposing a pull request because I'm not sure if this declaration is correct and whether you find this idea useful.
Thank you.
The text was updated successfully, but these errors were encountered: