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