Due to recent change in svelte-check v4.0.3, following type error occurs while importing Svelte 5 component in svelte storybook file. This also ends up causing multiple type errors in the story args definition.
Error: Type 'Component<Props, {}, "">' is not assignable to type 'ComponentType<Component<Props, {}, "">, any>'.
Type 'Component<Props, {}, "">' provides no match for the signature 'new (options: ComponentConstructorOptions<Component<Props, {}, "">>): { [x: string]: any; $destroy: () => void; $on: <K extends string>(type: K, callback: (e: any) => void) => () => void; $set: (props: Partial<...>) => void; }'.
As per PR, In svelte 5, components are functions. Hence with this PR only function type is exported in runes mode.
I tried to supply svelte 5 component to Meta as Meta<ReturnType<typeof Button>>. However, it throws following error after that change.
Error: Type '{ $on?(type: string, callback: (e: any) => void): () => void; $set?(props: Partial<Props>): void; }' is not assignable to type 'ComponentType<{ $on?(type: string, callback: (e: any) => void): () => void; $set?(props: Partial<Props>): void; }, any>'.
Type '{ $on?(type: string, callback: (e: any) => void): () => void; $set?(props: Partial<Props>): void; }' provides no match for the signature 'new (options: ComponentConstructorOptions<{ $on?(type: string, callback: (e: any) => void): () => void; $set?(props: Partial<Props>): void; }>): { ...; }'.
title: "Example/Button",
component: Button as ReturnType<typeof Button>,
tags: ["autodocs"],
Describe the bug
Due to recent change in
svelte-check
v4.0.3, following type error occurs while importing Svelte 5 component in svelte storybook file. This also ends up causing multiple type errors in the story args definition.As per PR, In svelte 5, components are functions. Hence with this PR only function type is exported in runes mode.
I tried to supply svelte 5 component to
Meta
asMeta<ReturnType<typeof Button>>
. However, it throws following error after that change.Reproduction link
https://codesandbox.io/p/devbox/8p9rrz
Reproduction steps
svelte-check
is reverted to4.0.2
, svelte-check passes with no errors.System
Additional context
No response