A few TypeScript Questions - Trying to work with vuex-module-decorators #8688
Replies: 4 comments 10 replies
-
@IlCallo - Can probably help best with your questions. As for donating. You can become a direct sponsor via Github or offer donations to the main dev, Razvan. https://quasar.dev/why-donate#donating Scott |
Beta Was this translation helpful? Give feedback.
-
@armenr One key thing to keep in mind in this case is the post that you are following was created targeting Quasar V1 + Vue 2, and you are using Quasar V2 + Vue 3. There are some key breaking changes between the two so it is not surprising bringing that code directly into a quasar 2 project fails. For example the |
Beta Was this translation helpful? Give feedback.
-
For what it's worth: Decorators are nice, but trying to get the decorators to work in a SANE And TYPESAFE way (without disabling linting or taking shortcuts) proves to be more risky than valuable. I came across this article, and it helped me to understand the logical flow implementing state & modules...of course, I took some liberties with his approach, to make the resulting code more expressive, and slightly less painful to read or write: https://soshace.com/building-web-apps-with-vue-3-composition-api-typescript-vuex4-0/ Anyone got objections or observations about this approach before I really jump in? :) |
Beta Was this translation helpful? Give feedback.
-
@armenr hey there, just pointing out we just merged the suggested setup to have typed Vuex 4 stores: #8712 (comment) |
Beta Was this translation helpful? Give feedback.
-
Hi folks! Long-time lurker, first-time question ask-er, here...so I hope I'm posting the right thing in the right place! :)
I'm trying to get "vuex-module-decorators" set up with my brand-new Quasar project (everything is vanilla, as per boilerplate). I was compelled to do so after reading THIS wonderful article: The state of Typed Vuex
The project was generated from the beta branch of the CLI beta -->
quasar create <folder_name> --branch next
Create options:
I have also installed the recommended VSCode Settings + VSCode extensions suggested SPECIFICALLY for using "Standard" instead of Prettier, and have those saved as workspace settings. I've disabled all other VSCode extensions that have to do with linting, formatting, etc.
To that end, let me kick off by sharing my
quasar info
output:So, I've got a few questions:
Now on to the big question:
I found the following article from November 15, 2020: Quasar Framework With TypeScript AKA "Clean Quasar TypeScript"
So, when I follow the very first step and change my /src/store/index.ts file to:
VSCode immediately begins to show "Property 'Vue' does not exist on type '{}'.ts(2339)" <--- /src/store/index.ts
From there, if you follow this dude's implementation, EVERYTHING breaks. :)
Could anyone possibly advise on the correct way to implement this "dynamic" modules pattern + module-decorators in the Quasar-friendly way? If not, is there any reference for how to achieve the equivalent through the provided/templated/boilerplate Quasar app that I've generated?
Sorry for sounding like a newb. I'm happy to donate or buy someone a cup of coffee if they're willing to spend their time helping me :)
Thank you for EVERYTHING you've poured into this framework. It's GREAT!
Beta Was this translation helpful? Give feedback.
All reactions