Skip to content

Commit

Permalink
feature(variables): added jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
scottrippey committed Feb 6, 2024
1 parent bed9072 commit df23dde
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/groq-builder/src/commands/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ import { Simplify } from "type-fest";

declare module "../groq-builder" {
export interface GroqBuilder<TResult, TQueryConfig> {
/**
* Defines the names and types of parameters that
* must be passed to the query.
*
* This method is just for defining types;
* it has no runtime effects.
*
* The parameter types should not include the `$` prefix.
*
* @example
* const productsBySlug = (
* q.parameters<{ slug: string }>()
* .star
* .filterByType('product')
* // You can now reference the $slug parameter:
* .filterBy('slug.current == $slug')
* );
* const results = await executeQuery(
* productsBySlug,
* // The 'slug' parameter is required:
* { parameters: { slug: "123" } }
* )
*/
parameters<TParameters>(): GroqBuilder<
TResult,
Override<
Expand All @@ -14,6 +37,9 @@ declare module "../groq-builder" {
}
>
>;

/** @deprecated Use `parameters` to define parameters */
variables: never;
}
}

Expand Down

0 comments on commit df23dde

Please sign in to comment.