Skip to content

Commit

Permalink
Fix remaining TS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Sep 29, 2024
1 parent bfd8de6 commit ebff888
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
4 changes: 1 addition & 3 deletions packages/toolkit/src/query/core/buildInitiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ export type BuildInitiateApiEndpointQuery<
initiate: StartQueryActionCreator<Definition>
}

export type BuildApiEndpointInfiniteQuery<
export type BuildInitiateApiEndpointInfiniteQuery<
Definition extends InfiniteQueryDefinition<any, any, any, any, any>,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Definitions extends EndpointDefinitions,
> = {
initiate: StartInfiniteQueryActionCreator<Definition>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/toolkit/src/query/core/buildSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export type BuildSelectorsApiEndpointQuery<
>
}

export type ApiEndpointInfiniteQuery<
export type BuildSelectorsApiEndpointInfiniteQuery<
Definition extends InfiniteQueryDefinition<any, any, any, any, any>,
Definitions extends EndpointDefinitions,
> = {
Expand Down
6 changes: 2 additions & 4 deletions packages/toolkit/src/query/core/buildThunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ export type BuildThunksApiEndpointQuery<
Definition extends QueryDefinition<any, any, any, any, any>,
> = Matchers<QueryThunk, Definition>

export type ApiEndpointInfiniteQuery<
export type BuildThunksApiEndpointInfiniteQuery<
Definition extends InfiniteQueryDefinition<any, any, any, any, any>,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Definitions extends EndpointDefinitions,
> = Matchers<QueryThunk, Definition>

export type BuildThunksApiEndpointMutation<
Expand Down Expand Up @@ -486,7 +484,7 @@ export function buildThunks<
for (let i = 1; i < remainingPages; i++) {
// @ts-ignore
const param = getNextPageParam(
arg.infiniteQueryOptions,
endpointDefinition.infiniteQueryOptions,
result.data as InfiniteData<unknown>,
)
result = await fetchPage(
Expand Down
7 changes: 6 additions & 1 deletion packages/toolkit/src/query/core/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import type {
MutationActionCreatorResult,
QueryActionCreatorResult,
InfiniteQueryActionCreatorResult,
BuildInitiateApiEndpointInfiniteQuery,
} from './buildInitiate'
import { buildInitiate } from './buildInitiate'
import type {
Expand All @@ -49,13 +50,15 @@ import type {
} from './buildMiddleware'
import { buildMiddleware } from './buildMiddleware'
import type {
BuildSelectorsApiEndpointInfiniteQuery,
BuildSelectorsApiEndpointMutation,
BuildSelectorsApiEndpointQuery,
} from './buildSelectors'
import { buildSelectors } from './buildSelectors'
import type { SliceActions } from './buildSlice'
import { buildSlice } from './buildSlice'
import type {
BuildThunksApiEndpointInfiniteQuery,
BuildThunksApiEndpointMutation,
BuildThunksApiEndpointQuery,
PatchQueryDataThunk,
Expand Down Expand Up @@ -433,7 +436,9 @@ export interface ApiEndpointInfiniteQuery<
Definition extends InfiniteQueryDefinition<any, any, any, any, any>,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Definitions extends EndpointDefinitions,
> {
> extends BuildThunksApiEndpointInfiniteQuery<Definition>,
BuildInitiateApiEndpointInfiniteQuery<Definition>,
BuildSelectorsApiEndpointInfiniteQuery<Definition, Definitions> {
name: string
/**
* All of these are `undefined` at runtime, purely to be used in TypeScript declarations!
Expand Down
16 changes: 7 additions & 9 deletions packages/toolkit/src/query/endpointDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,13 @@ type QueryTypes<
* const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...
* ```
*/
QueryDefinition:
| QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>
| InfiniteQueryDefinition<
QueryArg,
BaseQuery,
TagTypes,
ResultType,
ReducerPath
>
QueryDefinition: QueryDefinition<
QueryArg,
BaseQuery,
TagTypes,
ResultType,
ReducerPath
>
TagTypes: TagTypes
ReducerPath: ReducerPath
}
Expand Down
1 change: 1 addition & 0 deletions packages/toolkit/src/query/react/buildHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import type {
InfiniteData,
InfiniteQueryConfigOptions,
} from '@internal/query/core/apiState'
import type { InfiniteQueryResultSelectorResult } from '../core/buildSelectors'

// Copy-pasted from React-Redux
const canUseDOM = () =>
Expand Down

0 comments on commit ebff888

Please sign in to comment.