Home > @poq/transform > Transformer > toType
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;
| 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.