Skip to content

Commit d72b051

Browse files
committed
Export createAsyncThunk as part of the public API
1 parent 12351d7 commit d72b051

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

etc/redux-toolkit.api.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,25 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
101101
// @public
102102
export function createAction<PA extends PrepareAction<any>, T extends string = string>(type: T, prepareAction: PA): PayloadActionCreator<ReturnType<PA>['payload'], T, PA>;
103103

104+
// @public (undocumented)
105+
export function createAsyncThunk<ActionType extends string, PayloadCreator extends AsyncActionCreator<unknown, Dispatch, unknown, undefined>>(type: ActionType, payloadCreator: PayloadCreator): {
106+
(args?: Parameters<PayloadCreator>[0]["args"] | undefined): (dispatch: any, getState: any, extra: any) => Promise<any>;
107+
pending: ActionCreatorWithPayload<{
108+
args: Parameters<PayloadCreator>[0]["args"];
109+
}, string>;
110+
rejected: ActionCreatorWithPayload<{
111+
args: Parameters<PayloadCreator>[0]["args"];
112+
error: Error;
113+
}, string>;
114+
fulfilled: ActionCreatorWithPayload<{
115+
args: Parameters<PayloadCreator>[0]["args"];
116+
result: Await<ReturnType<PayloadCreator>>;
117+
}, ActionType>;
118+
finished: ActionCreatorWithPayload<{
119+
args: Parameters<PayloadCreator>[0]["args"];
120+
}, string>;
121+
};
122+
104123
// @public (undocumented)
105124
export function createEntityAdapter<T>(options?: {
106125
selectId?: IdSelector<T>;

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ export {
7373
IdSelector,
7474
Comparer
7575
} from './entities/models'
76+
77+
export { createAsyncThunk } from './createAsyncThunk'

0 commit comments

Comments
 (0)