import type { ExpressionOrValue } from '../expression.js'; import type { ArgumentValue } from './argument.js'; /** 表示一个全局变量 */ export type Variable = { /** 唯一 key */ key: string; /** 变量值 */ value: ExpressionOrValue; }; /** 检查是否为 `Variable` */ export function isVariable(obj: unknown): obj is Variable { if (obj == null || typeof obj != 'object') return false; if ('condition' in obj || 'description' in obj || 'type' in obj) return false; const v = obj as Variable; return typeof v.key == 'string' && 'value' in v; }