Skip to content

Commit 13b7fe1

Browse files
authored
types: make it easier to wrap createAsyncThunk
Not exporting `GetThunkAPI` requires code dup when wrapping `createAsyncThunk` (in order to get top level access to the `ThunkAPI`'s type). There also was a minor typo making the default value of the `RejectedValue` type parameter `undefined` instead of `unknown`.
1 parent d3bb412 commit 13b7fe1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/toolkit/src/createAsyncThunk.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export type BaseThunkAPI<
1515
S,
1616
E,
1717
D extends Dispatch = Dispatch,
18-
RejectedValue = undefined,
18+
RejectedValue = unknown,
1919
RejectedMeta = unknown,
2020
FulfilledMeta = unknown
2121
> = {
@@ -137,7 +137,7 @@ type GetDispatch<ThunkApiConfig> = ThunkApiConfig extends {
137137
>
138138
: ThunkDispatch<GetState<ThunkApiConfig>, GetExtra<ThunkApiConfig>, AnyAction>
139139

140-
type GetThunkAPI<ThunkApiConfig> = BaseThunkAPI<
140+
export type GetThunkAPI<ThunkApiConfig> = BaseThunkAPI<
141141
GetState<ThunkApiConfig>,
142142
GetExtra<ThunkApiConfig>,
143143
GetDispatch<ThunkApiConfig>,

0 commit comments

Comments
 (0)