UNPKG

trade360-nodejs-sdk

Version:

LSports Trade360 SDK for Node.js

28 lines (27 loc) 1.3 kB
import { ClassConstructor } from 'class-transformer'; import { BaseEntity } from '../entities/core-entities/index.js'; export declare class TransformerUtil { /** * Deserialize a plain object to an instance of the * specified class. * @param plainObject The plain object to deserialize * @param targetClass The class to instantiate with the * properties set according to the plain object provided * @returns An instance of the specified class, TEntity, * with the properties set according to the plain object * provided */ static transform<TEntity extends BaseEntity>(plainObject: BaseEntity, targetClass: ClassConstructor<TEntity>): TEntity; /** * Deserialize an array of plain objects to an array of * instances of the specified class. * @param plainArray The array of plain objects to * deserialize * @param targetClass The class to instantiate with the * properties set according to the plain objects provided * @returns An array of instances of the specified class, * TEntity, with the properties set according to the plain * objects provided */ static transformArray<TEntity extends BaseEntity>(plainArray: Record<string, unknown>[], targetClass: new () => TEntity): TEntity[]; }