Error AtlasError Documentation and Resolution

JavaScript class constructor was called without new

TypeError: class constructors must be invoked with 'new'

JavaScript tried to call a class constructor like a normal function instead of instantiating it with new.

TypeError: class constructors must be invoked with 'new'runtime
TypeError: class constructors must be invoked with 'new'
  • A class is being invoked like a regular function.
  • A value expected to be a factory function is actually a class.
  • A refactor changed a callable API into a class-based one.
  1. Instantiate the class with new.
  2. Check whether the imported value is a class or a factory function.
  3. Update wrappers and call sites to match the class-based API.
MDN: TypeError: class constructors must be invoked with new
JavaScript class constructors must be invoked with new | Error Atlas