import { DeepOmit } from "../lib" ; import { complexNestedRequired , complexNestedUndefined } from "./const" ; import { TsVersion } from "./ts-version" ; import { ComplexNestedPartial , ComplexNestedRequired } from "./types" ; function testDeepOmitInRequiredObject ( ) { let obj1 ; obj1 = complexNestedRequired ; obj1 = { simple : complexNestedRequired . simple } ; let obj2 ; obj2 = { } ; obj2 = { nested : undefined } ; obj2 = { nested : complexNestedUndefined . nested , } ; obj2 = { nested : complexNestedRequired . nested } ; let obj2_1 ; obj2_1 = { } ; obj2_1 = { nested : undefined } ; obj2_1 = { nested : complexNestedUndefined . nested , } ; obj2_1 = { nested : complexNestedRequired . nested } ; { const { nested : { date , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj3 ; obj3 = { } ; obj3 = { simple : undefined } ; obj3 = { nested : undefined } ; obj3 = { simple : undefined , nested : undefined } ; obj3 = { simple : undefined , nested : complexNestedRequiredNested } ; obj3 = { simple : complexNestedRequired . simple , nested : undefined } ; obj3 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { date , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj3_1 ; obj3_1 = { } ; obj3_1 = { simple : undefined } ; obj3_1 = { nested : undefined } ; obj3_1 = { simple : undefined , nested : undefined } ; obj3_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj3_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj3_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { func , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj4 ; obj4 = { } ; obj4 = { simple : undefined } ; obj4 = { nested : undefined } ; obj4 = { simple : undefined , nested : undefined } ; obj4 = { simple : undefined , nested : complexNestedRequiredNested } ; obj4 = { simple : complexNestedRequired . simple , nested : undefined } ; obj4 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { func , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj4_1 ; obj4_1 = { } ; obj4_1 = { simple : undefined } ; obj4_1 = { nested : undefined } ; obj4_1 = { simple : undefined , nested : undefined } ; obj4_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj4_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj4_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj5 ; obj5 = { } ; obj5 = { simple : undefined } ; obj5 = { nested : undefined } ; obj5 = { simple : undefined , nested : undefined } ; obj5 = { simple : undefined , nested : complexNestedRequiredNested } ; obj5 = { simple : complexNestedRequired . simple , nested : undefined } ; obj5 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj5_1 ; obj5_1 = { } ; obj5_1 = { simple : undefined } ; obj5_1 = { nested : undefined } ; obj5_1 = { simple : undefined , nested : undefined } ; obj5_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj5_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj5_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { tuple , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj6 ; obj6 = { } ; obj6 = { simple : undefined } ; obj6 = { nested : undefined } ; obj6 = { simple : undefined , nested : undefined } ; obj6 = { simple : undefined , nested : complexNestedRequiredNested } ; obj6 = { simple : complexNestedRequired . simple , nested : undefined } ; obj6 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { tuple , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj6_1 ; obj6_1 = { } ; obj6_1 = { simple : undefined } ; obj6_1 = { nested : undefined } ; obj6_1 = { simple : undefined , nested : undefined } ; obj6_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj6_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj6_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { set , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj7 ; obj7 = { } ; obj7 = { simple : undefined } ; obj7 = { nested : undefined } ; obj7 = { simple : undefined , nested : undefined } ; obj7 = { simple : undefined , nested : complexNestedRequiredNested } ; obj7 = { simple : complexNestedRequired . simple , nested : undefined } ; obj7 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { set , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj7_1 ; obj7_1 = { } ; obj7_1 = { simple : undefined } ; obj7_1 = { nested : undefined } ; obj7_1 = { simple : undefined , nested : undefined } ; obj7_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj7_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj7_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { map , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj8 ; obj8 = { } ; obj8 = { simple : undefined } ; obj8 = { nested : undefined } ; obj8 = { simple : undefined , nested : undefined } ; obj8 = { simple : undefined , nested : complexNestedRequiredNested } ; obj8 = { simple : complexNestedRequired . simple , nested : undefined } ; obj8 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { map , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj8_1 ; obj8_1 = { } ; obj8_1 = { simple : undefined } ; obj8_1 = { nested : undefined } ; obj8_1 = { simple : undefined , nested : undefined } ; obj8_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj8_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj8_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { promise , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj9 ; obj9 = { } ; obj9 = { simple : undefined } ; obj9 = { nested : undefined } ; obj9 = { simple : undefined , nested : undefined } ; obj9 = { simple : undefined , nested : complexNestedRequiredNested } ; obj9 = { simple : complexNestedRequired . simple , nested : undefined } ; obj9 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { promise , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj9_1 ; obj9_1 = { } ; obj9_1 = { simple : undefined } ; obj9_1 = { nested : undefined } ; obj9_1 = { simple : undefined , nested : undefined } ; obj9_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj9_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj9_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { date , array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj10 ; obj10 = { } ; obj10 = { simple : undefined } ; obj10 = { nested : undefined } ; obj10 = { simple : undefined , nested : undefined } ; obj10 = { simple : undefined , nested : complexNestedRequiredNested } ; obj10 = { simple : complexNestedRequired . simple , nested : undefined } ; obj10 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } } function testDeepOmitInPartialObject ( ) { let obj1 ; obj1 = complexNestedRequired ; obj1 = { simple : complexNestedRequired . simple } ; let obj2 ; obj2 = { } ; obj2 = { nested : undefined } ; obj2 = { nested : complexNestedUndefined . nested , } ; obj2 = { nested : complexNestedRequired . nested } ; let obj2_1 ; obj2_1 = { } ; obj2_1 = { nested : undefined } ; obj2_1 = { nested : complexNestedUndefined . nested , } ; obj2_1 = { nested : complexNestedRequired . nested } ; { const { nested : { date , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj3 ; obj3 = { } ; obj3 = { simple : undefined } ; obj3 = { nested : undefined } ; obj3 = { simple : undefined , nested : undefined } ; obj3 = { simple : undefined , nested : complexNestedRequiredNested } ; obj3 = { simple : complexNestedRequired . simple , nested : undefined } ; obj3 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { date , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj3_1 ; obj3_1 = { } ; obj3_1 = { simple : undefined } ; obj3_1 = { nested : undefined } ; obj3_1 = { simple : undefined , nested : undefined } ; obj3_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj3_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj3_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { func , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj4 ; obj4 = { } ; obj4 = { simple : undefined } ; obj4 = { nested : undefined } ; obj4 = { simple : undefined , nested : undefined } ; obj4 = { simple : undefined , nested : complexNestedRequiredNested } ; obj4 = { simple : complexNestedRequired . simple , nested : undefined } ; obj4 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { func , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj4_1 ; obj4_1 = { } ; obj4_1 = { simple : undefined } ; obj4_1 = { nested : undefined } ; obj4_1 = { simple : undefined , nested : undefined } ; obj4_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj4_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj4_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj5 ; obj5 = { } ; obj5 = { simple : undefined } ; obj5 = { nested : undefined } ; obj5 = { simple : undefined , nested : undefined } ; obj5 = { simple : undefined , nested : complexNestedRequiredNested } ; obj5 = { simple : complexNestedRequired . simple , nested : undefined } ; obj5 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj5_1 ; obj5_1 = { } ; obj5_1 = { simple : undefined } ; obj5_1 = { nested : undefined } ; obj5_1 = { simple : undefined , nested : undefined } ; obj5_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj5_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj5_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { tuple , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj6 ; obj6 = { } ; obj6 = { simple : undefined } ; obj6 = { nested : undefined } ; obj6 = { simple : undefined , nested : undefined } ; obj6 = { simple : undefined , nested : complexNestedRequiredNested } ; obj6 = { simple : complexNestedRequired . simple , nested : undefined } ; obj6 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { tuple , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj6_1 ; obj6_1 = { } ; obj6_1 = { simple : undefined } ; obj6_1 = { nested : undefined } ; obj6_1 = { simple : undefined , nested : undefined } ; obj6_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj6_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj6_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { set , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj7 ; obj7 = { } ; obj7 = { simple : undefined } ; obj7 = { nested : undefined } ; obj7 = { simple : undefined , nested : undefined } ; obj7 = { simple : undefined , nested : complexNestedRequiredNested } ; obj7 = { simple : complexNestedRequired . simple , nested : undefined } ; obj7 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { set , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj7_1 ; obj7_1 = { } ; obj7_1 = { simple : undefined } ; obj7_1 = { nested : undefined } ; obj7_1 = { simple : undefined , nested : undefined } ; obj7_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj7_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj7_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { map , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj8 ; obj8 = { } ; obj8 = { simple : undefined } ; obj8 = { nested : undefined } ; obj8 = { simple : undefined , nested : undefined } ; obj8 = { simple : undefined , nested : complexNestedRequiredNested } ; obj8 = { simple : complexNestedRequired . simple , nested : undefined } ; obj8 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { map , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj8_1 ; obj8_1 = { } ; obj8_1 = { simple : undefined } ; obj8_1 = { nested : undefined } ; obj8_1 = { simple : undefined , nested : undefined } ; obj8_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj8_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj8_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { promise , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj9 ; obj9 = { } ; obj9 = { simple : undefined } ; obj9 = { nested : undefined } ; obj9 = { simple : undefined , nested : undefined } ; obj9 = { simple : undefined , nested : complexNestedRequiredNested } ; obj9 = { simple : complexNestedRequired . simple , nested : undefined } ; obj9 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { promise , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj9_1 ; obj9_1 = { } ; obj9_1 = { simple : undefined } ; obj9_1 = { nested : undefined } ; obj9_1 = { simple : undefined , nested : undefined } ; obj9_1 = { simple : undefined , nested : complexNestedRequiredNested } ; obj9_1 = { simple : complexNestedRequired . simple , nested : undefined } ; obj9_1 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { const { nested : { date , array , ... complexNestedRequiredNested } , } = complexNestedRequired ; let obj10 ; obj10 = { } ; obj10 = { simple : undefined } ; obj10 = { nested : undefined } ; obj10 = { simple : undefined , nested : undefined } ; obj10 = { simple : undefined , nested : complexNestedRequiredNested } ; obj10 = { simple : complexNestedRequired . simple , nested : undefined } ; obj10 = { simple : complexNestedRequired . simple , nested : complexNestedRequiredNested } ; } { type MapType = Map < string , { name : string ; age : number ; } > ; let map ; } { type MapType = Map < string , { name : string ; age : number ; } > ; let map ; map = new Map < string , { age : number ; } > ( ) ; map = new Map < string , { name : string ; } > ( ) ; map = new Map < string , { name : string ; age : number ; } > ( ) ; map = new Map < number , { } > ( ) ; map . set ( "key" , { age : 1 } ) ; } { type MapType = ReadonlyMap < string , { name : string ; age : number ; } > ; let map ; } { type MapType = ReadonlyMap < string , { name : string ; age : number ; } > ; let map ; map = new Map < string , { age : number ; } > ( ) ; map = new Map < string , { name : string ; } > ( ) ; map = new Map < string , { name : string ; age : number ; } > ( ) ; map = new Map < number , { } > ( ) ; map . set ( "key" , { age : 1 } ) ; } { type MapType = WeakMap < { a : string ; } , { name : string ; age : number ; } > ; let map ; } { type MapType = WeakMap < { a : string ; } , { name : string ; age : number ; } > ; let map ; map = new WeakMap < { a : string ; } , { age : number ; } > ( ) ; map = new Map < { a : string ; } , { name : string ; } > ( ) ; map = new Map < { a : string ; } , { name : string ; age : number ; } > ( ) ; map = new Map < { a : number ; } , { } > ( ) ; map . set ( { a : "key" } , { age : 1 } ) ; } { type SetType = Set < { name : string ; age : number ; } > ; let set ; set = new Set < { age : number ; } > ( ) ; set = new Set < { name : string ; } > ( ) ; set = new Set < { name : string ; age : number ; } > ( ) ; set = new Set < { } > ( ) ; set . add ( { age : 1 } ) ; } { type ReadonlySetType = ReadonlySet < { name : string ; age : number ; } > ; let set ; set = new Set < { age : number ; } > ( ) ; set = new Set < { name : string ; } > ( ) ; set = new Set < { name : string ; age : number ; } > ( ) ; set = new Set < { } > ( ) ; set . add ( { age : 1 } ) ; } { type WeakSetType = WeakSet < { name : string ; age : number ; } > ; let set ; set = new WeakSet < { age : number ; } > ( ) ; set = new WeakSet < { name : string ; } > ( ) ; set = new WeakSet < { name : string ; age : number ; } > ( ) ; set = new WeakSet < { } > ( ) ; set . add ( { age : 1 } ) ; } { type ArrayType = Array < { name : string ; age : number ; } > ; let arr ; arr = new Array < { age : number ; } > ( ) ; arr = new Array < { name : string ; } > ( ) ; arr = new Array < { name : string ; age : number ; } > ( ) ; arr = new Array < { } > ( ) ; arr . push ( { age : 1 } ) ; } { type PromiseType = Promise < { name : string ; age : number ; } > ; let promise ; promise = new Promise < { age : number ; } > ( ( ) => { } ) ; promise = new Promise < { name : string ; } > ( ( ) => { } ) ; promise = new Promise < { name : string ; age : number ; } > ( ( ) => { } ) ; promise = new Promise < { } > ( ( ) => { } ) ; } }