How to get type from StoreDefinition #2521
Unanswered
Joebayld
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using typescript and I want to reference the type of the store (state, getters, actions) in a variable. What is the best way to extract the type from a store definition?
Also - I created my own store maker as I'm adding the IDs dynamically later, so here is my current code to create the store definition. What I want is a variable that references the Store with the types working accordingly.
I've tried
type StoreType = ReturnType<() => typeof widgetStore>;
but I can't then convert that to a Store. Any ideas?Beta Was this translation helpful? Give feedback.
All reactions