Navigation Menu

Skip to content

Commit

Permalink
Update to redux@4.x + redux-thunk@2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xdave committed May 30, 2018
1 parent 43682ac commit 1b50ed3
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 214 deletions.
5 changes: 3 additions & 2 deletions lib/examples.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/examples.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions lib/index.d.ts
@@ -1,24 +1,24 @@
import { Dispatch } from 'redux';
import { ThunkAction } from 'redux-thunk';
import { AnyAction } from 'redux';
import { ThunkDispatch, ThunkAction } from 'redux-thunk';
import { AsyncActionCreators, ActionCreatorFactory } from 'typescript-fsa';
/**
* It's either a promise, or it isn't
*/
export declare type MaybePromise<T> = T | Promise<T>;
export declare type MaybePromise<Type> = Type | Promise<Type>;
/**
* A redux-thunk with the params as the first argument. You don't have to
* return a promise; but, the result of the dispatch will be one.
*/
export declare type AsyncWorker<P, S, T, U = any> = (params: P, dispatch: Dispatch<T>, getState: () => T, extra: U) => MaybePromise<S>;
export declare type AsyncWorker<Params, Succ, State, Extra = any> = (params: Params, dispatch: ThunkDispatch<State, Extra, AnyAction>, getState: () => State, extra: Extra) => MaybePromise<Succ>;
/** A function that takes parameters and returns a redux-thunk */
export declare type ThunkActionCreator<P, R, S, U> = (params?: P) => ThunkAction<R, S, U>;
export declare type ThunkActionCreator<Params, Result, State, Extra> = (params?: Params) => ThunkAction<Result, State, Extra, AnyAction>;
/**
* Bind a redux-thunk to typescript-fsa async action creators
* @param actionCreators The typescript-fsa async action creators
* @param asyncWorker A redux-thunk with extra `params` as the first argument
* @returns a ThunkActionCreator, the result of which you can pass to dispatch()
*/
export declare const bindThunkAction: <P, S, E, T, U = any>(actionCreators: AsyncActionCreators<P, S, E>, asyncWorker: AsyncWorker<P, S, T, U>) => ThunkActionCreator<P, Promise<S>, T, U>;
export declare const bindThunkAction: <Params, Succ, Err, State, Extra = any>(actionCreators: AsyncActionCreators<Params, Succ, Err>, asyncWorker: AsyncWorker<Params, Succ, State, Extra>) => ThunkActionCreator<Params, Promise<Succ>, State, Extra>;
/**
* Factory function to easily create a typescript-fsa redux thunk
* @param factory typescript-fsa action creator factory
Expand All @@ -27,9 +27,9 @@ export declare const bindThunkAction: <P, S, E, T, U = any>(actionCreators: Asyn
* - the your worker thunk function
* And returns object with the async actions and the thunk itself
*/
export declare const asyncFactory: <T = any, U = any>(factory: ActionCreatorFactory) => <P, S, E = Error>(type: string, fn: AsyncWorker<P, S, T, U>, async?: AsyncActionCreators<P, S, E>) => {
async: AsyncActionCreators<P, S, E>;
action: ThunkActionCreator<P, Promise<S>, T, U>;
export declare const asyncFactory: <State = any, Extra = any>(factory: ActionCreatorFactory) => <Params, Succ, Err = Error>(type: string, fn: AsyncWorker<Params, Succ, State, Extra>, async?: AsyncActionCreators<Params, Succ, Err>) => {
async: AsyncActionCreators<Params, Succ, Err>;
action: ThunkActionCreator<Params, Promise<Succ>, State, Extra>;
};
/**
* Passing the result of this to bindActionCreators and then calling the result
Expand All @@ -38,5 +38,5 @@ export declare const asyncFactory: <T = any, U = any>(factory: ActionCreatorFact
* @param thunkActionCreator The thunk action creator
* @returns thunkAction as if it was bound
*/
export declare const thunkToAction: <P, R, S, U>(thunkActionCreator: ThunkActionCreator<P, R, S, U>) => (params?: P | undefined) => R;
export declare const thunkToAction: <Params, Succ, State, Extra>(thunkActionCreator: ThunkActionCreator<Params, Succ, State, Extra>) => (params?: Params | undefined) => Succ;
export default bindThunkAction;
2 changes: 1 addition & 1 deletion lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1b50ed3

Please sign in to comment.