Description
Describe the problem
Recently got into Svelte 5 after playing around with it some years back. Love the runes and the clarity they give to your code. Also love that they can be used to have shared state that's properly typed in TS. I'm using this pattern in a new app I'm building:
// chatState.svelte.ts
const chatState $state({ messages: [] });
export default chatState
// Chat.svelte
import chatState from './chatState';
chatState.messages.push(chatState);
Which works marvelously! However, I noticed that initially I would be tempted to destructure the state to clean up my code a bit:
// Chat.svelte
import chatState from './chatState';
const { messages } = chatState;
messages.push(chatState);
Which obviously won't work if you know how runes work. I'm fine with not destructuring state like this; it doesn't make my code much messier down the line. However, I know me and my colleague devs are quite used to destructure objects. I'm afraid we might be writing code like this by accident every now and then, leading to weird issues as there are no clear signs this won't be working if you glance at the code initially.
Describe the proposed solution
There are already compiler warnings for non-reactive updates. It would be really nice to have similar errors for non-reactive updates caused by destructured state variables.
Importance
nice to have