No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Class constructor Positions cannot be invoked without 'new'

    Help
    3
    5
    3597
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y
      yosa last edited by yosa

      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.

      1 Reply Last reply Reply Quote 0
      • Hawkeye64
        Hawkeye64 last edited by

        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-invo

        Hope that helps.

        1 Reply Last reply Reply Quote 0
        • Y
          yosa last edited by

          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

          1 Reply Last reply Reply Quote 0
          • Hawkeye64
            Hawkeye64 last edited by

            maybe try:

            const pos = new Positions()
            export default pos
            

            also, remove the space here: Positions () and try Positions() to see if that makes a difference

            1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman last edited by

              export default class ... doesn’t work?

              1 Reply Last reply Reply Quote 0
              • First post
                Last post