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