ExperimentalReading the brand is experimental and tracks the .groq file imports that
@sanity-labs/groq-content-mapper is introducing. Like ClientReturn, this reads the
brand structurally and never imports the package that produced the query.
Unlike ClientReturn, this type sits in a parameter position, so it has to stay relatable
while GroqString is still a type parameter: code that is generic over the query string, like
function load<const Q extends string>(query: Q, params: QueryParams), must keep compiling.
TypeScript never relates a value to a deferred conditional type that has an infer position,
or that distributes over the type parameter it reads, which is why the brand is read through an
indexed access and the check is written in the non-distributive tuple form. While deferred,
TypeScript then checks the value against both branches, so the params are validated against
Fallback exactly as they were before the brand existed.
The params type
client.fetch(query, params)accepts for a query of typeGroqString.A query carrying a
__groqParamsbrand, such as the default export of a.groqfile imported through@sanity-labs/groq-content-mapper, resolves to the branded params, so that the params passed alongside it are checked. Any other query resolves toFallback, which defaults to QueryParams.