UNPKG

@reduxjs/toolkit

Version:

The official, opinionated, batteries-included toolset for efficient Redux development

1 lines 146 kB
{"version":3,"sources":["../../../src/query/react/index.ts","../../../src/query/react/module.ts","../../../src/query/utils/capitalize.ts","../../../src/query/endpointDefinitions.ts","../../../src/query/tsHelpers.ts","../../../src/query/react/buildHooks.ts","../../../src/query/react/constants.ts","../../../src/query/react/useSerializedStableValue.ts","../../../src/query/react/useShallowStableValue.ts","../../../src/query/react/ApiProvider.tsx"],"sourcesContent":["// This must remain here so that the `mangleErrors.cjs` build script\n// does not have to import this into each source file it rewrites.\nimport { formatProdErrorMessage } from '@reduxjs/toolkit';\nimport { buildCreateApi, coreModule } from '@reduxjs/toolkit/query';\nimport { reactHooksModule, reactHooksModuleName } from './module';\nexport * from '@reduxjs/toolkit/query';\nexport { ApiProvider } from './ApiProvider';\nconst createApi = /* @__PURE__ */buildCreateApi(coreModule(), reactHooksModule());\nexport type { TypedUseMutationResult, TypedUseQueryHookResult, TypedUseQueryStateResult, TypedUseQuerySubscriptionResult, TypedLazyQueryTrigger, TypedUseLazyQuery, TypedUseMutation, TypedMutationTrigger, TypedQueryStateSelector, TypedUseQueryState, TypedUseQuery, TypedUseQuerySubscription, TypedUseLazyQuerySubscription, TypedUseQueryStateOptions, TypedUseLazyQueryStateResult, TypedUseInfiniteQuery, TypedUseInfiniteQueryHookResult, TypedUseInfiniteQueryStateResult, TypedUseInfiniteQuerySubscriptionResult, TypedUseInfiniteQueryStateOptions, TypedInfiniteQueryStateSelector, TypedUseInfiniteQuerySubscription, TypedUseInfiniteQueryState, TypedLazyInfiniteQueryTrigger } from './buildHooks';\nexport { UNINITIALIZED_VALUE } from './constants';\nexport { createApi, reactHooksModule, reactHooksModuleName };","import { formatProdErrorMessage as _formatProdErrorMessage } from \"@reduxjs/toolkit\";\nimport type { Api, BaseQueryFn, EndpointDefinitions, InfiniteQueryDefinition, Module, MutationDefinition, PrefetchOptions, QueryArgFrom, QueryDefinition, QueryKeys } from '@reduxjs/toolkit/query';\nimport { batch as rrBatch, useDispatch as rrUseDispatch, useSelector as rrUseSelector, useStore as rrUseStore } from 'react-redux';\nimport { createSelector as _createSelector } from 'reselect';\nimport { isInfiniteQueryDefinition, isMutationDefinition, isQueryDefinition } from '../endpointDefinitions';\nimport { safeAssign } from '../tsHelpers';\nimport { capitalize, countObjectKeys } from '../utils';\nimport type { InfiniteQueryHooks, MutationHooks, QueryHooks } from './buildHooks';\nimport { buildHooks } from './buildHooks';\nimport type { HooksWithUniqueNames } from './namedHooks';\nexport const reactHooksModuleName = /* @__PURE__ */Symbol();\nexport type ReactHooksModule = typeof reactHooksModuleName;\ndeclare module '@reduxjs/toolkit/query' {\n export interface ApiModules<\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n BaseQuery extends BaseQueryFn, Definitions extends EndpointDefinitions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ReducerPath extends string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TagTypes extends string> {\n [reactHooksModuleName]: {\n /**\n * Endpoints based on the input endpoints provided to `createApi`, containing `select`, `hooks` and `action matchers`.\n */\n endpoints: { [K in keyof Definitions]: Definitions[K] extends QueryDefinition<any, any, any, any, any> ? QueryHooks<Definitions[K]> : Definitions[K] extends MutationDefinition<any, any, any, any, any> ? MutationHooks<Definitions[K]> : Definitions[K] extends InfiniteQueryDefinition<any, any, any, any, any> ? InfiniteQueryHooks<Definitions[K]> : never };\n /**\n * A hook that accepts a string endpoint name, and provides a callback that when called, pre-fetches the data for that endpoint.\n */\n usePrefetch<EndpointName extends QueryKeys<Definitions>>(endpointName: EndpointName, options?: PrefetchOptions): (arg: QueryArgFrom<Definitions[EndpointName]>, options?: PrefetchOptions) => void;\n } & HooksWithUniqueNames<Definitions>;\n }\n}\ntype RR = typeof import('react-redux');\nexport interface ReactHooksModuleOptions {\n /**\n * The hooks from React Redux to be used\n */\n hooks?: {\n /**\n * The version of the `useDispatch` hook to be used\n */\n useDispatch: RR['useDispatch'];\n /**\n * The version of the `useSelector` hook to be used\n */\n useSelector: RR['useSelector'];\n /**\n * The version of the `useStore` hook to be used\n */\n useStore: RR['useStore'];\n };\n /**\n * The version of the `batchedUpdates` function to be used\n */\n batch?: RR['batch'];\n /**\n * Enables performing asynchronous tasks immediately within a render.\n *\n * @example\n *\n * ```ts\n * import {\n * buildCreateApi,\n * coreModule,\n * reactHooksModule\n * } from '@reduxjs/toolkit/query/react'\n *\n * const createApi = buildCreateApi(\n * coreModule(),\n * reactHooksModule({ unstable__sideEffectsInRender: true })\n * )\n * ```\n */\n unstable__sideEffectsInRender?: boolean;\n /**\n * A selector creator (usually from `reselect`, or matching the same signature)\n */\n createSelector?: typeof _createSelector;\n}\n\n/**\n * Creates a module that generates react hooks from endpoints, for use with `buildCreateApi`.\n *\n * @example\n * ```ts\n * const MyContext = React.createContext<ReactReduxContextValue | null>(null);\n * const customCreateApi = buildCreateApi(\n * coreModule(),\n * reactHooksModule({\n * hooks: {\n * useDispatch: createDispatchHook(MyContext),\n * useSelector: createSelectorHook(MyContext),\n * useStore: createStoreHook(MyContext)\n * }\n * })\n * );\n * ```\n *\n * @returns A module for use with `buildCreateApi`\n */\nexport const reactHooksModule = ({\n batch = rrBatch,\n hooks = {\n useDispatch: rrUseDispatch,\n useSelector: rrUseSelector,\n useStore: rrUseStore\n },\n createSelector = _createSelector,\n unstable__sideEffectsInRender = false,\n ...rest\n}: ReactHooksModuleOptions = {}): Module<ReactHooksModule> => {\n if (process.env.NODE_ENV !== 'production') {\n const hookNames = ['useDispatch', 'useSelector', 'useStore'] as const;\n let warned = false;\n for (const hookName of hookNames) {\n // warn for old hook options\n if (countObjectKeys(rest) > 0) {\n if ((rest as Partial<typeof hooks>)[hookName]) {\n if (!warned) {\n console.warn('As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:' + '\\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`');\n warned = true;\n }\n }\n // migrate\n // @ts-ignore\n hooks[hookName] = rest[hookName];\n }\n // then make sure we have them all\n if (typeof hooks[hookName] !== 'function') {\n throw new Error(process.env.NODE_ENV === \"production\" ? _formatProdErrorMessage(36) : `When using custom hooks for context, all ${hookNames.length} hooks need to be provided: ${hookNames.join(', ')}.\\nHook ${hookName} was either not provided or not a function.`);\n }\n }\n }\n return {\n name: reactHooksModuleName,\n init(api, {\n serializeQueryArgs\n }, context) {\n const anyApi = api as any as Api<any, Record<string, any>, any, any, ReactHooksModule>;\n const {\n buildQueryHooks,\n buildInfiniteQueryHooks,\n buildMutationHook,\n usePrefetch\n } = buildHooks({\n api,\n moduleOptions: {\n batch,\n hooks,\n unstable__sideEffectsInRender,\n createSelector\n },\n serializeQueryArgs,\n context\n });\n safeAssign(anyApi, {\n usePrefetch\n });\n safeAssign(context, {\n batch\n });\n return {\n injectEndpoint(endpointName, definition) {\n if (isQueryDefinition(definition)) {\n const {\n useQuery,\n useLazyQuery,\n useLazyQuerySubscription,\n useQueryState,\n useQuerySubscription\n } = buildQueryHooks(endpointName);\n safeAssign(anyApi.endpoints[endpointName], {\n useQuery,\n useLazyQuery,\n useLazyQuerySubscription,\n useQueryState,\n useQuerySubscription\n });\n (api as any)[`use${capitalize(endpointName)}Query`] = useQuery;\n (api as any)[`useLazy${capitalize(endpointName)}Query`] = useLazyQuery;\n }\n if (isMutationDefinition(definition)) {\n const useMutation = buildMutationHook(endpointName);\n safeAssign(anyApi.endpoints[endpointName], {\n useMutation\n });\n (api as any)[`use${capitalize(endpointName)}Mutation`] = useMutation;\n } else if (isInfiniteQueryDefinition(definition)) {\n const {\n useInfiniteQuery,\n useInfiniteQuerySubscription,\n useInfiniteQueryState\n } = buildInfiniteQueryHooks(endpointName);\n safeAssign(anyApi.endpoints[endpointName], {\n useInfiniteQuery,\n useInfiniteQuerySubscription,\n useInfiniteQueryState\n });\n (api as any)[`use${capitalize(endpointName)}InfiniteQuery`] = useInfiniteQuery;\n }\n }\n };\n }\n };\n};","export function capitalize(str: string) {\n return str.replace(str[0], str[0].toUpperCase());\n}","import type { Api } from '@reduxjs/toolkit/query';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { BaseQueryApi, BaseQueryArg, BaseQueryError, BaseQueryExtraOptions, BaseQueryFn, BaseQueryMeta, BaseQueryResult, QueryReturnValue } from './baseQueryTypes';\nimport type { CacheCollectionQueryExtraOptions } from './core/buildMiddleware/cacheCollection';\nimport type { CacheLifecycleInfiniteQueryExtraOptions, CacheLifecycleMutationExtraOptions, CacheLifecycleQueryExtraOptions } from './core/buildMiddleware/cacheLifecycle';\nimport type { QueryLifecycleInfiniteQueryExtraOptions, QueryLifecycleMutationExtraOptions, QueryLifecycleQueryExtraOptions } from './core/buildMiddleware/queryLifecycle';\nimport type { InfiniteData, InfiniteQueryConfigOptions, QuerySubState, RootState } from './core/index';\nimport type { SerializeQueryArgs } from './defaultSerializeQueryArgs';\nimport type { NEVER } from './fakeBaseQuery';\nimport type { CastAny, HasRequiredProps, MaybePromise, NonUndefined, OmitFromUnion, UnwrapPromise } from './tsHelpers';\nimport { isNotNullish } from './utils';\nimport type { NamedSchemaError } from './standardSchema';\nconst rawResultType = /* @__PURE__ */Symbol();\nconst resultType = /* @__PURE__ */Symbol();\nconst baseQuery = /* @__PURE__ */Symbol();\nexport interface SchemaFailureInfo {\n endpoint: string;\n arg: any;\n type: 'query' | 'mutation';\n queryCacheKey?: string;\n}\nexport type SchemaFailureHandler = (error: NamedSchemaError, info: SchemaFailureInfo) => void;\nexport type SchemaFailureConverter<BaseQuery extends BaseQueryFn> = (error: NamedSchemaError, info: SchemaFailureInfo) => BaseQueryError<BaseQuery>;\nexport type EndpointDefinitionWithQuery<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery>> = {\n /**\n * `query` can be a function that returns either a `string` or an `object` which is passed to your `baseQuery`. If you are using [fetchBaseQuery](./fetchBaseQuery), this can return either a `string` or an `object` of properties in `FetchArgs`. If you use your own custom [`baseQuery`](../../rtk-query/usage/customizing-queries), you can customize this behavior to your liking.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"query example\"\n *\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * tagTypes: ['Post'],\n * endpoints: (build) => ({\n * getPosts: build.query<PostsResponse, void>({\n * // highlight-start\n * query: () => 'posts',\n * // highlight-end\n * }),\n * addPost: build.mutation<Post, Partial<Post>>({\n * // highlight-start\n * query: (body) => ({\n * url: `posts`,\n * method: 'POST',\n * body,\n * }),\n * // highlight-end\n * invalidatesTags: [{ type: 'Post', id: 'LIST' }],\n * }),\n * })\n * })\n * ```\n */\n query(arg: QueryArg): BaseQueryArg<BaseQuery>;\n queryFn?: never;\n /**\n * A function to manipulate the data returned by a query or mutation.\n */\n transformResponse?(baseQueryReturnValue: RawResultType, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): ResultType | Promise<ResultType>;\n /**\n * A function to manipulate the data returned by a failed query or mutation.\n */\n transformErrorResponse?(baseQueryReturnValue: BaseQueryError<BaseQuery>, meta: BaseQueryMeta<BaseQuery>, arg: QueryArg): unknown;\n\n /**\n * A schema for the result *before* it's passed to `transformResponse`.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const postSchema = v.object({ id: v.number(), name: v.string() })\n * type Post = v.InferOutput<typeof postSchema>\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPostName: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * rawResponseSchema: postSchema,\n * transformResponse: (post) => post.name,\n * }),\n * })\n * })\n * ```\n */\n rawResponseSchema?: StandardSchemaV1<RawResultType>;\n\n /**\n * A schema for the error object returned by the `query` or `queryFn`, *before* it's passed to `transformErrorResponse`.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n * import {customBaseQuery, baseQueryErrorSchema} from \"./customBaseQuery\"\n *\n * const api = createApi({\n * baseQuery: customBaseQuery,\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * rawErrorResponseSchema: baseQueryErrorSchema,\n * transformErrorResponse: (error) => error.data,\n * }),\n * })\n * })\n * ```\n */\n rawErrorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n};\nexport type EndpointDefinitionWithQueryFn<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n /**\n * Can be used in place of `query` as an inline function that bypasses `baseQuery` completely for the endpoint.\n *\n * @example\n * ```ts\n * // codeblock-meta title=\"Basic queryFn example\"\n *\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPosts: build.query<PostsResponse, void>({\n * query: () => 'posts',\n * }),\n * flipCoin: build.query<'heads' | 'tails', void>({\n * // highlight-start\n * queryFn(arg, queryApi, extraOptions, baseQuery) {\n * const randomVal = Math.random()\n * if (randomVal < 0.45) {\n * return { data: 'heads' }\n * }\n * if (randomVal < 0.9) {\n * return { data: 'tails' }\n * }\n * return { error: { status: 500, statusText: 'Internal Server Error', data: \"Coin landed on its edge!\" } }\n * }\n * // highlight-end\n * })\n * })\n * })\n * ```\n */\n queryFn(arg: QueryArg, api: BaseQueryApi, extraOptions: BaseQueryExtraOptions<BaseQuery>, baseQuery: (arg: Parameters<BaseQuery>[0]) => ReturnType<BaseQuery>): MaybePromise<QueryReturnValue<ResultType, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>>;\n query?: never;\n transformResponse?: never;\n transformErrorResponse?: never;\n rawResponseSchema?: never;\n rawErrorResponseSchema?: never;\n};\ntype BaseEndpointTypes<QueryArg, BaseQuery extends BaseQueryFn, ResultType> = {\n QueryArg: QueryArg;\n BaseQuery: BaseQuery;\n ResultType: ResultType;\n};\ninterface CommonEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType> {\n /**\n * A schema for the arguments to be passed to the `query` or `queryFn`.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * argSchema: v.object({ id: v.number() }),\n * }),\n * })\n * })\n * ```\n */\n argSchema?: StandardSchemaV1<QueryArg>;\n\n /**\n * A schema for the result (including `transformResponse` if provided).\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const postSchema = v.object({ id: v.number(), name: v.string() })\n * type Post = v.InferOutput<typeof postSchema>\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * responseSchema: postSchema,\n * }),\n * })\n * })\n * ```\n */\n responseSchema?: StandardSchemaV1<ResultType>;\n\n /**\n * A schema for the error object returned by the `query` or `queryFn` (including `transformErrorResponse` if provided).\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n * import { customBaseQuery, baseQueryErrorSchema } from \"./customBaseQuery\"\n *\n * const api = createApi({\n * baseQuery: customBaseQuery,\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * errorResponseSchema: baseQueryErrorSchema,\n * }),\n * })\n * })\n * ```\n */\n errorResponseSchema?: StandardSchemaV1<BaseQueryError<BaseQuery>>;\n\n /**\n * A schema for the `meta` property returned by the `query` or `queryFn`.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n * import { customBaseQuery, baseQueryMetaSchema } from \"./customBaseQuery\"\n *\n * const api = createApi({\n * baseQuery: customBaseQuery,\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * metaSchema: baseQueryMetaSchema,\n * }),\n * })\n * })\n * ```\n */\n metaSchema?: StandardSchemaV1<BaseQueryMeta<BaseQuery>>;\n\n /**\n * Defaults to `true`.\n *\n * Most apps should leave this setting on. The only time it can be a performance issue\n * is if an API returns extremely large amounts of data (e.g. 10,000 rows per request) and\n * you're unable to paginate it.\n *\n * For details of how this works, please see the below. When it is set to `false`,\n * every request will cause subscribed components to rerender, even when the data has not changed.\n *\n * @see https://redux-toolkit.js.org/api/other-exports#copywithstructuralsharing\n */\n structuralSharing?: boolean;\n\n /**\n * A function that is called when a schema validation fails.\n *\n * Gets called with a `NamedSchemaError` and an object containing the endpoint name, the type of the endpoint, the argument passed to the endpoint, and the query cache key (if applicable).\n *\n * `NamedSchemaError` has the following properties:\n * - `issues`: an array of issues that caused the validation to fail\n * - `value`: the value that was passed to the schema\n * - `schemaName`: the name of the schema that was used to validate the value (e.g. `argSchema`)\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * onSchemaFailure: (error, info) => {\n * console.error(error, info)\n * },\n * }),\n * })\n * })\n * ```\n */\n onSchemaFailure?: SchemaFailureHandler;\n\n /**\n * Convert a schema validation failure into an error shape matching base query errors.\n *\n * When not provided, schema failures are treated as fatal, and normal error handling such as tag invalidation will not be executed.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * responseSchema: v.object({ id: v.number(), name: v.string() }),\n * catchSchemaFailure: (error, info) => ({\n * status: \"CUSTOM_ERROR\",\n * error: error.schemaName + \" failed validation\",\n * data: error.issues,\n * }),\n * }),\n * }),\n * })\n * ```\n */\n catchSchemaFailure?: SchemaFailureConverter<BaseQuery>;\n\n /**\n * Defaults to `false`.\n *\n * If set to `true`, will skip schema validation for this endpoint.\n * Overrides the global setting.\n *\n * @example\n * ```ts\n * // codeblock-meta no-transpile\n * import { createApi } from '@reduxjs/toolkit/query/react'\n * import * as v from \"valibot\"\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * getPost: build.query<Post, { id: number }>({\n * query: ({ id }) => `/post/${id}`,\n * responseSchema: v.object({ id: v.number(), name: v.string() }),\n * skipSchemaValidation: process.env.NODE_ENV === \"test\", // skip schema validation in tests, since we'll be mocking the response\n * }),\n * })\n * })\n * ```\n */\n skipSchemaValidation?: boolean;\n}\nexport type BaseEndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, ResultType, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = (([CastAny<BaseQueryResult<BaseQuery>, {}>] extends [NEVER] ? never : EndpointDefinitionWithQuery<QueryArg, BaseQuery, ResultType, RawResultType>) | EndpointDefinitionWithQueryFn<QueryArg, BaseQuery, ResultType>) & CommonEndpointDefinition<QueryArg, BaseQuery, ResultType> & {\n /* phantom type */\n [rawResultType]?: RawResultType;\n /* phantom type */\n [resultType]?: ResultType;\n /* phantom type */\n [baseQuery]?: BaseQuery;\n} & HasRequiredProps<BaseQueryExtraOptions<BaseQuery>, {\n extraOptions: BaseQueryExtraOptions<BaseQuery>;\n}, {\n extraOptions?: BaseQueryExtraOptions<BaseQuery>;\n}>;\nexport enum DefinitionType {\n query = 'query',\n mutation = 'mutation',\n infinitequery = 'infinitequery',\n}\ntype TagDescriptionArray<TagTypes extends string> = ReadonlyArray<TagDescription<TagTypes> | undefined | null>;\nexport type GetResultDescriptionFn<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = (result: ResultType | undefined, error: ErrorType | undefined, arg: QueryArg, meta: MetaType) => TagDescriptionArray<TagTypes>;\nexport type FullTagDescription<TagType> = {\n type: TagType;\n id?: number | string;\n};\nexport type TagDescription<TagType> = TagType | FullTagDescription<TagType>;\n\n/**\n * @public\n */\nexport type ResultDescription<TagTypes extends string, ResultType, QueryArg, ErrorType, MetaType> = TagDescriptionArray<TagTypes> | GetResultDescriptionFn<TagTypes, ResultType, QueryArg, ErrorType, MetaType>;\ntype QueryTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType> & {\n /**\n * The endpoint definition type. To be used with some internal generic types.\n * @example\n * ```ts\n * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n * ```\n */\n QueryDefinition: QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n TagTypes: TagTypes;\n ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface QueryExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> extends CacheLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleQueryExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n type: DefinitionType.query;\n\n /**\n * Used by `query` endpoints. Determines which 'tag' is attached to the cached data returned by the query.\n * Expects an array of tag type strings, an array of objects of tag types with ids, or a function that returns such an array.\n * 1. `['Post']` - equivalent to `2`\n * 2. `[{ type: 'Post' }]` - equivalent to `1`\n * 3. `[{ type: 'Post', id: 1 }]`\n * 4. `(result, error, arg) => ['Post']` - equivalent to `5`\n * 5. `(result, error, arg) => [{ type: 'Post' }]` - equivalent to `4`\n * 6. `(result, error, arg) => [{ type: 'Post', id: 1 }]`\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"providesTags example\"\n *\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * tagTypes: ['Posts'],\n * endpoints: (build) => ({\n * getPosts: build.query<PostsResponse, void>({\n * query: () => 'posts',\n * // highlight-start\n * providesTags: (result) =>\n * result\n * ? [\n * ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n * { type: 'Posts', id: 'LIST' },\n * ]\n * : [{ type: 'Posts', id: 'LIST' }],\n * // highlight-end\n * })\n * })\n * })\n * ```\n */\n providesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n /**\n * Not to be used. A query should not invalidate tags in the cache.\n */\n invalidatesTags?: never;\n\n /**\n * Can be provided to return a custom cache key value based on the query arguments.\n *\n * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key. It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n *\n * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean. If it returns a string, that value will be used as the cache key directly. If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`. This simplifies the use case of stripping out args you don't want included in the cache key.\n *\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n *\n * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n *\n * interface MyApiClient {\n * fetchPost: (id: string) => Promise<Post>\n * }\n *\n * createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * // Example: an endpoint with an API client passed in as an argument,\n * // but only the item ID should be used as the cache key\n * getPost: build.query<Post, { id: string; client: MyApiClient }>({\n * queryFn: async ({ id, client }) => {\n * const post = await client.fetchPost(id)\n * return { data: post }\n * },\n * // highlight-start\n * serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n * const { id } = queryArgs\n * // This can return a string, an object, a number, or a boolean.\n * // If it returns an object, number or boolean, that value\n * // will be serialized automatically via `defaultSerializeQueryArgs`\n * return { id } // omit `client` from the cache key\n *\n * // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n * // return defaultSerializeQueryArgs({\n * // endpointName,\n * // queryArgs: { id },\n * // endpointDefinition\n * // })\n * // Or create and return a string yourself:\n * // return `getPost(${id})`\n * },\n * // highlight-end\n * }),\n * }),\n *})\n * ```\n */\n serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n /**\n * Can be provided to merge an incoming response value into the current cache data.\n * If supplied, no automatic structural sharing will be applied - it's up to\n * you to update the cache appropriately.\n *\n * Since RTKQ normally replaces cache entries with the new response, you will usually\n * need to use this with the `serializeQueryArgs` or `forceRefetch` options to keep\n * an existing cache entry so that it can be updated.\n *\n * Since this is wrapped with Immer, you may either mutate the `currentCacheValue` directly,\n * or return a new value, but _not_ both at once.\n *\n * Will only be called if the existing `currentCacheData` is _not_ `undefined` - on first response,\n * the cache entry will just save the response data directly.\n *\n * Useful if you don't want a new request to completely override the current cache value,\n * maybe because you have manually updated it from another source and don't want those\n * updates to get lost.\n *\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"merge: pagination\"\n *\n * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n *\n * createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * listItems: build.query<string[], number>({\n * query: (pageNumber) => `/listItems?page=${pageNumber}`,\n * // Only have one cache entry because the arg always maps to one string\n * serializeQueryArgs: ({ endpointName }) => {\n * return endpointName\n * },\n * // Always merge incoming data to the cache entry\n * merge: (currentCache, newItems) => {\n * currentCache.push(...newItems)\n * },\n * // Refetch when the page arg changes\n * forceRefetch({ currentArg, previousArg }) {\n * return currentArg !== previousArg\n * },\n * }),\n * }),\n *})\n * ```\n */\n merge?(currentCacheData: ResultType, responseData: ResultType, otherArgs: {\n arg: QueryArg;\n baseQueryMeta: BaseQueryMeta<BaseQuery>;\n requestId: string;\n fulfilledTimeStamp: number;\n }): ResultType | void;\n\n /**\n * Check to see if the endpoint should force a refetch in cases where it normally wouldn't.\n * This is primarily useful for \"infinite scroll\" / pagination use cases where\n * RTKQ is keeping a single cache entry that is added to over time, in combination\n * with `serializeQueryArgs` returning a fixed cache key and a `merge` callback\n * set to add incoming data to the cache entry each time.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"forceRefresh: pagination\"\n *\n * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n *\n * createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * listItems: build.query<string[], number>({\n * query: (pageNumber) => `/listItems?page=${pageNumber}`,\n * // Only have one cache entry because the arg always maps to one string\n * serializeQueryArgs: ({ endpointName }) => {\n * return endpointName\n * },\n * // Always merge incoming data to the cache entry\n * merge: (currentCache, newItems) => {\n * currentCache.push(...newItems)\n * },\n * // Refetch when the page arg changes\n * forceRefetch({ currentArg, previousArg }) {\n * return currentArg !== previousArg\n * },\n * }),\n * }),\n *})\n * ```\n */\n forceRefetch?(params: {\n currentArg: QueryArg | undefined;\n previousArg: QueryArg | undefined;\n state: RootState<any, any, string>;\n endpointState?: QuerySubState<any>;\n }): boolean;\n\n /**\n * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n */\n Types?: QueryTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n}\nexport type QueryDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & QueryExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type InfiniteQueryTypes<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType> & {\n /**\n * The endpoint definition type. To be used with some internal generic types.\n * @example\n * ```ts\n * const useMyWrappedHook: UseQuery<typeof api.endpoints.query.Types.QueryDefinition> = ...\n * ```\n */\n InfiniteQueryDefinition: InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n TagTypes: TagTypes;\n ReducerPath: ReducerPath;\n};\nexport interface InfiniteQueryExtraOptions<TagTypes extends string, ResultType, QueryArg, PageParam, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> extends CacheLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleInfiniteQueryExtraOptions<InfiniteData<ResultType, PageParam>, QueryArg, BaseQuery, ReducerPath>, CacheCollectionQueryExtraOptions {\n type: DefinitionType.infinitequery;\n providesTags?: ResultDescription<TagTypes, InfiniteData<ResultType, PageParam>, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n /**\n * Not to be used. A query should not invalidate tags in the cache.\n */\n invalidatesTags?: never;\n\n /**\n * Required options to configure the infinite query behavior.\n * `initialPageParam` and `getNextPageParam` are required, to\n * ensure the infinite query can properly fetch the next page of data.\n * `initialPageParam` may be specified when using the\n * endpoint, to override the default value.\n * `maxPages` and `getPreviousPageParam` are both optional.\n * \n * @example\n * \n * ```ts\n * // codeblock-meta title=\"infiniteQueryOptions example\"\n * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n * \n * type Pokemon = {\n * id: string\n * name: string\n * }\n * \n * const pokemonApi = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: 'https://pokeapi.co/api/v2/' }),\n * endpoints: (build) => ({\n * getInfinitePokemonWithMax: build.infiniteQuery<Pokemon[], string, number>({\n * infiniteQueryOptions: {\n * initialPageParam: 0,\n * maxPages: 3,\n * getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) =>\n * lastPageParam + 1,\n * getPreviousPageParam: (\n * firstPage,\n * allPages,\n * firstPageParam,\n * allPageParams,\n * ) => {\n * return firstPageParam > 0 ? firstPageParam - 1 : undefined\n * },\n * },\n * query({pageParam}) {\n * return `https://example.com/listItems?page=${pageParam}`\n * },\n * }),\n * }),\n * })\n \n * ```\n */\n infiniteQueryOptions: InfiniteQueryConfigOptions<ResultType, PageParam, QueryArg>;\n\n /**\n * Can be provided to return a custom cache key value based on the query arguments.\n *\n * This is primarily intended for cases where a non-serializable value is passed as part of the query arg object and should be excluded from the cache key. It may also be used for cases where an endpoint should only have a single cache entry, such as an infinite loading / pagination implementation.\n *\n * Unlike the `createApi` version which can _only_ return a string, this per-endpoint option can also return an an object, number, or boolean. If it returns a string, that value will be used as the cache key directly. If it returns an object / number / boolean, that value will be passed to the built-in `defaultSerializeQueryArgs`. This simplifies the use case of stripping out args you don't want included in the cache key.\n *\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"serializeQueryArgs : exclude value\"\n *\n * import { createApi, fetchBaseQuery, defaultSerializeQueryArgs } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n *\n * interface MyApiClient {\n * fetchPost: (id: string) => Promise<Post>\n * }\n *\n * createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * endpoints: (build) => ({\n * // Example: an endpoint with an API client passed in as an argument,\n * // but only the item ID should be used as the cache key\n * getPost: build.query<Post, { id: string; client: MyApiClient }>({\n * queryFn: async ({ id, client }) => {\n * const post = await client.fetchPost(id)\n * return { data: post }\n * },\n * // highlight-start\n * serializeQueryArgs: ({ queryArgs, endpointDefinition, endpointName }) => {\n * const { id } = queryArgs\n * // This can return a string, an object, a number, or a boolean.\n * // If it returns an object, number or boolean, that value\n * // will be serialized automatically via `defaultSerializeQueryArgs`\n * return { id } // omit `client` from the cache key\n *\n * // Alternately, you can use `defaultSerializeQueryArgs` yourself:\n * // return defaultSerializeQueryArgs({\n * // endpointName,\n * // queryArgs: { id },\n * // endpointDefinition\n * // })\n * // Or create and return a string yourself:\n * // return `getPost(${id})`\n * },\n * // highlight-end\n * }),\n * }),\n *})\n * ```\n */\n serializeQueryArgs?: SerializeQueryArgs<QueryArg, string | number | boolean | Record<any, any>>;\n\n /**\n * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n */\n Types?: InfiniteQueryTypes<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath>;\n}\nexport type InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> =\n// Infinite query endpoints receive `{queryArg, pageParam}`\nBaseEndpointDefinition<InfiniteQueryCombinedArg<QueryArg, PageParam>, BaseQuery, ResultType, RawResultType> & InfiniteQueryExtraOptions<TagTypes, ResultType, QueryArg, PageParam, BaseQuery, ReducerPath>;\ntype MutationTypes<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string> = BaseEndpointTypes<QueryArg, BaseQuery, ResultType> & {\n /**\n * The endpoint definition type. To be used with some internal generic types.\n * @example\n * ```ts\n * const useMyWrappedHook: UseMutation<typeof api.endpoints.query.Types.MutationDefinition> = ...\n * ```\n */\n MutationDefinition: MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n TagTypes: TagTypes;\n ReducerPath: ReducerPath;\n};\n\n/**\n * @public\n */\nexport interface MutationExtraOptions<TagTypes extends string, ResultType, QueryArg, BaseQuery extends BaseQueryFn, ReducerPath extends string = string> extends CacheLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath>, QueryLifecycleMutationExtraOptions<ResultType, QueryArg, BaseQuery, ReducerPath> {\n type: DefinitionType.mutation;\n\n /**\n * Used by `mutation` endpoints. Determines which cached data should be either re-fetched or removed from the cache.\n * Expects the same shapes as `providesTags`.\n *\n * @example\n *\n * ```ts\n * // codeblock-meta title=\"invalidatesTags example\"\n * import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'\n * interface Post {\n * id: number\n * name: string\n * }\n * type PostsResponse = Post[]\n *\n * const api = createApi({\n * baseQuery: fetchBaseQuery({ baseUrl: '/' }),\n * tagTypes: ['Posts'],\n * endpoints: (build) => ({\n * getPosts: build.query<PostsResponse, void>({\n * query: () => 'posts',\n * providesTags: (result) =>\n * result\n * ? [\n * ...result.map(({ id }) => ({ type: 'Posts' as const, id })),\n * { type: 'Posts', id: 'LIST' },\n * ]\n * : [{ type: 'Posts', id: 'LIST' }],\n * }),\n * addPost: build.mutation<Post, Partial<Post>>({\n * query(body) {\n * return {\n * url: `posts`,\n * method: 'POST',\n * body,\n * }\n * },\n * // highlight-start\n * invalidatesTags: [{ type: 'Posts', id: 'LIST' }],\n * // highlight-end\n * }),\n * })\n * })\n * ```\n */\n invalidatesTags?: ResultDescription<TagTypes, ResultType, QueryArg, BaseQueryError<BaseQuery>, BaseQueryMeta<BaseQuery>>;\n /**\n * Not to be used. A mutation should not provide tags to the cache.\n */\n providesTags?: never;\n\n /**\n * All of these are `undefined` at runtime, purely to be used in TypeScript declarations!\n */\n Types?: MutationTypes<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath>;\n}\nexport type MutationDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = BaseEndpointDefinition<QueryArg, BaseQuery, ResultType, RawResultType> & MutationExtraOptions<TagTypes, ResultType, QueryArg, BaseQuery, ReducerPath>;\nexport type EndpointDefinition<QueryArg, BaseQuery extends BaseQueryFn, TagTypes extends string, ResultType, ReducerPath extends string = string, PageParam = any, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>> = QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType> | InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\nexport type EndpointDefinitions = Record<string, EndpointDefinition<any, any, any, any, any, any, any>>;\nexport function isQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is QueryDefinition<any, any, any, any, any, any> {\n return e.type === DefinitionType.query;\n}\nexport function isMutationDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is MutationDefinition<any, any, any, any, any, any> {\n return e.type === DefinitionType.mutation;\n}\nexport function isInfiniteQueryDefinition(e: EndpointDefinition<any, any, any, any, any, any, any>): e is InfiniteQueryDefinition<any, any, any, any, any, any, any> {\n return e.type === DefinitionType.infinitequery;\n}\nexport function isAnyQueryDefinition(e: EndpointDefinition<any, any, any, any>): e is QueryDefinition<any, any, any, any> | InfiniteQueryDefinition<any, any, any, any, any> {\n return isQueryDefinition(e) || isInfiniteQueryDefinition(e);\n}\nexport type EndpointBuilder<BaseQuery extends BaseQueryFn, TagTypes extends string, ReducerPath extends string> = {\n /**\n * An endpoint definition that retrieves data, and may provide tags to the cache.\n *\n * @example\n * ```js\n * // codeblock-meta title=\"Example of all query endpoint options\"\n * const api = createApi({\n * baseQuery,\n * endpoints: (build) => ({\n * getPost: build.query({\n * query: (id) => ({ url: `post/${id}` }),\n * // Pick out data and prevent nested properties in a hook or selector\n * transformResponse: (response) => response.data,\n * // Pick out error and prevent nested properties in a hook or selector\n * transformErrorResponse: (response) => response.error,\n * // `result` is the server response\n * providesTags: (result, error, id) => [{ type: 'Post', id }],\n * // trigger side effects or optimistic updates\n * onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry, updateCachedData }) {},\n * // handle subscriptions etc\n * onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry, updateCachedData }) {},\n * }),\n * }),\n *});\n *```\n */\n query<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): QueryDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n\n /**\n * An endpoint definition that alters data on the server or will possibly invalidate the cache.\n *\n * @example\n * ```js\n * // codeblock-meta title=\"Example of all mutation endpoint options\"\n * const api = createApi({\n * baseQuery,\n * endpoints: (build) => ({\n * updatePost: build.mutation({\n * query: ({ id, ...patch }) => ({ url: `post/${id}`, method: 'PATCH', body: patch }),\n * // Pick out data and prevent nested properties in a hook or selector\n * transformResponse: (response) => response.data,\n * // Pick out error and prevent nested properties in a hook or selector\n * transformErrorResponse: (response) => response.error,\n * // `result` is the server response\n * invalidatesTags: (result, error, id) => [{ type: 'Post', id }],\n * // trigger side effects or optimistic updates\n * onQueryStarted(id, { dispatch, getState, extra, requestId, queryFulfilled, getCacheEntry }) {},\n * // handle subscriptions etc\n * onCacheEntryAdded(id, { dispatch, getState, extra, requestId, cacheEntryRemoved, cacheDataLoaded, getCacheEntry }) {},\n * }),\n * }),\n * });\n * ```\n */\n mutation<ResultType, QueryArg, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): MutationDefinition<QueryArg, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n infiniteQuery<ResultType, QueryArg, PageParam, RawResultType extends BaseQueryResult<BaseQuery> = BaseQueryResult<BaseQuery>>(definition: OmitFromUnion<InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>, 'type'>): InfiniteQueryDefinition<QueryArg, PageParam, BaseQuery, TagTypes, ResultType, ReducerPath, RawResultType>;\n};\nexport type AssertTagTypes = <T extends FullTagDescription<string>>(t: T) => T;\nexport function calculateProvidedBy<ResultType, QueryArg, ErrorType