Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Notification component Typescript error. #59

Closed
enriquecastill0 opened this issue Mar 25, 2022 · 4 comments
Closed

Custom Notification component Typescript error. #59

enriquecastill0 opened this issue Mar 25, 2022 · 4 comments

Comments

@enriquecastill0
Copy link

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 ?

@ghost
Copy link

ghost commented Mar 25, 2022

I have the same issue.

#56

@KTruong008
Copy link

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}>
...

@ghost
Copy link

ghost commented Mar 30, 2022

Thank you for the workaround suggestion, I could live with that 👍

@usernamus
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants