UNPKG

614 BPlain TextView Raw
1import type { BaseQueryFn } from './baseQueryTypes'
2
3const _NEVER = /* @__PURE__ */ Symbol()
4export type NEVER = typeof _NEVER
5
6/**
7 * Creates a "fake" baseQuery to be used if your api *only* uses the `queryFn` definition syntax.
8 * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions.
9 */
10export function fakeBaseQuery<ErrorType>(): BaseQueryFn<
11 void,
12 NEVER,
13 ErrorType,
14 {}
15> {
16 return function () {
17 throw new Error(
18 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.'
19 )
20 }
21}