Class constructor Positions cannot be invoked without 'new'
-
I am trying to create an instance of one class that extends from another.
Within the constructor of the daughter class I execute the super () method to execute the constructor of the parent class.
An example:
import StoreService from 'core / services / StoreService' import Store from 'src / store / base / positions' class Positions extends StoreService { constructor () { super (Store, 'basePositions') } } export default new Positions ()
This class to extend and make use of it is the one that throws me the error:
Class constructor Positions cannot be invoked without ‘new’.
Any suggestions? I think the problem is related to babel but I can’t find an applicable solution to the quasar project.
-
Not sure if any of these will help:
https://github.com/nestjs/nest/issues/2190
https://github.com/less/less.js/issues/3414
https://stackoverflow.com/questions/57099273/how-to-fix-error-typeerror-class-constructor-hammergestureconfig-cannot-be-invoHope that helps.
-
Hello
Check the links but I continue with the detail. The problem is caused by a simple class and I am not using typescript. I will continue investigating, thank you very much @Hawkeye64 -
maybe try:
const pos = new Positions() export default pos
also, remove the space here:
Positions ()
and tryPositions()
to see if that makes a difference -
export default class ...
doesn’t work?