-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Typescript namespace store binding with $ #8046
Comments
Right now svelte only supports stores that are top level variables like this: const { username } = UserStore
$username
|
There's #4079 for supporting subscribing to stores that aren't top-level variables. I'm not sure whether there's anything else here, or how the TypeScript namespace part affects anything. |
namespaces are a deprecated feature of TypeScript, so it's highly unlikely we would ever support something like this. I guess the JS-version of this would be export const UserStore = {
username: writable("foo")
}; ... which means you want to subscribe to nested stores, and I think there's an issue for that somewhere in this repo. |
Yup, I linked to the issue for subscribing to that in my previous comment. I'll close this if we're not going to be supporting anything namespace-specific. |
Describe the problem
I'd like to organize my store better by wrapping my store files in namespaces.
But there is no way to use Autosubscription when a store is namespaced.
example:
user-store.ts
user.svelte
Describe the proposed solution
I'd like to be able to autosubscribe to namespaced stores like this:
{$UserStore.username}
Alternatives considered
an alternative could be:
{UserStore.$username}
or
{$(UserStore.username)}
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: