export interface TabLike { id: string; } export interface TabCloseState { tabs: T[]; activeTabId: string | null; } export function closeOtherTabsState( tabs: readonly T[], activeTabId: string | null, targetTabId: string, ): TabCloseState { const target = tabs.find((tab) => tab.id === targetTabId); if (!target) return { tabs: [...tabs], activeTabId }; return { tabs: [target], activeTabId: target.id }; } export function closeAllTabsState( _tabs: readonly T[], _activeTabId: string | null, ): TabCloseState { return { tabs: [], activeTabId: null }; }