Skip to content

Commit 36d72f7

Browse files
authored
fix: #143 Use custom transform on CLASS_TO_PLAIN
1 parent c3d0030 commit 36d72f7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/TransformOperationExecutor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,14 @@ export class TransformOperationExecutor {
164164

165165
if (!this.options.enableCircularCheck || !this.isCircular(subValue, level)) {
166166
let transformKey = this.transformationType === TransformationType.PLAIN_TO_CLASS ? newValueKey : key;
167-
let finalValue = this.transform(subSource, subValue, type, arrayType, isSubValueMap, level + 1);
167+
let finalValue;
168+
169+
if (this.transformationType === TransformationType.CLASS_TO_PLAIN) {
170+
finalValue = value[transformKey];
171+
} else {
172+
finalValue = this.transform(subSource, subValue, type, arrayType, isSubValueMap, level + 1);
173+
}
174+
168175
finalValue = this.applyCustomTransformations(finalValue, targetType, transformKey, value, this.transformationType);
169176
if (newValue instanceof Map) {
170177
newValue.set(newValueKey, finalValue);

0 commit comments

Comments
 (0)