import { IsNullable } from "../types/utils"; import { IGroqBuilderNotChainable } from "../groq-builder"; declare module "../groq-builder" { interface GroqBuilder { /** * Marks a query as nullable – in case you are expecting a potential `null` value. * Useful when you expect missing values in your data, * even though the query thinks it's required. * * ⚠️ NOTE: This method can only be used at the end of a query chain, * because you cannot chain more commands after making an assertion. * See CHAINED_ASSERTION_ERROR for more details. * * @param redundant - If the type is already nullable, then you must explicitly pass `.nullable(true)` to allow this redundancy. (this has no impact at runtime) * * @example * q.star.filterByType("product").project(sub => ({ * // In our schema, "category" is required, but we know * // that we have old entries that are missing this field: * category: sub.field("category").nullable(), * }); */ nullable(...redundant: IsNullable extends true ? [true] : []): IGroqBuilderNotChainable; } }