Skip to content

Commit 73cd603

Browse files
committed
revert changes, just change return type of single-argument fulfillWithValue signature
1 parent 8909f10 commit 73cd603

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

packages/toolkit/src/createAsyncThunk.ts

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ export type BaseThunkAPI<
3535
>
3636
fulfillWithValue: IsUnknown<
3737
FulfilledMeta,
38-
<FulfilledValue>(
39-
value: FulfilledValue
40-
) => FulfillWithMeta<FulfilledValue, FulfilledMeta>,
38+
<FulfilledValue>(value: FulfilledValue) => FulfilledValue,
4139
<FulfilledValue>(
4240
value: FulfilledValue,
4341
meta: FulfilledMeta
@@ -405,18 +403,16 @@ export type AsyncThunk<
405403
Returned,
406404
ThunkArg,
407405
ThunkApiConfig extends AsyncThunkConfig
408-
> = [Returned] extends [FulfillWithMeta<infer P, infer M>]
409-
? AsyncThunk<P, ThunkArg, ThunkApiConfig & { fulfilledMeta: M }>
410-
: AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
411-
pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig>
412-
rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
413-
fulfilled: AsyncThunkFulfilledActionCreator<
414-
Returned,
415-
ThunkArg,
416-
ThunkApiConfig
417-
>
418-
typePrefix: string
419-
}
406+
> = AsyncThunkActionCreator<Returned, ThunkArg, ThunkApiConfig> & {
407+
pending: AsyncThunkPendingActionCreator<ThunkArg, ThunkApiConfig>
408+
rejected: AsyncThunkRejectedActionCreator<ThunkArg, ThunkApiConfig>
409+
fulfilled: AsyncThunkFulfilledActionCreator<
410+
Returned,
411+
ThunkArg,
412+
ThunkApiConfig
413+
>
414+
typePrefix: string
415+
}
420416

421417
type OverrideThunkApiConfigs<OldConfig, NewConfig> = Id<
422418
NewConfig & Omit<OldConfig, keyof NewConfig>
@@ -696,12 +692,19 @@ If you want to use the AbortController to react to \`abort\` events, please cons
696692
}
697693
}
698694

699-
return Object.assign(actionCreator as any, {
700-
pending,
701-
rejected,
702-
fulfilled,
703-
typePrefix,
704-
})
695+
return Object.assign(
696+
actionCreator as AsyncThunkActionCreator<
697+
Returned,
698+
ThunkArg,
699+
ThunkApiConfig
700+
>,
701+
{
702+
pending,
703+
rejected,
704+
fulfilled,
705+
typePrefix,
706+
}
707+
)
705708
}
706709
createAsyncThunk.withTypes = () => createAsyncThunk
707710

0 commit comments

Comments
 (0)