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