-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Hi,
It seems that mapping arrays using the automapper-ts library doesn't work for me.
Let's take this simple example. I have an interface called UserData and a class called User and I'm trying to map UserData to User.
export interface UserData {
username: string;
myList: number[];
}
export class User {
username: string = '';
myList: number[] = [];
}
In appcomponent (I am working with angular 6) I have the following setup:
export class AppComponent {
user: User;
const userData: UserData = {
username: 'johndoe',
myList: [1,2,3]
}
automapper
.createMap('user-data', 'user')
.convertToType(User);
this.user = automapper.map('UserData', 'User', userData);
console.log('UserData', userData);
console.log('User', this.user);
}
As you can see, for User I cannot see/access myList elements, they are not populated.
I didn't find any similar issue reported and as I noticed none of the automapper-ts tests do not cover this case.
Do you have any suggestions?
Thank you,
Camelia
