From 92dbfdd0f5ecb1d1817f88eed742d19923f56179 Mon Sep 17 00:00:00 2001 From: Arya Emami Date: Fri, 7 Jun 2024 19:54:14 -0500 Subject: [PATCH] Export problematic types that were causing type portability issues - This should serve as a partial fix for #3962, #4448, #3983, #4066, #4108, #4401 - Here is the list of the problematic (now exported) types: From `@reduxjs/toolkit`: - `CombinedSliceReducer` - `CaseReducerDefinition` - `Id` renamed to `TSHelpersId` - `UncheckedIndexedAccess` - `ReducerWithInitialState` - `CaseReducerDefinition` - `Id` renamed to `TSHelpersId` - `UncheckedIndexedAccess` - `ReducerWithInitialState` From `@reduxjs/toolkit/query/react`: - `UseLazyQuery` - `UseQuery` - `QueryHooks` --- packages/toolkit/src/index.ts | 7 ++++++- packages/toolkit/src/query/react/index.ts | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/toolkit/src/index.ts b/packages/toolkit/src/index.ts index 61893b8349..07b1efa59e 100644 --- a/packages/toolkit/src/index.ts +++ b/packages/toolkit/src/index.ts @@ -60,6 +60,7 @@ export type { Actions, CaseReducer, CaseReducers, + ReducerWithInitialState, } from './createReducer' export { // js @@ -79,6 +80,7 @@ export type { CaseReducerWithPrepare, ReducerCreators, SliceSelectors, + CaseReducerDefinition, } from './createSlice' export type { ActionCreatorInvariantMiddlewareOptions } from './actionCreatorInvariantMiddleware' export { createActionCreatorInvariantMiddleware } from './actionCreatorInvariantMiddleware' @@ -202,11 +204,14 @@ export type { AutoBatchOptions } from './autoBatchEnhancer' export { combineSlices } from './combineSlices' -export type { WithSlice } from './combineSlices' +export type { CombinedSliceReducer, WithSlice } from './combineSlices' export type { ExtractDispatchExtensions as TSHelpersExtractDispatchExtensions, + Id as TSHelpersId, SafePromise, } from './tsHelpers' export { formatProdErrorMessage } from './formatProdErrorMessage' + +export type { UncheckedIndexedAccess } from './uncheckedindexed' diff --git a/packages/toolkit/src/query/react/index.ts b/packages/toolkit/src/query/react/index.ts index c979fbe0f2..1247d84157 100644 --- a/packages/toolkit/src/query/react/index.ts +++ b/packages/toolkit/src/query/react/index.ts @@ -14,6 +14,7 @@ const createApi = /* @__PURE__ */ buildCreateApi( ) export type { + QueryHooks, TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, @@ -26,5 +27,7 @@ export type { TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, + UseLazyQuery, + UseQuery, } from './buildHooks' export { createApi, reactHooksModule, reactHooksModuleName }