Skip to content

Commit

Permalink
Update types and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pmakode-akamai committed Sep 2, 2024
1 parent e3a3f34 commit 3f008f4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/manager/src/features/Events/asyncToasts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import type { Event, EventAction } from '@linode/api-v4';

interface ToastMessage {
/**
* If true, the toast will be displayed with an error variant.
* If true, the toast will be displayed with an error variant for success messages \
* or a success variant for error messages.
*/
invertVariant?: boolean;
message: ((event: Event) => JSX.Element | null | string | undefined) | string;
Expand All @@ -25,11 +26,18 @@ interface ToastOption {
persist?: boolean;
}

interface ToastOptions {
interface ToastOptionsBase {
failure?: ToastOption | boolean;
success?: ToastOption | boolean;
}

/**
* To ensure that at least one of failure or success is provided while keeping both optional.
*/
type ToastOptions =
| (ToastOptionsBase & { failure: ToastOption | boolean })
| (ToastOptionsBase & { success: ToastOption | boolean });

const createToast = (options: ToastOptions) => {
const toastConfig: Toast = {};

Expand Down

0 comments on commit 3f008f4

Please sign in to comment.