import type { ToastManagerUpdateOptions } from '../useToastManager'; export function resolvePromiseOptions( options: | string | ToastManagerUpdateOptions | ((result: T) => string | ToastManagerUpdateOptions), result?: T, ): ToastManagerUpdateOptions { if (typeof options === 'string') { return { description: options, }; } if (typeof options === 'function') { const resolvedOptions = options(result as T); return typeof resolvedOptions === 'string' ? { description: resolvedOptions } : resolvedOptions; } return options; }