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