Skip to content

Commit 6ce3e43

Browse files
committed
Update public API
1 parent a53849b commit 6ce3e43

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

etc/redux-toolkit.api.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,35 +102,29 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
102102
export function createAction<PA extends PrepareAction<any>, T extends string = string>(type: T, prepareAction: PA): PayloadActionCreator<ReturnType<PA>['payload'], T, PA>;
103103

104104
// @alpha (undocumented)
105-
export function createAsyncThunk<ActionType extends string, Returned, ActionParams = void, TA extends AsyncThunksArgs<any, any, any> = AsyncThunksArgs<unknown, unknown, Dispatch>>(type: ActionType, payloadCreator: (args: ActionParams, thunkArgs: TA) => Promise<Returned> | Returned): ((args: ActionParams) => (dispatch: TA["dispatch"], getState: TA["getState"], extra: TA["extra"]) => Promise<import("./createAction").PayloadAction<undefined, string, {
106-
args: ActionParams;
105+
export function createAsyncThunk<ActionType extends string, Returned, ThunkArg = void, ThunkAPI extends BaseThunkAPI<any, any, any> = BaseThunkAPI<unknown, unknown, Dispatch>>(type: ActionType, payloadCreator: (arg: ThunkArg, thunkAPI: ThunkAPI) => Promise<Returned> | Returned): ((arg: ThunkArg) => (dispatch: ThunkAPI["dispatch"], getState: ThunkAPI["getState"], extra: ThunkAPI["extra"]) => Promise<import("./createAction").PayloadAction<undefined, string, {
106+
arg: ThunkArg;
107107
requestId: string;
108-
} | {
109108
aborted: boolean;
110-
abortReason: string;
111-
args: ActionParams;
112-
requestId: string;
109+
abortReason: string | undefined;
113110
}, any> | import("./createAction").PayloadAction<Returned, string, {
114-
args: ActionParams;
111+
arg: ThunkArg;
115112
requestId: string;
116113
}, never>> & {
117114
abort: (reason?: string) => void;
118115
}) & {
119-
pending: import("./createAction").ActionCreatorWithPreparedPayload<[string, ActionParams], undefined, string, never, {
120-
args: ActionParams;
116+
pending: import("./createAction").ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, {
117+
arg: ThunkArg;
121118
requestId: string;
122119
}>;
123-
rejected: import("./createAction").ActionCreatorWithPreparedPayload<[Error, string, ActionParams], undefined, string, any, {
124-
args: ActionParams;
120+
rejected: import("./createAction").ActionCreatorWithPreparedPayload<[Error, string, ThunkArg], undefined, string, any, {
121+
arg: ThunkArg;
125122
requestId: string;
126-
} | {
127123
aborted: boolean;
128-
abortReason: string;
129-
args: ActionParams;
130-
requestId: string;
124+
abortReason: string | undefined;
131125
}>;
132-
fulfilled: import("./createAction").ActionCreatorWithPreparedPayload<[Returned, string, ActionParams], Returned, string, never, {
133-
args: ActionParams;
126+
fulfilled: import("./createAction").ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, {
127+
arg: ThunkArg;
134128
requestId: string;
135129
}>;
136130
};
@@ -260,6 +254,18 @@ export interface SerializableStateInvariantMiddlewareOptions {
260254
isSerializable?: (value: any) => boolean;
261255
}
262256

257+
// @alpha (undocumented)
258+
export interface SerializedError {
259+
// (undocumented)
260+
code?: string;
261+
// (undocumented)
262+
message?: string;
263+
// (undocumented)
264+
name?: string;
265+
// (undocumented)
266+
stack?: string;
267+
}
268+
263269
// @public
264270
export interface Slice<State = any, CaseReducers extends SliceCaseReducers<State> = SliceCaseReducers<State>> {
265271
actions: CaseReducerActions<CaseReducers>;

src/createAsyncThunk.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ type BaseThunkAPI<S, E, D extends Dispatch = Dispatch> = {
1010
signal: AbortSignal
1111
}
1212

13+
/**
14+
* @alpha
15+
*/
1316
export interface SerializedError {
1417
name?: string
1518
message?: string

0 commit comments

Comments
 (0)