@@ -210,8 +210,22 @@ export class TransformOperationExecutor {
210
210
211
211
if ( ! this . options . enableCircularCheck || ! this . isCircular ( subValue , level ) ) {
212
212
let transformKey = this . transformationType === TransformationType . PLAIN_TO_CLASS ? newValueKey : key ;
213
- let finalValue = this . transform ( subSource , subValue , type , arrayType , isSubValueMap , level + 1 ) ;
214
- finalValue = this . applyCustomTransformations ( finalValue , ( targetType as Function ) , transformKey , value , this . transformationType ) ;
213
+ let finalValue ;
214
+
215
+ if ( this . transformationType === TransformationType . CLASS_TO_PLAIN ) {
216
+ // Get original value
217
+ finalValue = value [ transformKey ] ;
218
+ // Apply custom transformation
219
+ finalValue = this . applyCustomTransformations ( finalValue , targetType , transformKey , value , this . transformationType ) ;
220
+ // If nothing change, it means no custom transformation was applied, so use the subValue.
221
+ finalValue = ( value [ transformKey ] === finalValue ) ? subValue : finalValue ;
222
+ // Apply the default transformation
223
+ finalValue = this . transform ( subSource , finalValue , type , arrayType , isSubValueMap , level + 1 ) ;
224
+ } else {
225
+ finalValue = this . transform ( subSource , subValue , type , arrayType , isSubValueMap , level + 1 ) ;
226
+ finalValue = this . applyCustomTransformations ( finalValue , targetType , transformKey , value , this . transformationType ) ;
227
+ }
228
+
215
229
if ( newValue instanceof Map ) {
216
230
newValue . set ( newValueKey , finalValue ) ;
217
231
} else {
0 commit comments