InstantiableClass: new (...args: any[]) => T

Utility type for writing types for classes more concisely.

function createInstance<T>(aClass: InstantiableClass<T>): T {
return new aClass();
}
const instance: RegExp = createInstance(RegExp);

If the class may be abstract, you must use Class.

Type Parameters

  • T