-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
Svelte 5: Binding on Generic Props shows error #2494
Comments
Result of #2477 - we silence type errors due to the whole type being |
dummdidumm
added a commit
that referenced
this issue
Sep 19, 2024
This reverts commit 8c080cf. This reverts #2477. Sadly, the idea didn't work out, as shown by two opened bug reports: - #2506: A type union can be narrowed on the input, but not on the way back out - #2494: A generic nested within a bound value is not properly resolved and not falling back to `any` (in #2477 we thought of the generic case, but only for when the generic is the whole value type, not when it's nested) For these reasons I don't see a way to properly implement #1392 at the moment.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: