Skip to content

Commit

Permalink
types: make it easier to wrap createAsyncThunk
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
shrouxm authored Apr 20, 2023
1 parent d3bb412 commit 13b7fe1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/toolkit/src/createAsyncThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type BaseThunkAPI<
S,
E,
D extends Dispatch = Dispatch,
RejectedValue = undefined,
RejectedValue = unknown,
RejectedMeta = unknown,
FulfilledMeta = unknown
> = {
Expand Down Expand Up @@ -137,7 +137,7 @@ type GetDispatch<ThunkApiConfig> = ThunkApiConfig extends {
>
: ThunkDispatch<GetState<ThunkApiConfig>, GetExtra<ThunkApiConfig>, AnyAction>

type GetThunkAPI<ThunkApiConfig> = BaseThunkAPI<
export type GetThunkAPI<ThunkApiConfig> = BaseThunkAPI<
GetState<ThunkApiConfig>,
GetExtra<ThunkApiConfig>,
GetDispatch<ThunkApiConfig>,
Expand Down

0 comments on commit 13b7fe1

Please sign in to comment.