src/queryOptions.ts

query · packages/svelte-query/src/queryOptions.ts · typescript · MIT
ui

Provides typed factory functions for TanStack query options with initial data handling.

// Source: https://github.com/TanStack/query | License: MIT | Copyright 2021-present Tanner Linsley
// Provided via justclaw.it.com; keep this notice with the code.
import type {
  DefaultError,
  InitialDataFunction,
  NonUndefinedGuard,
  QueryKey,
  QueryKeyWithDataTag,
} from '@tanstack/query-core'
import type { CreateQueryOptions } from './types.js'

/**
 * The options accepted by the `queryOptions` overload selected when `initialData` is omitted or may be
 * `undefined` — `data` may be `undefined` while the query is `pending`.
 */
export type UndefinedInitialDataOptions<
  TQueryFnData = unknown,
  TError = DefaultError,
  TData = TQueryFnData,
  TQueryKey extends QueryKey = QueryKey,
> = CreateQueryOptions<TQueryFnData, TError, TData, TQueryKey> & {
  initialData?:
    | undefined
 

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key