kadet1090 / vuex-typings

Strongly typed vuex
6 stars 2 forks source link

Simple working example #4

Open Grawl opened 3 years ago

Grawl commented 3 years ago

In your comment on #2 you pointed on repository where your Vuex typings is developed, but that project is not using vuex-typings as dependency.

I tried to install kadet1090/vuex-typings and use this typings with Quasar 2 but has no luck (maybe because I am newbie for TypeScript).

It would be very helpful if you will create demo project named like vuex-typings-demo with simple and full integration of Vuex typings.

kadet1090 commented 3 years ago

As it is stated in the README: https://github.com/kadet1090/vuex-typings#can-i-use-it-in-my-project:

For now I consider this project as proof of concept that have to be further validated and polished as it have some quirks that makes this project unnecessarily cumbersome to use. Because of that there is no easy to use way - you can however use computer-generated vuex.d.ts file.

As this typings are not compatible with official ones you must provide full path to this file in the tsconfig.json file like so:

{
 "compilerOptions": {
   ...
   "paths": {
     "vuex": ["path/to/vuex.d.ts"]
   }
 },
 ...
}

To enable Vuex integration with Vue you should also copy vue.d.ts file and reference it using the triple slash directive:

/// <reference path="path/to/vue.d.ts" />

This is by design - I think that in this state this project is more dedicated towards more advanced users of typescript, who would be able to fix little bugs in types on their own if needed. That's why I only provide computer generated file with all types that can be copied into other projects - and thus maintained inside the project. And this is exactly what I did in projected mentioned in #2.

I should find some time soon to finish missing pieces for this types and hopefully try to upstream it, and if this fails I'll create separate npm package with proper installation instructions and example project. For now I could recommend using this types only if you are not afraid of fixing typing bugs on your own.

Grawl commented 3 years ago

Thank you for patience.

If I understand things right, there is no way how I can use Vuex with TypeScript