Skip to content

sveltekit 5: Type 'Component<$$ComponentProps>' is not assignable to type 'SvelteComponent' #115

@Dalidos

Description

@Dalidos

Hi, I have this error on 'svelte-check' when I send a component inside the toast.

Error: Type 'Component<$$ComponentProps, {}, "">' is not assignable to type 'SvelteComponent'.
  Type 'Component<$$ComponentProps, {}, "">' is not assignable to type 'new (options: ComponentConstructorOptions<Record<string, any>>) => SvelteComponent<Record<string, any>, any, any>'.
    Type 'Component<$$ComponentProps, {}, "">' provides no match for the signature 'new (options: ComponentConstructorOptions<Record<string, any>>): SvelteComponent<Record<string, any>, any, any>'. 
                        component: {
                                src: Toast,
                                props: {

here my code:

let toastId = toast.push( {
        component: {
		src: Toast,
                props: {
			onClose: () => {
				toast.pop(toastId);
			}
		}
	},
        duration: 5000,
})

I'm using sveltik 2 (so svelte 5), maybe it's a compatibility error ?
I use $props inside my Toast component to use a close event:

let { onClose }: { onClose: () => void } = $props();

It work as is, but the svelte-check doesn't like this :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions