getConstructor
@tsed/core
Usage
typescript
import { getConstructor } from "@tsed/core";Overview
ts
function getConstructor(target: any): Type<any>;- target (
any): A class constructor or an instance.
Description
Get the class constructor from a class or an instance.
If target is already a constructor, it is returned as-is; otherwise the constructor of the instance is returned.
ts
class A {}
getConstructor(A) === A; // true
getConstructor(new A()) === A; // true