Sanity Library Reference Docs
    Preparing search index...

    A subset type that's compatible with most SanityClient typings, this makes it easier to use this package in libraries that may use import type { SanityClient } from 'sanity' as well as those that use import type { SanityClient } from '@sanity/client'

    type SanityClientLike = {
        config(): { token?: string };
        fetch<R, Q = { [key: string]: any }>(
            query: string,
            params: Q,
            options: { tag?: string },
        ): Promise<R>;
        withConfig(
            config: {
                apiVersion?: string;
                perspective?: ClientPerspective;
                resultSourceMap?: boolean;
                useCdn?: boolean;
            },
        ): SanityClientLike;
    }
    Index

    Methods

    • Returns { token?: string }

    • Type Parameters

      • R
      • Q = { [key: string]: any }

      Parameters

      • query: string
      • params: Q
      • options: { tag?: string }

      Returns Promise<R>

    • Parameters

      • config: {
            apiVersion?: string;
            perspective?: ClientPerspective;
            resultSourceMap?: boolean;
            useCdn?: boolean;
        }

      Returns SanityClientLike