How can I use a constructor in a module?
See original GitHub issueI need to do some initialization work whenever the module is constructed. But when I add the super(); call, it expects a module parameter. What should I pass in there?
@Module
export default class RealTime extends VuexModule {
private playersOnline!: [];
constructor() {
super();
}
get getPlayersOnline() {
return this.playersOnline;
}
};
constructor VuexModule<ThisType<any>, any>(module: Module<ThisType<any>, any>): VuexModule<ThisType<any>, any> Expected 1 arguments, but got 0.ts(2554) vuexmodule.d.ts(16, 17): An argument for ‘module’ was not provided.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Node.js - use of module.exports as a constructor
CommonJS modules allow two ways to define exported properties. In either case you are returning an Object/Function.
Read more >constructor - JavaScript - MDN Web Docs - Mozilla
The constructor method is a special method of a class for creating and initializing an object instance of that class.
Read more >Javascript module pattern with constructor with arguments
The constructor is defined as it is usually done in Javascript. The module pattern has been used in the prototype implementation, where we...
Read more >How to export default constructors ? - GeeksforGeeks
The export statement is used to bind one JavaScript module to others. In order to export the default constructor, we use an export...
Read more >Classes and Modules | Advanced JavaScript
In this example, we created a subclass that extended our House class. The Mansion subclass has a defined constructor, so we must call...
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
Modules are not supposed to be constructed. Use getModule() to fetch a module object.
On Mon 18 Mar, 2019, 1:13 AM Magnus Johansson, notifications@github.com wrote:
This prevents me from using DI (inversify.js) with modules.