diff --git a/app/core/Engine/Engine.test.ts b/app/core/Engine/Engine.test.ts index ef191cce1f32..59661ad2e920 100644 --- a/app/core/Engine/Engine.test.ts +++ b/app/core/Engine/Engine.test.ts @@ -5,13 +5,12 @@ import { zeroAddress } from 'ethereumjs-util'; import { createMockAccountsControllerState } from '../../util/test/accountsControllerTestUtils'; import { mockNetworkState } from '../../util/test/network'; import MetaMetrics from '../Analytics/MetaMetrics'; -import { store } from '../../store'; +import { ReduxState, store } from '../../store'; import { MetaMetricsEvents } from '../Analytics'; import { NetworkState } from '@metamask/network-controller'; import { Hex } from '@metamask/utils'; import { MarketDataDetails } from '../../components/UI/Tokens'; import { TransactionMeta } from '@metamask/transaction-controller'; -import { RootState } from '../../reducers'; import { MetricsEventBuilder } from '../Analytics/MetricsEventBuilder'; jest.unmock('./Engine'); @@ -369,7 +368,7 @@ describe('Transaction event handlers', () => { beforeEach(() => { engine = Engine.init({}); jest.spyOn(MetaMetrics.getInstance(), 'trackEvent').mockImplementation(); - jest.spyOn(store, 'getState').mockReturnValue({} as RootState); + jest.spyOn(store, 'getState').mockReturnValue({} as ReduxState); }); afterEach(() => { diff --git a/app/store/index.ts b/app/store/index.ts index 1ca7faeac618..5fefca2654c2 100644 --- a/app/store/index.ts +++ b/app/store/index.ts @@ -19,7 +19,10 @@ import getUIStartupSpan from '../core/Performance/UIStartup'; import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore'; // TODO: Improve type safety by using real Action types instead of `any` -const pReducer = persistReducer(persistConfig, rootReducer); +const pReducer = persistReducer( + persistConfig, + rootReducer, +); // TODO: Fix the Action type. It's set to `any` now because some of the // TypeScript reducers have invalid actions @@ -103,8 +106,10 @@ const createStoreAndPersistor = async () => { export { store, persistor }; +export type ReduxState = ReturnType; + export type ReduxStore = ToolkitStore< - ReturnType, + ReduxState, AnyAction, [ReturnType>, typeof thunk] >;