Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/publish-ci/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
"@types/node": "^17.0.45",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^3.0.0",
"@vitejs/plugin-react": "^5",
"playwright": "^1.31.1",
"prettier": "^3.2.5",
"serve": "^14.2.0",
"typescript": "^5.8.2",
"vite": "^4.2.1"
"vite": "^7"
},
"msw": {
"workerDirectory": "public"
Expand Down
6 changes: 3 additions & 3 deletions examples/query/react/infinite-queries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react-native-web": "^0.19",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react": "^5",
"jsdom": "^23.2.0",
"msw": "^2.6.6",
"prettier": "^3.2.1",
"typescript": "^5.8.2",
"vite": "^5.0.0",
"vitest": "^1.2.0"
"vite": "^7",
"vitest": "^4"
},
"resolutions": {
"@types/react": "18.3.12",
Expand Down
105 changes: 0 additions & 105 deletions examples/query/react/infinite-queries/src/App.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/rtk-codemods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"vitest": "^1.6.0"
"vitest": "^4"
},
"engines": {
"node": ">= 16"
Expand Down
2 changes: 1 addition & 1 deletion packages/rtk-query-codegen-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"ts-node": "^10.9.2",
"tsup": "^8.4.0",
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^2.0.5",
"vitest": "^4",
"yalc": "^1.0.0-pre.47"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/rtk-query-codegen-openapi/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"sourceMap": true,
"strict": true,
"target": "ESNext",
"types": ["vitest/globals", "vitest/importMeta"]
"types": ["vitest/globals", "vitest/importMeta", "node"]
}
}
2 changes: 1 addition & 1 deletion packages/rtk-query-graphql-request-base-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"microbundle": "^0.13.3",
"rimraf": "^3.0.2",
"typescript": "^5.8.2",
"vitest": "^1.6.0"
"vitest": "^4"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"types": ["vitest/globals"]
"types": ["vitest/globals", "vitest/importMeta", "node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
"typescript": "^5.8.2",
"valibot": "^1.0.0",
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.6.0",
"vitest": "^4",
"yargs": "^15.3.1"
},
"scripts": {
Expand Down
6 changes: 1 addition & 5 deletions packages/toolkit/src/entities/state_selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import type { CreateSelectorFunction, Selector } from 'reselect'
import { createDraftSafeSelector } from '../createDraftSafeSelector'
import type { EntityId, EntitySelectors, EntityState } from './models'

type AnyFunction = (...args: any) => any
type AnyCreateSelectorFunction = CreateSelectorFunction<
<F extends AnyFunction>(f: F) => F,
<F extends AnyFunction>(f: F) => F
>
type AnyCreateSelectorFunction = CreateSelectorFunction<any, any, any>

export type GetSelectorsOptions = {
createSelector?: AnyCreateSelectorFunction
Expand Down
3 changes: 2 additions & 1 deletion packages/toolkit/src/query/core/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import { createSelector as _createSelector } from './rtkImports'
import { onFocus, onFocusLost, onOffline, onOnline } from './setupListeners'
import type { InternalMiddlewareState } from './buildMiddleware/types'
import { getOrInsertComputed } from '../utils'
import type { CreateSelectorFunction } from 'reselect'

/**
* `ifOlderThan` - (default: `false` | `number`) - _number is value in seconds_
Expand Down Expand Up @@ -492,7 +493,7 @@ export interface CoreModuleOptions {
/**
* A selector creator (usually from `reselect`, or matching the same signature)
*/
createSelector?: typeof _createSelector
createSelector?: CreateSelectorFunction<any, any, any>
}

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/toolkit/src/query/react/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useSelector as rrUseSelector,
useStore as rrUseStore,
} from 'react-redux'
import type { CreateSelectorFunction } from 'reselect'
import { createSelector as _createSelector } from 'reselect'
import {
isInfiniteQueryDefinition,
Expand Down Expand Up @@ -130,7 +131,7 @@ export interface ReactHooksModuleOptions {
/**
* A selector creator (usually from `reselect`, or matching the same signature)
*/
createSelector?: typeof _createSelector
createSelector?: CreateSelectorFunction<any, any, any>
}

/**
Expand Down
31 changes: 0 additions & 31 deletions packages/toolkit/src/query/tests/buildHooks.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,37 +322,6 @@ describe('type tests', () => {
SelectedResult
> = (state) => ({ posts: state.data?.posts ?? EMPTY_ARRAY })

expectTypeOf<
TypedQueryStateSelector<
PostsApiResponse,
QueryArgument,
BaseQueryFunction,
SelectedResult
>
>().toEqualTypeOf<
QueryStateSelector<
SelectedResult,
QueryDefinition<
QueryArgument,
BaseQueryFunction,
string,
PostsApiResponse
>
>
>()

expectTypeOf(typedSelectFromResult).toEqualTypeOf<
QueryStateSelector<
SelectedResult,
QueryDefinition<
QueryArgument,
BaseQueryFunction,
string,
PostsApiResponse
>
>
>()

function PostsList() {
const { posts } = useGetPostsQuery(undefined, {
selectFromResult: typedSelectFromResult,
Expand Down
4 changes: 2 additions & 2 deletions packages/toolkit/src/query/tests/createApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,8 @@ describe('endpoint schemas', () => {
stack: expect.any(String),
} satisfies SerializedError

const onSchemaFailureGlobal = vi.fn<Parameters<SchemaFailureHandler>>()
const onSchemaFailureEndpoint = vi.fn<Parameters<SchemaFailureHandler>>()
const onSchemaFailureGlobal = vi.fn<SchemaFailureHandler>()
const onSchemaFailureEndpoint = vi.fn<SchemaFailureHandler>()
afterEach(() => {
onSchemaFailureGlobal.mockClear()
onSchemaFailureEndpoint.mockClear()
Expand Down
3 changes: 1 addition & 2 deletions packages/toolkit/src/query/tests/fetchBaseQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ const defaultHeaders: Record<string, string> = {

const baseUrl = 'https://example.com'

// @ts-ignore
const fetchFn = vi.fn<Promise<any>, any[]>(nodeFetch)
const fetchFn = vi.fn(nodeFetch)

const baseQuery = fetchBaseQuery({
baseUrl,
Expand Down
14 changes: 8 additions & 6 deletions packages/toolkit/src/query/tests/infiniteQueries.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ describe('Infinite queries', () => {

expectTypeOf(pokemonApi.useGetInfinitePokemonInfiniteQuery).toBeFunction()

expectTypeOf(pokemonApi.endpoints.getInfinitePokemon.useInfiniteQuery)
.parameter(0)
.toEqualTypeOf<string | typeof skipToken>()
expectTypeOf<
Parameters<
typeof pokemonApi.endpoints.getInfinitePokemon.useInfiniteQuery
>[0]
>().toEqualTypeOf<string | typeof skipToken>()

expectTypeOf(pokemonApi.endpoints.getInfinitePokemon.useInfiniteQueryState)
.parameter(0)
Expand Down Expand Up @@ -128,9 +130,9 @@ describe('Infinite queries', () => {
const useGetInfinitePokemonQuery =
pokemonApi.endpoints.getInfinitePokemon.useInfiniteQuery

expectTypeOf(useGetInfinitePokemonQuery)
.parameter(0)
.toEqualTypeOf<string | typeof skipToken>()
expectTypeOf<
Parameters<typeof useGetInfinitePokemonQuery>[0]
>().toEqualTypeOf<string | typeof skipToken>()

function PokemonList() {
const {
Expand Down
Loading
Loading