Skip to content

Commit

Permalink
export AsyncThunkOptions (#950)
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Mar 28, 2021
1 parent 9abaec4 commit 7db3e48
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions etc/redux-toolkit.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ export type AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig extends AsyncThu
arg: ThunkArg;
};

// @public
export interface AsyncThunkOptions<ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> {
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean | undefined;
dispatchConditionRejection?: boolean;
// (undocumented)
serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>;
}

// @public
export type AsyncThunkPayloadCreator<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> = (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>;

Expand Down
7 changes: 6 additions & 1 deletion src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ type AsyncThunkActionCreator<
: (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>
>

interface AsyncThunkOptions<
/**
* Options object for `createAsyncThunk`.
*
* @public
*/
export interface AsyncThunkOptions<
ThunkArg = void,
ThunkApiConfig extends AsyncThunkConfig = {}
> {
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export {

export {
AsyncThunk,
AsyncThunkOptions,
AsyncThunkAction,
AsyncThunkPayloadCreatorReturnValue,
AsyncThunkPayloadCreator,
Expand Down

0 comments on commit 7db3e48

Please sign in to comment.