This is the official plugin from @automapper
to work with Interfaces/Types along with Plain Objects
npm i @automapper/pojos
or with yarn
:
yarn add @automapper/pojos
@automapper/pojos
depends on @automapper/core
and @automapper/types
npm i @automapper/core
npm i --save-dev @automapper/types
or with yarn
:
yarn add @automapper/core
yarn add --dev @automapper/types
@automapper/pojos
provides pojos
as a MapPluginInitializer
. Pass pojos
to createMapper
to create a Mapper
that uses pojos
plugin.
import { pojos } from '@automapper/pojos';
const mapper = createMapper({
...,
pluginInitializer: pojos
})
mapper.createMap<User, UserVm>('SomeTokenForUser', 'SomeTokenForUserVm');
mapper.map<User, UserVm>(user, 'SomeTokenForUserVm', 'SomeTokenForUser');
Read more about this plugin on pojos documentation