Skip to content
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

StoreApi typing issues #7

Closed
joeyfigaro opened this issue May 20, 2024 · 1 comment
Closed

StoreApi typing issues #7

joeyfigaro opened this issue May 20, 2024 · 1 comment

Comments

@joeyfigaro
Copy link

joeyfigaro commented May 20, 2024

@davstack/store: v1.1.5
typescript: v5.4.4
zustand: v4.5.2

import { store } from "@davstack/store";

type GlobalStore = {
  user: {
    name: string;
  } | null;
  token: string | null;
}

const globalStore = store<GlobalStore>()
  .state({
    user: null,
    token: null
  })
  .actions(store => ({
    setUser: (u: User) => {
      // store is 'any' here
    }
  }))

Despite providing typing for the store, all instances of store in actions, computed, effects, etc. are typed as any – all properties are also any

@joeyfigaro
Copy link
Author

Nevermind! I must've done something wonky when trying this out last night. Recreating my snippet in my codebase provides the correct typings for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant