Skip to content

Commit 9a63b36

Browse files
committed
fix: #143 Use custom transform on CLASS_TO_PLAIN
1 parent 36d72f7 commit 9a63b36

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/TransformOperationExecutor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,15 @@ export class TransformOperationExecutor {
168168

169169
if (this.transformationType === TransformationType.CLASS_TO_PLAIN) {
170170
finalValue = value[transformKey];
171+
finalValue = this.applyCustomTransformations(finalValue, targetType, transformKey, value, this.transformationType);
172+
finalValue = (value[transformKey] === finalValue) ? subValue : finalValue;
173+
// value[transformKey] = finalValue;
174+
finalValue = this.transform(subSource, finalValue, type, arrayType, isSubValueMap, level + 1);
171175
} else {
172176
finalValue = this.transform(subSource, subValue, type, arrayType, isSubValueMap, level + 1);
177+
finalValue = this.applyCustomTransformations(finalValue, targetType, transformKey, value, this.transformationType);
173178
}
174-
175-
finalValue = this.applyCustomTransformations(finalValue, targetType, transformKey, value, this.transformationType);
179+
176180
if (newValue instanceof Map) {
177181
newValue.set(newValueKey, finalValue);
178182
} else {

0 commit comments

Comments
 (0)