export interface ContextMenuType { visible: boolean; position: { top: number; left: number; }; menu: ContextMenu } export interface ContextMenu { entries: ContextMenuEntry[]; } interface ContextMenuEntryWithAction { menuText: string; actionTrigger: string; } interface ContextMenuEntryWithChildren { expanded: boolean; menuText: string; children: ContextMenuEntry[]; } type ContextMenuEntry = ContextMenuEntryWithAction | ContextMenuEntryWithChildren; export function menuEntryWithAction(entry: ContextMenuEntry): entry is ContextMenuEntryWithAction { return 'actionTrigger' in entry; } export function menuEntryWithChildren(entry: ContextMenuEntry): entry is ContextMenuEntryWithChildren { return 'children' in entry; }