@@ -170,8 +170,22 @@ export class TransformOperationExecutor {
170
170
171
171
if ( ! this . options . enableCircularCheck || ! this . isCircular ( subValue , level ) ) {
172
172
let transformKey = this . transformationType === TransformationType . PLAIN_TO_CLASS ? newValueKey : key ;
173
- let finalValue = this . transform ( subSource , subValue , type , arrayType , isSubValueMap , level + 1 ) ;
174
- finalValue = this . applyCustomTransformations ( finalValue , targetType , transformKey , value , this . transformationType ) ;
173
+ let finalValue ;
174
+
175
+ if ( this . transformationType === TransformationType . CLASS_TO_PLAIN ) {
176
+ // Get original value
177
+ finalValue = value [ transformKey ] ;
178
+ // Apply custom transformation
179
+ finalValue = this . applyCustomTransformations ( finalValue , targetType , transformKey , value , this . transformationType ) ;
180
+ // If nothing change, it means no custom transformation was applied, so use the subValue.
181
+ finalValue = ( value [ transformKey ] === finalValue ) ? subValue : finalValue ;
182
+ // Apply the default transformation
183
+ finalValue = this . transform ( subSource , finalValue , type , arrayType , isSubValueMap , level + 1 ) ;
184
+ } else {
185
+ finalValue = this . transform ( subSource , subValue , type , arrayType , isSubValueMap , level + 1 ) ;
186
+ finalValue = this . applyCustomTransformations ( finalValue , targetType , transformKey , value , this . transformationType ) ;
187
+ }
188
+
175
189
if ( newValue instanceof Map ) {
176
190
newValue . set ( newValueKey , finalValue ) ;
177
191
} else {
0 commit comments