Skip to main content

Installation

Core

Install the core module via npm or yarn along with at least one strategy:

npm i @automapper/core @automapper/classes reflect-metadata # for classes
npm i @automapper/core @automapper/pojos # for pojos
yarn add @automapper/core @automapper/classes reflect-metadata # for classes
yarn add @automapper/core @automapper/pojos # for pojos

tsconfig

You need to adjust several tsconfig options to use some particular strategy.

{
"skipLibCheck": true, // if your TS is lower than 4.0
"experimentalDecorators": true, // for @automapper/classes
"emitDecoratorMetadata": true // for @automapper/classes
}

ORMs

If you are using an ORM, AutoMapper TypeScript provides support for Sequelize and MikroORM. Both work with @automapper/classes

npm i @automapper/core @automapper/classes reflect-metadata @automapper/mikro # for mikro-orm
npm i @automapper/core @automapper/classes reflect-metadata @automapper/sequelize # for sequelize
yarn add @automapper/core @automapper/classes reflect-metadata @automapper/mikro # for mikro-orm
yarn add @automapper/core @automapper/classes reflect-metadata @automapper/sequelize # for sequelize

NestJS

AutoMapper TypeScript provides official integration with NestJS

npm i @automapper/core @automapper/nestjs @automapper/classes reflect-metadata # for classes
npm i @automapper/core @automapper/nestjs @automapper/classes reflect-metadata @automapper/mikro # for classes + mikro-orm
npm i @automapper/core @automapper/nestjs @automapper/classes reflect-metadata @automapper/sequelize # for classes + sequelize
npm i @automapper/core @automapper/nestjs @automapper/pojos # for pojos
yarn add @automapper/core @automapper/nestjs @automapper/classes reflect-metadata # for classes
yarn add @automapper/core @automapper/nestjs @automapper/classes reflect-metadata @automapper/mikro # for classes + mikro-orm
yarn add @automapper/core @automapper/nestjs @automapper/classes reflect-metadata @automapper/sequelize # for classes + sequelize
yarn add @automapper/core @automapper/nestjs @automapper/pojos # for pojos