diff --git a/packages/toolkit/src/entities/tests/state_selectors.test.ts b/packages/toolkit/src/entities/tests/state_selectors.test.ts index 3afba41ac6..1e013884f3 100644 --- a/packages/toolkit/src/entities/tests/state_selectors.test.ts +++ b/packages/toolkit/src/entities/tests/state_selectors.test.ts @@ -1,12 +1,16 @@ -import { createDraftSafeSelectorCreator } from '../../createDraftSafeSelector' -import type { EntityAdapter, EntityState } from '../index' -import { createEntityAdapter } from '../index' -import type { EntitySelectors } from '../models' +import type { + EntityAdapter, + EntitySelectors, + EntityState, + Selector, +} from '@reduxjs/toolkit' +import { + createDraftSafeSelectorCreator, + createEntityAdapter, + createSelector, +} from '@reduxjs/toolkit' import type { BookModel } from './fixtures/book' import { AClockworkOrange, AnimalFarm, TheGreatGatsby } from './fixtures/book' -import type { Selector } from 'reselect' -import { createSelector, weakMapMemoize } from 'reselect' -import { vi } from 'vitest' describe('Entity State Selectors', () => { describe('Composed Selectors', () => { diff --git a/packages/toolkit/src/immutableStateInvariantMiddleware.ts b/packages/toolkit/src/immutableStateInvariantMiddleware.ts index ddb004fb58..8061dbacb5 100644 --- a/packages/toolkit/src/immutableStateInvariantMiddleware.ts +++ b/packages/toolkit/src/immutableStateInvariantMiddleware.ts @@ -1,6 +1,5 @@ import type { Middleware } from 'redux' import type { IgnorePaths } from './serializableStateInvariantMiddleware' -import type { AnyObject } from './tsHelpers' import { getTimeMeasureUtils } from './utils' type EntryProcessor = (key: string, value: any) => any diff --git a/packages/toolkit/src/listenerMiddleware/tests/fork.test.ts b/packages/toolkit/src/listenerMiddleware/tests/fork.test.ts index f42139c94e..dbeeada581 100644 --- a/packages/toolkit/src/listenerMiddleware/tests/fork.test.ts +++ b/packages/toolkit/src/listenerMiddleware/tests/fork.test.ts @@ -1,19 +1,22 @@ -import type { EnhancedStore } from '@reduxjs/toolkit' -import { configureStore, createAction, createSlice } from '@reduxjs/toolkit' - -import type { PayloadAction } from '@reduxjs/toolkit' import type { - AbortSignalWithReason, ForkedTaskExecutor, + PayloadAction, TaskResult, -} from '../types' -import { TaskAbortError, createListenerMiddleware } from '../index' +} from '@reduxjs/toolkit' +import { + TaskAbortError, + configureStore, + createAction, + createListenerMiddleware, + createSlice, +} from '@reduxjs/toolkit' import { listenerCancelled, listenerCompleted, taskCancelled, taskCompleted, } from '../exceptions' +import type { AbortSignalWithReason } from '../types' function delay(ms: number) { return new Promise((resolve) => setTimeout(resolve, ms)) diff --git a/packages/toolkit/src/listenerMiddleware/tests/useCases.test.ts b/packages/toolkit/src/listenerMiddleware/tests/useCases.test.ts index d7372baabf..06444a40fc 100644 --- a/packages/toolkit/src/listenerMiddleware/tests/useCases.test.ts +++ b/packages/toolkit/src/listenerMiddleware/tests/useCases.test.ts @@ -1,17 +1,12 @@ +import type { PayloadAction } from '@reduxjs/toolkit' import { + TaskAbortError, configureStore, createAction, + createListenerMiddleware, createSlice, - isAnyOf, } from '@reduxjs/toolkit' -import type { PayloadAction } from '@reduxjs/toolkit' - -import { createListenerMiddleware } from '../index' - -import type { TypedAddListener } from '../index' -import { TaskAbortError } from '../exceptions' - interface CounterState { value: number } diff --git a/packages/toolkit/src/query/core/buildMiddleware/invalidationByTags.ts b/packages/toolkit/src/query/core/buildMiddleware/invalidationByTags.ts index 671d39cca9..8b9d3266f3 100644 --- a/packages/toolkit/src/query/core/buildMiddleware/invalidationByTags.ts +++ b/packages/toolkit/src/query/core/buildMiddleware/invalidationByTags.ts @@ -1,25 +1,23 @@ -import { - isAnyOf, - isFulfilled, - isRejected, - isRejectedWithValue, -} from '../rtkImports' - import type { EndpointDefinitions, FullTagDescription, } from '../../endpointDefinitions' import { calculateProvidedBy } from '../../endpointDefinitions' +import { countObjectKeys } from '../../utils/countObjectKeys' import type { CombinedState, QueryCacheKey } from '../apiState' import { QueryStatus } from '../apiState' import { calculateProvidedByThunk } from '../buildThunks' +import { + isAnyOf, + isFulfilled, + isRejected, + isRejectedWithValue, +} from '../rtkImports' import type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, - InternalMiddlewareState, SubMiddlewareApi, } from './types' -import { countObjectKeys } from '../../utils/countObjectKeys' export const buildInvalidationByTagsHandler: InternalHandlerBuilder = ({ reducerPath, diff --git a/packages/toolkit/src/query/core/buildMiddleware/polling.ts b/packages/toolkit/src/query/core/buildMiddleware/polling.ts index f15cea126b..0d4e2493cc 100644 --- a/packages/toolkit/src/query/core/buildMiddleware/polling.ts +++ b/packages/toolkit/src/query/core/buildMiddleware/polling.ts @@ -3,7 +3,6 @@ import { QueryStatus } from '../apiState' import type { ApiMiddlewareInternalHandler, InternalHandlerBuilder, - InternalMiddlewareState, QueryStateMeta, SubMiddlewareApi, TimeoutId, diff --git a/packages/toolkit/src/query/core/setupListeners.ts b/packages/toolkit/src/query/core/setupListeners.ts index 7b3a22cda1..6acfc4e5ce 100644 --- a/packages/toolkit/src/query/core/setupListeners.ts +++ b/packages/toolkit/src/query/core/setupListeners.ts @@ -1,7 +1,4 @@ -import type { - ActionCreatorWithoutPayload, - ThunkDispatch, // Workaround for API-Extractor -} from '@reduxjs/toolkit' +import type { ThunkDispatch } from '@reduxjs/toolkit' import { createAction } from './rtkImports' export const onFocus = /* @__PURE__ */ createAction('__rtkq/focused') diff --git a/packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx b/packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx index 8481231b38..be24ed4d95 100644 --- a/packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx +++ b/packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx @@ -2,7 +2,6 @@ import { createSlice } from '@reduxjs/toolkit' import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query' import { headersToObject } from 'headers-polyfill' import { HttpResponse, delay, http } from 'msw' -// @ts-ignore import nodeFetch from 'node-fetch' import queryString from 'query-string' import { vi } from 'vitest' diff --git a/packages/toolkit/src/tests/autoBatchEnhancer.test.ts b/packages/toolkit/src/tests/autoBatchEnhancer.test.ts index e1b820c908..cc18b047b8 100644 --- a/packages/toolkit/src/tests/autoBatchEnhancer.test.ts +++ b/packages/toolkit/src/tests/autoBatchEnhancer.test.ts @@ -1,9 +1,11 @@ -import { configureStore } from '../configureStore' -import { createSlice } from '../createSlice' -import type { AutoBatchOptions } from '../autoBatchEnhancer' -import { autoBatchEnhancer, prepareAutoBatched } from '../autoBatchEnhancer' -import { delay } from '../utils' +import type { AutoBatchOptions } from '@reduxjs/toolkit' +import { + configureStore, + createSlice, + prepareAutoBatched, +} from '@reduxjs/toolkit' import { debounce } from 'lodash' +import { delay } from '../utils' interface CounterState { value: number diff --git a/packages/toolkit/src/tests/utils/CustomMatchers.d.ts b/packages/toolkit/src/tests/utils/CustomMatchers.d.ts index 92c98bd562..2c887b0286 100644 --- a/packages/toolkit/src/tests/utils/CustomMatchers.d.ts +++ b/packages/toolkit/src/tests/utils/CustomMatchers.d.ts @@ -1,4 +1,4 @@ -import type { Assertion, AsymmetricMatchersContaining } from 'vitest' +import 'vitest' interface CustomMatchers { toMatchSequence(...matchers: ((arg: any) => boolean)[]): R