Skip to content

createInstance

@tsed/core

Usage ​

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

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

Overview ​

ts
function createInstance(obj: any): any;

Description ​

Creates a lightweight object instance that inherits from the provided value's prototype.

If the input is a class or instance whose constructor is not Object, this function returns Object.create(obj) to preserve the prototype chain without invoking the constructor. Otherwise, it returns a plain empty object.

Released under the MIT License.