1.1.8 • Published 6 months ago

@types/redux-promise-listener v1.1.8

Weekly downloads
347
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/redux-promise-listener

Summary

This package contains type definitions for redux-promise-listener (https://github.com/erikras/redux-promise-listener).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-promise-listener.

index.d.ts

// Type definitions for redux-promise-listener 1.1
// Project: https://github.com/erikras/redux-promise-listener
// Definitions by: hikiko4ern <https://github.com/hikiko4ern>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.1

import { AnyAction, Middleware } from 'redux';

export default ReduxPromiseListener.createListener;

declare namespace ReduxPromiseListener {
    type ActionMatcher = (action: AnyAction) => boolean;

    interface Config<
        StartAction extends AnyAction,
        ResolveAction extends AnyAction,
        RejectAction extends AnyAction,
        TReturn
    > {
        start: string;
        resolve: string | ActionMatcher;
        reject: string | ActionMatcher;
        setPayload?: ((action: StartAction, payload: any) => AnyAction) | undefined;
        getPayload?: ((action: ResolveAction) => TReturn) | undefined;
        getError?: ((action: RejectAction) => any) | undefined;
    }

    interface AsyncFunction<TReturn> {
        asyncFunction: (payload?: any) => Promise<TReturn>;
        unsubscribe: () => void;
    }

    interface PromiseListener {
        middleware: Middleware<{}, AnyAction>;
        createAsyncFunction: <
            StartAction extends AnyAction,
            ResolveAction extends AnyAction,
            RejectAction extends AnyAction,
            TReturn = ResolveAction['payload']
        >(
            // tslint:disable-next-line no-unnecessary-generics
            config: Config<StartAction, ResolveAction, RejectAction, TReturn>,
        ) => AsyncFunction<TReturn>;
    }

    function createListener(): PromiseListener;
}

Additional Details

  • Last updated: Thu, 08 Jul 2021 22:41:53 GMT
  • Dependencies: @types/redux
  • Global values: none

Credits

These definitions were written by hikiko4ern.

1.1.8

6 months ago

1.1.7

6 months ago

1.1.6

7 months ago

1.1.5

8 months ago

1.1.4

9 months ago

1.1.3

1 year ago

1.1.2

3 years ago

1.1.1

4 years ago

1.1.0

5 years ago