One of the challenges I'm facing is creating an instance of an abstract class within one of its functions. When using new this()
in inherited classes, a new instance of the child class is created rather than the abstract class.
Typescript throws errors when trying to create a new instance with new this()
because it technically attempts to instantiate the abstract class (if directly used).
Is there a way to ignore this error only for that specific line, without affecting all instances of abstract classes?
If I remove the abstract
keyword from the class definition, Typescript stops raising issues and the code functions as expected. The problem here lies in satisfying Typescript's strict rules.