Sanity Library Reference Docs
    Preparing search index...

    Interface SanityQueries

    The query registry as seen from @sanity/client. Inherits every query registered on the global SanityQueries interface, and still accepts the older module augmentation form:

    declare module '@sanity/client' {
    interface SanityQueries {
    '*[_type == "post"]': PostsQueryResult
    }
    }

    @sanity/client releases that predate the global registry only read this interface, so a generated file that registers queries globally can bridge them with an augmentation that adds the global as a base type. It is harmless on releases that already inherit it:

    declare module '@sanity/client' {
    interface SanityQueries extends globalThis.SanityQueries {}
    }
    interface SanityQueries {
        "*[_type == 'foo']": FooResult;
        "*[_type == 'globalFoo']": GlobalFooResult;
        "*[_type == 'packagingLegacy']": PackagingLegacy;
        "*[_type == 'packagingPost']": PackagingPost;
        "*[_type == 'registered']": RegisteredResult;
        "*[_type == 'stegaGlobalPost'][0]": PostQueryResult;
        "*[_type == 'stegaPost'][0]": PostQueryResult;
    }

    Hierarchy

    • SanityQueries
      • SanityQueries
    Index

    Properties

    "*[_type == 'foo']": FooResult
    "*[_type == 'globalFoo']": GlobalFooResult
    "*[_type == 'packagingLegacy']": PackagingLegacy
    "*[_type == 'packagingPost']": PackagingPost
    "*[_type == 'registered']": RegisteredResult
    "*[_type == 'stegaGlobalPost'][0]": PostQueryResult
    "*[_type == 'stegaPost'][0]": PostQueryResult