Skip to content

Commit 39c5b31

Browse files
committed
manually import types to prevent a bundling issue
1 parent 6f19daf commit 39c5b31

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

etc/redux-toolkit.api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,28 @@ 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<Returned, ThunkArg = void, State = unknown, Extra = unknown, DispatchType extends Dispatch = Dispatch, ActionType extends string = string, ThunkAPI extends BaseThunkAPI<any, any, any> = BaseThunkAPI<State, Extra, DispatchType>>(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, {
105+
export function createAsyncThunk<Returned, ThunkArg = void, State = unknown, Extra = unknown, DispatchType extends Dispatch = Dispatch, ActionType extends string = string, ThunkAPI extends BaseThunkAPI<any, any, any> = BaseThunkAPI<State, Extra, DispatchType>>(type: ActionType, payloadCreator: (arg: ThunkArg, thunkAPI: ThunkAPI) => Promise<Returned> | Returned): ((arg: ThunkArg) => (dispatch: ThunkAPI["dispatch"], getState: ThunkAPI["getState"], extra: ThunkAPI["extra"]) => Promise<PayloadAction<undefined, string, {
106106
arg: ThunkArg;
107107
requestId: string;
108108
aborted: boolean;
109109
abortReason: string | undefined;
110-
}, any> | import("./createAction").PayloadAction<Returned, string, {
110+
}, any> | PayloadAction<Returned, string, {
111111
arg: ThunkArg;
112112
requestId: string;
113113
}, never>> & {
114114
abort: (reason?: string) => void;
115115
}) & {
116-
pending: import("./createAction").ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, {
116+
pending: ActionCreatorWithPreparedPayload<[string, ThunkArg], undefined, string, never, {
117117
arg: ThunkArg;
118118
requestId: string;
119119
}>;
120-
rejected: import("./createAction").ActionCreatorWithPreparedPayload<[Error, string, ThunkArg], undefined, string, any, {
120+
rejected: ActionCreatorWithPreparedPayload<[Error, string, ThunkArg], undefined, string, any, {
121121
arg: ThunkArg;
122122
requestId: string;
123123
aborted: boolean;
124124
abortReason: string | undefined;
125125
}>;
126-
fulfilled: import("./createAction").ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, {
126+
fulfilled: ActionCreatorWithPreparedPayload<[Returned, string, ThunkArg], Returned, string, never, {
127127
arg: ThunkArg;
128128
requestId: string;
129129
}>;

src/createAsyncThunk.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { Dispatch } from 'redux'
22
import nanoid from 'nanoid'
3-
import { createAction } from './createAction'
3+
import {
4+
createAction,
5+
PayloadAction,
6+
ActionCreatorWithPreparedPayload
7+
} from './createAction'
8+
9+
// @ts-ignore we need the import of these types due to a bundling issue.
10+
type _Keep = PayloadAction | ActionCreatorWithPreparedPayload<any, unknown>
411

512
export type BaseThunkAPI<S, E, D extends Dispatch = Dispatch> = {
613
dispatch: D

0 commit comments

Comments
 (0)