kbrgl / svelte-french-toast

🍞🥂 Buttery smooth toast notifications for Svelte
https://svelte-french-toast.vercel.app/
MIT License
838 stars 30 forks source link

fix: toast.promise() type signature #14

Closed MarcusCemes closed 1 year ago

MarcusCemes commented 1 year ago

I believe this should fix the issue.

I don't believe type ValueOrFunction can be used in this instance, in particular, typeof SvelteComponent cannot be used as a value directly for the reasons explained in the related issue.

Feel free to comment or make edits if you find a more elegant way to express the type. There may also be a conflict with another part of the codebase that I'm not familiar with?

Closes #13

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
svelte-french-toast ✅ Ready (Inspect) Visit Preview Nov 5, 2022 at 8:28PM (UTC)
MarcusCemes commented 1 year ago

Or perhaps to be more explicit, it could be refactored to the following (it should have the same type signature)? Personally, I prefer the former, it's a little easier to read, even if it doesn't immediately stand out that components can't be passed as values.

export type IntoRenderable<T> = Exclude<ValueOrFunction<Renderable, T>, typeof SvelteComponent>;