-
Notifications
You must be signed in to change notification settings - Fork 520
Open
Labels
status: needs triageIssues which needs to be reproduced to be verified report.Issues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.Issues describing a broken feature.
Description
Description
When converting from plain to class on an plain object that already has a Set the target property that is also a Set is converted to Array.
class User {
id: number;
name: string;
@Type(() => Set)
weapons: Set<string>;
}
const plainUser = {
id: 1,
name: 'Max Pain',
weapons: new Set(['knife', 'eagle', 'ak-47']),
};
const classedUser = plainToInstance(User, plainUser);
expect(classedUser.weapons).toBeInstanceOf(Set); <~~~ fails here
Expected behavior
If the target is of type Set and source already is a Set should return a Set.
Actual behavior
It converts the target property of the class to Array.
Metadata
Metadata
Assignees
Labels
status: needs triageIssues which needs to be reproduced to be verified report.Issues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.Issues describing a broken feature.