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