@@ -9,6 +9,7 @@ import Yoga.React.DOM.Internal (class IsJSX)
99import Data.Function.Uncurried (runFn4)
1010import HeroUI.Internal (class CoerceHeroProps, createElementTransformImpl)
1111import HeroUI.Raw as Raw
12+import Unsafe.Coerce (unsafeCoerce)
1213
1314-- Render the provider once near the root of the app; fire toasts imperatively.
1415type ToastProviderProps r =
@@ -64,17 +65,19 @@ foreign import closeAllToastsImpl :: Effect Unit
6465foreign import pauseAllToastsImpl :: Effect Unit
6566foreign import resumeAllToastsImpl :: Effect Unit
6667
67−toastSuccess :: JSX -> Effect String
68−toastSuccess = runEffectFn1 toastSuccessImpl
68+-- | The message accepts anything renderable (`IsJSX`): a plain `String`, a
69+-- | `JSX` element, or an `Array JSX`.
70+toastSuccess :: forall msg. IsJSX msg => msg -> Effect String
71+toastSuccess msg = runEffectFn1 toastSuccessImpl (unsafeCoerce msg)
6972
70−toastDanger :: JSX -> Effect String
71−toastDanger = runEffectFn1 toastDangerImpl
73+toastDanger :: forall msg. IsJSX msg => msg -> Effect String
74+toastDanger msg = runEffectFn1 toastDangerImpl (unsafeCoerce msg)
7275
73−toastInfo :: JSX -> Effect String
74−toastInfo = runEffectFn1 toastInfoImpl
76+toastInfo :: forall msg. IsJSX msg => msg -> Effect String
77+toastInfo msg = runEffectFn1 toastInfoImpl (unsafeCoerce msg)
7578
76−toastWarning :: JSX -> Effect String
77−toastWarning = runEffectFn1 toastWarningImpl
79+toastWarning :: forall msg. IsJSX msg => msg -> Effect String
80+toastWarning msg = runEffectFn1 toastWarningImpl (unsafeCoerce msg)
7881
7982closeToast :: String -> Effect Unit
8083closeToast = runEffectFn1 closeToastImpl