Skip to content

getClass

@tsed/core

Usage

typescript
import { getClass } from "@tsed/core";

See /packages/core/src/utils/classOf.ts.

Overview

ts
function getClass(target: any): any;
  • target (any): Instance or constructor.

Description

Returns the constructor of a target. If target is already a class (constructor function), it is returned as is; if it is an instance, its constructor is returned.

ts
class A {}
getClass(A) === A; // true
getClass(new A()) === A; // true

Released under the MIT License.