Impossible to extend module, class
See original GitHub issue
export default abstract class AbstractForm extends VuexModule implements IAbstractForm {
_fields = {};
get fields(): { [key: string]: string } {
return this._fields;
}
...
@Module({namespaced: true})
export default class SearchForm extends AbstractForm implements ISearchForm {
/** @override **/
_fields = {
searchValue: ''
};
@Template
@Component<SearchForm>
export default class SearchForm extends Vue implements ISearchForm, IAbstractForm {
@namespace(searchFormNamespace).Getter
fields!: any;
mounted() {
console.log(this.fields);
}
error
[vuex] unknown getter: FORMS/FORM_SEARCH/fields
Extended only .State, but actions and getters, mutations not shared, extended
If we declare @Module for child class, child does not inherit methods from parent class. If we declare modules for both classes, child and parent, child class has no it is state fields, but we have both classes methods 😕
We need a way to extend modules or some way to share common features across classes. Writing duplicated code for every module is to heavy to maintain.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
ruby - How to extend a module on a class dynamically?
I have added the name of the module and passing that to the constructor of the object but complains with the code. class...
Read more >Document that extending/implementing classes can not be ...
Even if you have a dependency on a module, it's possible that both your module and the dependency are disabled when your .module...
Read more >Extend external modules declared in @types npm dependency
How do we extend the class defintion of a module?
Read more >How to Use Inheritance to Extend Classes and Modules in ...
Because it's kinda powerful, here's a quick tutorial on using Inheritance with Python to extend classes and modules. In the second half of ......
Read more >Ruby Tidbit: Include vs Extend with Module Class Variables
Still, you will at some point find yourself using them, so it's good to understand as much as possible about their behavior. Since...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I strongly suggest to remove this package and never use it, because it can not be extended without core modification. Tried TS extend, implement, mixins (2 ways, copy with prototyping and extending constructor with decorator), decorators, state factory, dynamic loading.
Maybe, it is awesome if you have 1-2 states, bur reality is, we have more then 25+ modules, most of projects also require extending or share common functionalities. Seems impossible to do without some tricky stuff or messing a lot.
I lost a lot of time, because most of Vue + TS shitty guides use this package. Seems like everyone except me works with small projects with 1-2 pages or do not want to share their tricks with community. I will have now to redo vuex to old way I used before.
Guess i learned a lesson from this aswell, never use a package without seeing the open issues first.
I started to use this in my work, seemed fine until i had to work with inheritance, getters not working, state not getting properly mapped and now i found a bug with namespaced modules, this package is a unmaintained waste of time.
The author knows inheritance is broken and doesnt even mention it in the docs, tricking us to waste time with this package until we inevitably drop it