-
-
Notifications
You must be signed in to change notification settings - Fork 209
Issue with VSCode Incorrectly Reporting bind:clientWidth as an Error #2741
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
Comments
Additional InformationI found another related issue with Function bindings. When binding an array, mutations like Example: <script>
let {arr=$bindable()}=$props();
function update() {
arr.push(1); // This won't trigger an update
}
</script>
data: {JSON.stringify(arr)}
<button onclick={update}>Push</button> <script>
let arr_str = '';
</script>
<Module bind:arr={() => arr_str.split(','), (arr) => (arr_str = arr.join(','))} />
Unless the array is reassigned entirely, the binding doesn't respond to changes. This can be confusing, especially when assuming that operations like |
I can't reproduce the error. Can you check if you have svelte.language-server.ls-path config? |
Oh. Never mind, my test workspace has a type definition that overwrites the element type definition. |
We're seeing the same exactly bug in our code base too :) |
Describe the bug
I followed the documentation (https://svelte.dev/docs/svelte/bind#Function-bindings) to write code using
bind:clientWidth
, but I encountered an error:However, if I ignore the error reported by VSCode, the page works as expected.
Additionally, I noticed that the following code works fine:
But when I use it like this, it doesn't work:
Version:
Reproduction
<script lang="ts"> let w=$state(0); </script>Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: