This is the official plugin from @automapper
to work with TS/ES6 Class
npm i @automapper/classes
or with yarn
:
yarn add @automapper/classes
@automapper/classes
depends on @automapper/core
, @automapper/types
, and reflect-metadata
.
npm i @automapper/core reflect-metadata
npm i --save-dev @automapper/types
or with yarn
:
yarn add @automapper/core reflect-metadata
yarn add --dev @automapper/types
@automapper/classes
provides classes
as a MapPluginInitializer
. Pass classes
to createMapper
to create
a Mapper
that uses classes
plugin.
import { classes } from '@automapper/classes';
const mapper = createMapper({
...,
pluginInitializer: classes
})
mapper.createMap(User, UserVm);
mapper.map(user, UserVm, User);
Read more about this plugin on classes documentation