Sanity Library Reference Docs
    Preparing search index...

    Type Alias ClientReturn<GroqString, Fallback>Experimental

    ClientReturn: GroqString extends { __groqResult?: infer Result }
        ? Result
        : GroqString extends keyof SanityQueries
            ? SanityQueries[GroqString]
            : Fallback

    The result type client.fetch(query) resolves to for a query of type GroqString.

    A query carrying a __groqResult brand, such as the default export of a .groq file imported through @sanity-labs/groq-content-mapper, resolves to the branded result. Otherwise the query is looked up in SanityQueries, and when it is not registered there the result is Fallback, which defaults to any.

    Type Parameters

    • GroqString extends string
    • Fallback = Any

    Reading the brand is experimental and tracks the .groq file imports that @sanity-labs/groq-content-mapper is introducing; the registry lookup and the fallback are stable. The brand is read structurally, so this type never imports the package that produced the query and resolves the same across duplicated copies of @sanity/client. It is a phantom property: it exists in the type system only and is never present on the string at runtime.