-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Why is this line marked as error? #2556
Comments
You can't both strictly type check your code and expect no error in these positions. If you opt into more type checking, you have to provide the types, too. What we can do however is detect that you're creating an array-type fallback, and type that as |
Is it OK, to post more of this here? Or should I open a new issue? {disabled} is marked wrongly. Type 'unknown' is not assignable to type 'boolean'
|
The idea was to be conservative about it, but this causes problems for people not wanting strict type checking but only a basic form of it. Falling back to `any` is the more pragmatic choice #2556
) The idea was to be conservative about it, but this causes problems for people not wanting strict type checking but only a basic form of it. Falling back to `any` is the more pragmatic choice #2556
Describe the bug
In this short example, filter is marked red
'array' is of type 'unknown'.
For example, when I use next code in TS playground, it will not mark array or filter as error. Expected errors are $props() and i. But not arary or filter.
My configuration:
installed using Vite (fresh installation)
but not Svelte kit
just JS Svelte 5 (newest)
or even TS (no difference)
newest Svelte extension for VS code
newest VS Code update
Such error come up with Svelte 5 first (Svelte 4 show no errors).
I hoped all the time that this will be fixed with final v5.
I played with checkJS - or ts-nocheck.
But this will hide any error.
Reproduction
Expected behaviour
no error
System Info
Which package is the issue about?
Svelte for VS Code extension
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: