Custom Notification component Typescript error.
enriquecastill0 opened this issue ยท 4 comments
enriquecastill0 commented
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 ?
Deleted user commented
I have the same issue.
KTruong008 commented
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}>
...
Deleted user commented
Thank you for the workaround suggestion, I could live with that ๐
usernamus commented
@KTruong008 Thank you for suggestion. In the next versions I will try to make the work with the typescript smoother