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