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 > ,
@@ -309,7 +316,7 @@ type AsyncThunkActionCreator<
309316 */
310317export type AsyncThunkOptions <
311318 ThunkArg = void ,
312- ThunkApiConfig extends AsyncThunkConfig = { } ,
319+ ThunkApiConfig extends AsyncThunkConfig = AnyNonNullishValue ,
313320> = {
314321 /**
315322 * A method to control whether the asyncThunk should be executed. Has access to the
@@ -371,7 +378,7 @@ export type AsyncThunkOptions<
371378
372379export type AsyncThunkPendingActionCreator <
373380 ThunkArg ,
374- ThunkApiConfig = { } ,
381+ ThunkApiConfig = AnyNonNullishValue ,
375382> = ActionCreatorWithPreparedPayload <
376383 [ string , ThunkArg , GetPendingMeta < ThunkApiConfig > ?] ,
377384 undefined ,
@@ -386,7 +393,7 @@ export type AsyncThunkPendingActionCreator<
386393
387394export type AsyncThunkRejectedActionCreator <
388395 ThunkArg ,
389- ThunkApiConfig = { } ,
396+ ThunkApiConfig = AnyNonNullishValue ,
390397> = ActionCreatorWithPreparedPayload <
391398 [
392399 Error | null ,
@@ -415,7 +422,7 @@ export type AsyncThunkRejectedActionCreator<
415422export type AsyncThunkFulfilledActionCreator <
416423 Returned ,
417424 ThunkArg ,
418- ThunkApiConfig = { } ,
425+ ThunkApiConfig = AnyNonNullishValue ,
419426> = ActionCreatorWithPreparedPayload <
420427 [ Returned , string , ThunkArg , GetFulfilledMeta < ThunkApiConfig > ?] ,
421428 Returned ,
0 commit comments