type ToastHandle = { /** * - Dismisses this specific toast. Safe to call even if the toast already closed itself (e.g. its duration expired) — no-ops rather than throwing. */ dismiss: () => Promise; }; type ToastPromiseMessages = { loading?: string; /** * - Either a fixed string, or a function that receives the resolved value and returns the message. */ success?: string | ((value: any) => string); /** * - Either a fixed string, or a function that receives the caught error and returns the message. */ error?: string | ((error: any) => string); }; /** * @typedef {Object} ToastHandle * @property {() => Promise} dismiss - Dismisses this specific toast. Safe to call even if the toast already closed itself (e.g. its duration expired) — no-ops rather than throwing. */ /** * @param {ToastOptions} [options] * @returns {Promise} */ declare function createToastWithPriority(options?: ToastOptions): Promise; declare function setDefaultColors(colors: any): void; declare function setDefaultMessages(messages: any): void; declare function dismissToast(): Promise; declare function noopAll(): Promise; /** * @typedef {Object} ToastPromiseMessages * @property {string} [loading="Loading..."] * @property {string | ((value: any) => string)} [success="Done!"] - Either a fixed string, or a function that receives the resolved value and returns the message. * @property {string | ((error: any) => string)} [error="Something went wrong."] - Either a fixed string, or a function that receives the caught error and returns the message. */ /** * Shows a loading toast, then swaps it for a success or error toast once * the given promise settles. The original promise's resolution/rejection * is passed through unchanged, so `await toastPromise(fetchData(), {...})` * still gives you the real result (or throws the real error) — this is * purely a UI layer on top of a promise you're already awaiting. * * @param {Promise | (() => Promise)} promiseOrFn - A promise, or a function that returns one (called immediately). * @param {ToastPromiseMessages} [messages] * @param {Omit} [options] - Applied to all three toasts (loading/success/error). type and message are controlled by this function. * @returns {Promise} Resolves/rejects with whatever the original promise did. */ declare function toastPromise(promiseOrFn: Promise | (() => Promise), messages?: ToastPromiseMessages, options?: Omit): Promise; export { createToastWithPriority as createToast, dismissToast as dismiss, noopAll as noop, setDefaultColors, setDefaultMessages, toastPromise }; export type { ToastHandle, ToastPromiseMessages };