@@ -103,21 +103,21 @@ export function createAction<P = void, T extends string = string>(type: T): Payl
103
103
export function createAction<PA extends PrepareAction <any >, T extends string = string >(type : T , prepareAction : PA ): PayloadActionCreator <ReturnType <PA >[' payload' ], T , PA >;
104
104
105
105
// @alpha (undocumented)
106
- export function createAsyncThunk<Returned , ThunkArg = void , ThunkApiConfig extends AsyncThunkConfig = {}>(type : string , payloadCreator : (arg : ThunkArg , thunkAPI : GetThunkAPI <ThunkApiConfig >) => Promise <Returned > | Returned ): ((arg : ThunkArg ) => (dispatch : GetDispatch <ThunkApiConfig >, getState : () => GetState <ThunkApiConfig >, extra : GetExtra <ThunkApiConfig >) => Promise <PayloadAction <Returned , string , {
106
+ export function createAsyncThunk<Returned , ThunkArg = void , ThunkApiConfig extends AsyncThunkConfig = {}>(type : string , payloadCreator : (arg : ThunkArg , thunkAPI : GetThunkAPI <ThunkApiConfig >) => Promise <Returned | RejectWithValue < GetRejectValue < ThunkApiConfig >>> | Returned | RejectWithValue < GetRejectValue < ThunkApiConfig >> ): ((arg : ThunkArg ) => (dispatch : GetDispatch <ThunkApiConfig >, getState : () => GetState <ThunkApiConfig >, extra : GetExtra <ThunkApiConfig >) => Promise <PayloadAction <Returned , string , {
107
107
arg: ThunkArg ;
108
108
requestId: string ;
109
- }, never > | PayloadAction <undefined , string , {
109
+ }, never > | PayloadAction <GetRejectValue < ThunkApiConfig > | undefined , string , {
110
110
arg: ThunkArg ;
111
111
requestId: string ;
112
112
aborted: boolean ;
113
- }, any >> & {
113
+ }, SerializedError >> & {
114
114
abort: (reason ? : string | undefined ) => void ;
115
115
}) & {
116
116
pending: ActionCreatorWithPreparedPayload <[string , ThunkArg ], undefined , string , never , {
117
117
arg: ThunkArg ;
118
118
requestId: string ;
119
119
}>;
120
- rejected: ActionCreatorWithPreparedPayload <[Error , string , ThunkArg ], undefined , string , any , {
120
+ rejected: ActionCreatorWithPreparedPayload <[Error | null , string , ThunkArg , ( GetRejectValue < ThunkApiConfig > | undefined ) ? ], GetRejectValue < ThunkApiConfig > | undefined , string , SerializedError , {
121
121
arg: ThunkArg ;
122
122
requestId: string ;
123
123
aborted: boolean ;
@@ -284,11 +284,7 @@ export type SliceCaseReducers<State> = {
284
284
export { ThunkAction }
285
285
286
286
// @alpha (undocumented)
287
- export function unwrapResult<T >(returned : {
288
- error: any ;
289
- } | {
290
- payload: NonNullable <T >;
291
- }): NonNullable <T >;
287
+ export function unwrapResult<R extends ActionTypesWithOptionalErrorAction >(returned : R ): PayloadForActionTypesExcludingErrorActions <R >;
292
288
293
289
// @alpha (undocumented)
294
290
export type Update <T > = {
0 commit comments