Skip to content

Commit 23f79c0

Browse files
author
Umed Khudoiberdiev
committed
fixed issue when object is not being transformed if setter used
1 parent 6001fae commit 23f79c0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "class-transformer",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Proper decorator-based transformation / serialization / deserialization of plain javascript objects to class constructors",
55
"license": "MIT",
66
"readmeFilename": "README.md",

src/TransformOperationExecutor.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,10 @@ export class TransformOperationExecutor {
147147
// throw new Error(`Cannot determine type for ${(targetType as any).name }.${propertyName}, did you forget to specify a @Type?`);
148148

149149
// if newValue is a source object that has method that match newKeyName then skip it
150-
let hasDescriptor = false;
151150
if (newValue.constructor.prototype) {
152151
const descriptor = Object.getOwnPropertyDescriptor(newValue.constructor.prototype, newValueKey);
153-
hasDescriptor = !!descriptor;
154-
if ((this.transformationType === "plainToClass" || this.transformationType === "classToClass") && (newValue[newValueKey] instanceof Function || descriptor)) // || operationType === "classToClass"
152+
if ((this.transformationType === "plainToClass" || this.transformationType === "classToClass")
153+
&& (newValue[newValueKey] instanceof Function || (descriptor && !descriptor.set))) // || operationType === "classToClass"
155154
continue;
156155
}
157156

0 commit comments

Comments
 (0)