Replies: 1 comment
-
Of course, not even an hour after asking and I've found what might be the solution. This was definitely the wrong repo to ask, so I'll close this. For future researchers, head over to: vuejs/pinia#2573 |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Hello! As a forewarning, I have also asked this in the Pinia github Discussions in case this repo is not the right place to ask.
I'm migrating from Vue 2 to 3 and replacing Vuex with Pinia. My project was written with
vue-class-component
andvue-property-decorator
, so I'm also switching tovue-facing-decorator
. However, I'm running into a problem making these 2 libraries work together with Typescript.According to vfd's documentation, the way to inject composables is to use
@Setup
, so I'm trying to do that for Pinia stores but I'm running into trouble assigning a type for the the actualized store.Per the in-line comments, this throws various errors. If I get rid of the casting, it technically compiles but it's not quite right and there's no enforcement that the getters/actions defined in the
defineStore()
options are actually implemented theMyStoreGetters
andMyStoreActions
interfaces.I have also tried doing something like this, but I get an error that it's creating a store before Pinia is initialized.
What's the "proper" way of doing this? Or is there one?
Beta Was this translation helpful? Give feedback.
All reactions