Poq.SDK.Node

Home > @poq/transform > Transformer > toType

Transformer.toType() method

Method transforms plain javascript object into instance of type defined by constructor of class.

Signature:

static toType<T>(plainObj: PlainObj, ctor: Ctor<T>, options?: TransformOptions): T;

Parameters

Parameter Type Description
plainObj PlainObj Defines javascript object to transform into instance of specific type.
ctor Ctor<T> Defines class/type constructor.
options TransformOptions (Optional)

Returns:

T

Instance of class/type.