What are abstract constructor types in TypeScript?

Answer

Abstract constructor types describe the type of an abstract class — a class that cannot be directly instantiated with new. The type for a regular class (constructable) is new (...args: any[]) => InstanceType. The type for an abstract class is abstract new (...args: any[]) => InstanceType. This distinction matters when writing mixins or higher-order class functions that need to accept abstract classes: type AbstractConstructor<T> = abstract new (...args: any[]) => T;. Mixin that works with abstract classes: function Serializable<T extends AbstractConstructor<object>>(Base: T) { abstract class Serializable extends Base { abstract serialize(): string; } return Serializable; }. Without the abstract keyword on the constructor type, passing an abstract class to a function expecting a constructable class causes a type error — because abstract classes cannot be new-d. TypeScript 4.2 added support for abstract construct signatures to properly type abstract class references.