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