@@ -9,54 +9,55 @@ describe("defu", () => {
99 it ( "should copy only missing properties defaults" , ( ) => {
1010 const result = defu ( { a : "c" } , { a : "bbb" , d : "c" } ) ;
1111 expect ( result ) . toEqual ( { a : "c" , d : "c" } ) ;
12- expectTypeOf ( result ) . toEqualTypeOf < { a : string ; d : string } > ( ) ;
12+ expectTypeOf ( result ) . toMatchTypeOf < { a : string ; d : string } > ( ) ;
1313 } ) ;
1414
1515 it ( "should fill in values that are null" , ( ) => {
1616 const result1 = defu ( { a : null as null } , { a : "c" , d : "c" } ) ;
1717 expect ( result1 ) . toEqual ( { a : "c" , d : "c" } ) ;
18- expectTypeOf ( result1 ) . toEqualTypeOf < { a : string ; d : string } > ( ) ;
18+ expectTypeOf ( result1 ) . toMatchTypeOf < { a : string ; d : string } > ( ) ;
1919
2020 const result2 = defu ( { a : "c" } , { a : null as null , d : "c" } ) ;
2121 expect ( result2 ) . toEqual ( { a : "c" , d : "c" } ) ;
22- expectTypeOf ( result2 ) . toEqualTypeOf < { a : string ; d : string } > ( ) ;
22+ expectTypeOf ( result2 ) . toMatchTypeOf < { a : string ; d : string } > ( ) ;
2323 } ) ;
2424
2525 it ( "should copy nested values" , ( ) => {
2626 const result = defu ( { a : { b : "c" } } , { a : { d : "e" } } ) ;
2727 expect ( result ) . toEqual ( {
2828 a : { b : "c" , d : "e" } ,
2929 } ) ;
30- expectTypeOf ( result ) . toEqualTypeOf < { a : { b : string ; d : string } } > ( ) ;
30+ expectTypeOf ( result ) . toMatchTypeOf < { a : { b : string ; d : string } } > ( ) ;
3131 } ) ;
3232
3333 it ( "should concat array values by default" , ( ) => {
3434 const result = defu ( { array : [ "a" , "b" ] } , { array : [ "c" , "d" ] } ) ;
3535 expect ( result ) . toEqual ( {
3636 array : [ "a" , "b" , "c" , "d" ] ,
3737 } ) ;
38- expectTypeOf ( result ) . toEqualTypeOf < { array : string [ ] } > ( ) ;
38+ expectTypeOf ( result ) . toMatchTypeOf < { array : string [ ] } > ( ) ;
3939 } ) ;
4040
4141 it ( "should correctly type differing array values" , ( ) => {
4242 const item1 = { name : "Name" , age : 21 } ;
4343 const item2 = { name : "Name" , age : "42" } ;
4444 const result = defu ( { items : [ item1 ] } , { items : [ item2 ] } ) ;
4545 expect ( result ) . toEqual ( { items : [ item1 , item2 ] } ) ;
46- expectTypeOf ( result ) . toEqualTypeOf < {
46+ expectTypeOf ( result ) . toMatchTypeOf < {
4747 items : Array <
4848 { name : string ; age : number } | { name : string ; age : string }
4949 > ;
5050 } > ( ) ;
5151 } ) ;
5252
5353 it ( "should correctly merge different object types" , ( ) => {
54+ // eslint-disable-next-line unicorn/consistent-function-scoping
5455 const fn = ( ) => 42 ;
5556 const re = / t e s t / i;
5657
5758 const result = defu ( { a : fn } , { a : re } ) ;
5859 expect ( result ) . toEqual ( { a : fn } ) ;
59- expectTypeOf ( result ) . toEqualTypeOf < { a : ( ( ) => number ) | RegExp } > ( ) ;
60+ expectTypeOf ( result ) . toMatchTypeOf < { a : ( ( ) => number ) | RegExp } > ( ) ;
6061 } ) ;
6162
6263 it ( "should handle non object first param" , ( ) => {
@@ -78,7 +79,7 @@ describe("defu", () => {
7879 b : 2 ,
7980 c : 3 ,
8081 } ) ;
81- expectTypeOf ( result ) . toEqualTypeOf < {
82+ expectTypeOf ( result ) . toMatchTypeOf < {
8283 a : string | number ;
8384 b : string | number ;
8485 c : number ;
@@ -120,7 +121,7 @@ describe("defu", () => {
120121 }
121122 expectTypeOf (
122123 defu ( { } as SomeConfig , { } as SomeOtherConfig , { } as ThirdConfig ) ,
123- ) . toEqualTypeOf < ExpectedMergedType > ( ) ;
124+ ) . toMatchTypeOf < ExpectedMergedType > ( ) ;
124125 } ) ;
125126
126127 it ( "should allow partials within merge chain" , ( ) => {
@@ -138,11 +139,11 @@ describe("defu", () => {
138139
139140 expectTypeOf (
140141 defu ( options ?? { } , { foo : [ "test" ] } , { bar : [ "test2" ] } , { } ) ,
141- ) . toEqualTypeOf < ExpectedMergedType > ( ) ;
142+ ) . toMatchTypeOf < ExpectedMergedType > ( ) ;
142143
143144 expectTypeOf (
144145 defu ( { foo : [ "test" ] } , { } , { bar : [ "test2" ] } , { } ) ,
145- ) . toEqualTypeOf < ExpectedMergedType > ( ) ;
146+ ) . toMatchTypeOf < ExpectedMergedType > ( ) ;
146147 } ) ;
147148
148149 it ( "custom merger" , ( ) => {
@@ -156,11 +157,12 @@ describe("defu", () => {
156157 } ) ;
157158
158159 it ( "defuFn()" , ( ) => {
160+ // eslint-disable-next-line unicorn/consistent-function-scoping
159161 const num = ( ) => 20 ;
160162 expect (
161163 defuFn (
162164 {
163- ignore : ( val ) => val . filter ( ( i ) => i !== "dist" ) ,
165+ ignore : ( val : any ) => val . filter ( ( i : any ) => i !== "dist" ) ,
164166 num,
165167 ignored : num ,
166168 } ,
@@ -177,6 +179,7 @@ describe("defu", () => {
177179 } ) ;
178180
179181 it ( "defuArrayFn()" , ( ) => {
182+ // eslint-disable-next-line unicorn/consistent-function-scoping
180183 const num = ( ) => 20 ;
181184 expect (
182185 defuArrayFn (
0 commit comments