@@ -118,3 +118,44 @@ export function test_types_deep_strict_merge_nested_date() {
118118 type Answer = Equal < Question , { a : { createdAt : Date ; b : number ; updatedAt : Date ; c : string } } > ;
119119 ok ( typia . random < Answer > ( ) ) ;
120120}
121+
122+ /**
123+ * Tests that a Source-only key with a Date value is taken directly from Source.
124+ * This proves the dead-code branch (re-checking `key extends keyof Target`) was unreachable:
125+ * if `key` is only in Source, the result must be `Source[key]` regardless of type.
126+ */
127+ export function test_types_deep_strict_merge_source_only_date ( ) {
128+ type Question = DeepStrictMerge < { a : number } , { createdAt : Date } > ;
129+ type Answer = Equal < Question , { a : number ; createdAt : Date } > ;
130+ ok ( typia . random < Answer > ( ) ) ;
131+ }
132+
133+ /**
134+ * Tests that a Source-only key with a nested object value is taken directly from Source.
135+ * The dead code attempted to recursively merge Source[key] with Target[key],
136+ * but Target[key] doesn't exist for Source-only keys.
137+ */
138+ export function test_types_deep_strict_merge_source_only_nested_object ( ) {
139+ type Question = DeepStrictMerge < { a : number } , { b : { c : string ; d : boolean } } > ;
140+ type Answer = Equal < Question , { a : number ; b : { c : string ; d : boolean } } > ;
141+ ok ( typia . random < Answer > ( ) ) ;
142+ }
143+
144+ /**
145+ * Tests that a Source-only key with an array-of-objects value is taken directly from Source.
146+ * The dead code attempted to merge array elements, but that's impossible for Source-only keys.
147+ */
148+ export function test_types_deep_strict_merge_source_only_array_of_objects ( ) {
149+ type Question = DeepStrictMerge < { a : number } , { items : { id : number ; name : string } [ ] } > ;
150+ type Answer = Equal < Question , { a : number ; items : { id : number ; name : string } [ ] } > ;
151+ ok ( typia . random < Answer > ( ) ) ;
152+ }
153+
154+ /**
155+ * Tests that a Source-only key with a deeply nested object is taken as-is from Source.
156+ */
157+ export function test_types_deep_strict_merge_source_only_deeply_nested_object ( ) {
158+ type Question = DeepStrictMerge < { x : number } , { y : { z : { w : string ; v : Date } } } > ;
159+ type Answer = Equal < Question , { x : number ; y : { z : { w : string ; v : Date } } } > ;
160+ ok ( typia . random < Answer > ( ) ) ;
161+ }
0 commit comments