Closed ndarilek closed 5 years ago
follow steps from here https://github.com/championswimmer/vuex-module-decorators#using-with-target-es5
Ack, sorry I missed that, just copied my setup from a Cordova app where it worked without issue. Thanks, had to set both the target in tsconfig.json, and transpileDependencies option in vue.config.js.
Everyone please vote here https://github.com/championswimmer/vuex-module-decorators/issues/68
Need your opinions
Hey, not sure what's going on here. I'm attempting to port a small codebase from plain JS to TypeScript, and thought I'd use this module for a typesafe store. I have it running fine in a more minimal app, so I know that it works and that I'm generally using it correctly.
Unfortunately, I get this error in my console whenever I try loading a module written using this decorator:
TypeError: class constructors must be invoked with |new| app.js:65377:31
My store has 3 submodules. This happens when I convert any one of them to use this decorator. It even happens if I convert one but clear its body so it is essentially an empty module.
I've put together an example. Sorry it isn't more minimal, but again, a minimal example doesn't seem to replicate this:
https://github.com/ndarilek/vuex-module-decorators-issue
Standard vue-cli app, so
yarn install && yarn serve
. Can probably safely ignore the lambda error, as it happens even when everything works. To swap out TS and JS implementations,cp src/store.old/player.js src/store/player.js
andrm src/store/player.ts
. With the JS module in place, things seem to work. With the TS module, I get the above error.Thanks for any help. Apologies if I've made a silly mistake--I'm learning TypeScript so I may be using decorators or its idioms incorrectly.