Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module inheritance #13

Closed
danieleades opened this issue Apr 25, 2019 · 3 comments
Closed

module inheritance #13

danieleades opened this issue Apr 25, 2019 · 3 comments

Comments

@danieleades
Copy link

is it possible to use inheritance to reuse common logic between modules using this package?

@gertqin
Copy link
Owner

gertqin commented Apr 29, 2019

Hmm, I haven't tried it, but I think the following should work (not tested)

class BaseModule extends VuexModule {
  someHelperFunction(a: number) {
    // ...
  }
}

@Module
class Module1 extends BaseModule {
  // can call this.someHelperFunction
}

@Module
class Module2 extends BaseModule {
  // can call this.someHelperFunction
}

But I dont think you can use the @Module decorator on the BaseModule.

Is this what you are looking for? Feel free to try it out, and if it doesn't work, let me know.

@gertqin
Copy link
Owner

gertqin commented May 25, 2019

Closing for now, feel free to reopen if you find some problems with inheritance.

@gertqin gertqin closed this as completed May 25, 2019
@jo0ger
Copy link

jo0ger commented May 31, 2019

@gertqin hi
Getters in the BaseModule do not work

class BaseModule extends VuexModule {
  get fullName () {/ ** /}
}

@Module
class ChildModule extends BaseModule {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants