-
Notifications
You must be signed in to change notification settings - Fork 518
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
Using plainToClassFromExist
on classes with properties of type Uint8Array
leads to data loss - the properties in the resulting class contain empty arrays.
Minimal code-snippet showcasing the problem
import { plainToClassFromExist, Type } from 'class-transformer';
class SomeClass {
@Type(() => Uint8Array)
public arr: Uint8Array;
}
const raw: SomeClass = {
arr: new Uint8Array([1, 2, 3]),
};
console.log(raw, plainToClassFromExist(SomeClass, raw));
Expected behavior
{ arr: Uint8Array(3) [ 1, 2, 3 ] } [class SomeClass] { arr: Uint8Array(3) [ 1, 2, 3 ] }
Actual behavior
{ arr: Uint8Array(3) [ 1, 2, 3 ] } [class SomeClass] { arr: Uint8Array(0) [] }
^ data being lost
takakikasuga
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.