import type { Node } from 'web-tree-sitter'; const TYPE = 'boolean_value' as const; // ================================================================ // ================================================================ // // BooleanValueNode // // GraphQL boolean value node // // ================================================================ // ================================================================ /** * Represents a boolean value in the GraphQL AST. * */ export interface BooleanValueNode extends Node { type: typeof TYPE; } // ================================================================ // ================================================================ // // Type Guard // // ================================================================ // ================================================================ /** * Type guard to check if a node is a {@link BooleanValueNode}. * * @param node - The node to check * @returns True if the node is a {@link BooleanValueNode} * * @example * ```typescript * if (isBooleanValueNode(node)) { * // TypeScript now knows node is BooleanValueNode * console.log(node.type); // 'boolean_value' * } * ``` */ export function isBooleanValueNode(node: unknown): node is BooleanValueNode { return (node as any)?.type === TYPE; } // ================================================================ // ================================================================ // // Constructor // // ================================================================ // ================================================================ /** * Creates a new {@link BooleanValueNode} with the specified properties. * * @returns A new {@link BooleanValueNode} * * @example * ```typescript * const node = BooleanValueNode({ * // properties... * }); * ``` */ export function BooleanValueNode(props: Omit): BooleanValueNode { return { type: TYPE, ...props }; }