From 13b7fe1105d7d5606dc1ac4758d17ec7cbfa7636 Mon Sep 17 00:00:00 2001 From: "garo (they/them)" <3411715+shrouxm@users.noreply.github.com> Date: Thu, 20 Apr 2023 16:07:55 -0700 Subject: [PATCH] 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`. --- packages/toolkit/src/createAsyncThunk.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/toolkit/src/createAsyncThunk.ts b/packages/toolkit/src/createAsyncThunk.ts index 5a805ebc3a..80ca05ffa6 100644 --- a/packages/toolkit/src/createAsyncThunk.ts +++ b/packages/toolkit/src/createAsyncThunk.ts @@ -15,7 +15,7 @@ export type BaseThunkAPI< S, E, D extends Dispatch = Dispatch, - RejectedValue = undefined, + RejectedValue = unknown, RejectedMeta = unknown, FulfilledMeta = unknown > = { @@ -137,7 +137,7 @@ type GetDispatch = ThunkApiConfig extends { > : ThunkDispatch, GetExtra, AnyAction> -type GetThunkAPI = BaseThunkAPI< +export type GetThunkAPI = BaseThunkAPI< GetState, GetExtra, GetDispatch,