From facb7a000eee3cce39bfb0c869d7dacab5556e3e Mon Sep 17 00:00:00 2001 From: Ana Date: Wed, 30 Jul 2025 01:08:14 -0700 Subject: [PATCH] update type errors --- src/view/com/util/Toast.style.tsx | 12 +++++++++++- src/view/com/util/Toast.tsx | 5 +++-- src/view/com/util/Toast.web.tsx | 4 ++-- src/view/screens/Storybook/Toasts.tsx | 5 +++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/view/com/util/Toast.style.tsx b/src/view/com/util/Toast.style.tsx index dfa4f4fd63..8b952fd00b 100644 --- a/src/view/com/util/Toast.style.tsx +++ b/src/view/com/util/Toast.style.tsx @@ -4,7 +4,17 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/ico import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo' import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning' -export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info' +export type ToastType = + | 'default' + | 'success' + | 'error' + | 'warning' + | 'info' + | 'xmark' + | 'exclamation-circle' + | 'check' + | 'clipboard-check' + | 'circle-exclamation' export const TOAST_ANIMATION_CONFIG = { duration: 300, diff --git a/src/view/com/util/Toast.tsx b/src/view/com/util/Toast.tsx index 7258eac9d8..4c999ca2a4 100644 --- a/src/view/com/util/Toast.tsx +++ b/src/view/com/util/Toast.tsx @@ -57,8 +57,9 @@ function Toast({ const [cardHeight, setCardHeight] = useState(0) const toastStyles = getToastTypeStyles(t) - const colors = toastStyles[type] - const IconComponent = TOAST_TYPE_TO_ICON[type] + const colors = toastStyles[type as keyof typeof toastStyles] + const IconComponent = + TOAST_TYPE_TO_ICON[type as keyof typeof TOAST_TYPE_TO_ICON] // for the exit animation to work on iOS the animated component // must not be the root component diff --git a/src/view/com/util/Toast.web.tsx b/src/view/com/util/Toast.web.tsx index 9ed1f03975..1abbaa0031 100644 --- a/src/view/com/util/Toast.web.tsx +++ b/src/view/com/util/Toast.web.tsx @@ -63,11 +63,11 @@ export const ToastContainer: React.FC = ({}) => { const toastTypeStyles = getToastTypeStyles(t) const toastStyles = activeToast - ? toastTypeStyles[activeToast.type] + ? toastTypeStyles[activeToast.type as keyof typeof toastTypeStyles] : toastTypeStyles.default const IconComponent = activeToast - ? TOAST_TYPE_TO_ICON[activeToast.type] + ? TOAST_TYPE_TO_ICON[activeToast.type as keyof typeof TOAST_TYPE_TO_ICON] : TOAST_TYPE_TO_ICON.default const animationStyles = getToastWebAnimationStyles() diff --git a/src/view/screens/Storybook/Toasts.tsx b/src/view/screens/Storybook/Toasts.tsx index 54735f7bbd..4c17f1c332 100644 --- a/src/view/screens/Storybook/Toasts.tsx +++ b/src/view/screens/Storybook/Toasts.tsx @@ -12,8 +12,9 @@ import {H1, Text} from '#/components/Typography' function ToastPreview({message, type}: {message: string; type: ToastType}) { const t = useTheme() const toastStyles = getToastTypeStyles(t) - const colors = toastStyles[type] - const IconComponent = TOAST_TYPE_TO_ICON[type] + const colors = toastStyles[type as keyof typeof toastStyles] + const IconComponent = + TOAST_TYPE_TO_ICON[type as keyof typeof TOAST_TYPE_TO_ICON] return (