Skip to content

Commit 7db3e48

Browse files
authored
export AsyncThunkOptions (#950)
1 parent 9abaec4 commit 7db3e48

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

etc/redux-toolkit.api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ export type AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig extends AsyncThu
8787
arg: ThunkArg;
8888
};
8989

90+
// @public
91+
export interface AsyncThunkOptions<ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> {
92+
condition?(arg: ThunkArg, api: Pick<GetThunkAPI<ThunkApiConfig>, 'getState' | 'extra'>): boolean | undefined;
93+
dispatchConditionRejection?: boolean;
94+
// (undocumented)
95+
serializeError?: (x: unknown) => GetSerializedErrorType<ThunkApiConfig>;
96+
}
97+
9098
// @public
9199
export type AsyncThunkPayloadCreator<Returned, ThunkArg = void, ThunkApiConfig extends AsyncThunkConfig = {}> = (arg: ThunkArg, thunkAPI: GetThunkAPI<ThunkApiConfig>) => AsyncThunkPayloadCreatorReturnValue<Returned, ThunkApiConfig>;
92100

src/createAsyncThunk.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,12 @@ type AsyncThunkActionCreator<
193193
: (arg: ThunkArg) => AsyncThunkAction<Returned, ThunkArg, ThunkApiConfig>
194194
>
195195

196-
interface AsyncThunkOptions<
196+
/**
197+
* Options object for `createAsyncThunk`.
198+
*
199+
* @public
200+
*/
201+
export interface AsyncThunkOptions<
197202
ThunkArg = void,
198203
ThunkApiConfig extends AsyncThunkConfig = {}
199204
> {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export {
106106

107107
export {
108108
AsyncThunk,
109+
AsyncThunkOptions,
109110
AsyncThunkAction,
110111
AsyncThunkPayloadCreatorReturnValue,
111112
AsyncThunkPayloadCreator,

0 commit comments

Comments
 (0)