I have a component that uses generics and takes a bindable prop that looks like this:
{
current: T;
default: T;
error: string | null;
}
This worked fine until I upgraded, now it shows errors in both Neovim and VSCode and also in svelte-check. It still works the same but every time the component is used it shows an error: Type '{ current: unknown; default: unknown; error: string | null; }' is not assignable to type '{ current: number; default: number; error: null; }'. Types of property 'current' are incompatible. Type 'unknown' is not assignable to type 'number'.
svelte-check didn't show the error until i ran this upgrade:
but the error still shows up in Neovim/Code even before the upgrade, so I don't think the problem is in svelte-check itself, which is why I'm creating the issue here.
Reproduction
I have not been able to reproduce this in the REPL but it's not a lot of code.
The component:
Describe the bug
I have a component that uses generics and takes a bindable prop that looks like this:
This worked fine until I upgraded, now it shows errors in both Neovim and VSCode and also in svelte-check. It still works the same but every time the component is used it shows an error:
Type '{ current: unknown; default: unknown; error: string | null; }' is not assignable to type '{ current: number; default: number; error: null; }'. Types of property 'current' are incompatible. Type 'unknown' is not assignable to type 'number'.
svelte-check didn't show the error until i ran this upgrade:
but the error still shows up in Neovim/Code even before the upgrade, so I don't think the problem is in svelte-check itself, which is why I'm creating the issue here.
Reproduction
I have not been able to reproduce this in the REPL but it's not a lot of code. The component:
then use normally
It works if you don't bind it, or if you pass in
{x as typeof x}
, which is weirdLogs
No response
System Info
Severity
annoyance