keenethics/svelte-notifications

Custom Notification component Typescript error.

enriquecastill0 opened this issue ยท 4 comments

I'm trying to pass my component in order to have a custom notification
<Notifications item={CustomNotification}>

But Typescript isn't happy with it
Error message:
Type 'typeof CustomNotification__SvelteComponent_' is missing the following properties from type 'SvelteComponentDev': $set, $on, $destroy, $$prop_def, and 5 more.ts(2740)

Is there a way to declare my component as SvelteComponentDev ?

I have the same issue.

#56

Quickest workaround I found:

// __layout.svelte
<script lang="ts> 
import Notifications from 'svelte-notifications';
import CustomToast from '$lib/modules/toast/toast.svelte';

let Toast = CustomToast as any;
...
</script>

 <Notifications item={Toast}>
...

Thank you for the workaround suggestion, I could live with that ๐Ÿ‘

@KTruong008 Thank you for suggestion. In the next versions I will try to make the work with the typescript smoother