11import type { Dispatch , UnknownAction } from 'redux'
22import type { ThunkDispatch } from 'redux-thunk'
3- import type { ActionCreatorWithPreparedPayload } from './createAction'
3+ import type {
4+ ActionCreatorWithPreparedPayload ,
5+ PayloadAction ,
6+ } from './createAction'
47import { createAction } from './createAction'
58import { isAnyOf } from './matchers'
69import { nanoid } from './nanoid'
710import type {
11+ AnyNonNullishValue ,
812 FallbackIfUnknown ,
913 Id ,
1014 IsAny ,
1115 IsUnknown ,
1216 SafePromise ,
1317} from './tsHelpers'
1418
19+ // @ts -ignore we need the import of these types due to a bundling issue.
20+ type _Keep = PayloadAction | ActionCreatorWithPreparedPayload < any , unknown >
21+
1522export type BaseThunkAPI <
1623 S ,
1724 E ,
@@ -213,7 +220,7 @@ export type AsyncThunkPayloadCreatorReturnValue<
213220export type AsyncThunkPayloadCreator <
214221 Returned ,
215222 ThunkArg = void ,
216- ThunkApiConfig extends AsyncThunkConfig = { } ,
223+ ThunkApiConfig extends AsyncThunkConfig = AnyNonNullishValue ,
217224> = (
218225 arg : ThunkArg ,
219226 thunkAPI : GetThunkAPI < ThunkApiConfig > ,
@@ -286,7 +293,7 @@ type AsyncThunkActionCreator<
286293 */
287294export type AsyncThunkOptions <
288295 ThunkArg = void ,
289- ThunkApiConfig extends AsyncThunkConfig = { } ,
296+ ThunkApiConfig extends AsyncThunkConfig = AnyNonNullishValue ,
290297> = {
291298 /**
292299 * A method to control whether the asyncThunk should be executed. Has access to the
@@ -348,7 +355,7 @@ export type AsyncThunkOptions<
348355
349356export type AsyncThunkPendingActionCreator <
350357 ThunkArg ,
351- ThunkApiConfig = { } ,
358+ ThunkApiConfig = AnyNonNullishValue ,
352359> = ActionCreatorWithPreparedPayload <
353360 [ string , ThunkArg , GetPendingMeta < ThunkApiConfig > ?] ,
354361 undefined ,
@@ -363,7 +370,7 @@ export type AsyncThunkPendingActionCreator<
363370
364371export type AsyncThunkRejectedActionCreator <
365372 ThunkArg ,
366- ThunkApiConfig = { } ,
373+ ThunkApiConfig = AnyNonNullishValue ,
367374> = ActionCreatorWithPreparedPayload <
368375 [
369376 Error | null ,
@@ -392,7 +399,7 @@ export type AsyncThunkRejectedActionCreator<
392399export type AsyncThunkFulfilledActionCreator <
393400 Returned ,
394401 ThunkArg ,
395- ThunkApiConfig = { } ,
402+ ThunkApiConfig = AnyNonNullishValue ,
396403> = ActionCreatorWithPreparedPayload <
397404 [ Returned , string , ThunkArg , GetFulfilledMeta < ThunkApiConfig > ?] ,
398405 Returned ,
0 commit comments