@@ -4,13 +4,13 @@ import jsonMergePatch from "../src/index.js";
44
55describe ( "jsonMergePatch type" , ( ) => {
66 it ( "should replace an attribute" , ( ) => {
7- const patched = jsonMergePatch ( { a : "b" } , { a : "c" } ) ;
8- expectTypeOf ( patched ) . toEqualTypeOf < { a : string } > ( ) ;
7+ const patched = jsonMergePatch ( { a : "b" } as const , { a : "c" } as const ) ;
8+ expectTypeOf ( patched ) . toEqualTypeOf < { a : "c" } > ( ) ;
99 } ) ;
1010
1111 it ( "should add an attribute" , ( ) => {
12- const patched = jsonMergePatch ( { a : "b" } , { b : "c" } ) ;
13- expectTypeOf ( patched ) . toEqualTypeOf < { a : string ; b : string } > ( ) ;
12+ const patched = jsonMergePatch ( { a : "b" } as const , { b : "c" } as const ) ;
13+ expectTypeOf ( patched ) . toEqualTypeOf < { a : "b" ; b : "c" } > ( ) ;
1414 } ) ;
1515
1616 it ( "should delete attribute" , ( ) => {
@@ -21,13 +21,13 @@ describe("jsonMergePatch type", () => {
2121 } ) ;
2222
2323 it ( "should delete attribute without affecting others" , ( ) => {
24- const patched = jsonMergePatch ( { a : "b" , b : "c" } , { a : null } ) ;
25- expectTypeOf ( patched ) . toEqualTypeOf < { b : string } > ( ) ;
24+ const patched = jsonMergePatch ( { a : "b" , b : "c" } as const , { a : null } ) ;
25+ expectTypeOf ( patched ) . toEqualTypeOf < { b : "c" } > ( ) ;
2626 } ) ;
2727
2828 it ( "should replace array with a string" , ( ) => {
29- const patched = jsonMergePatch ( { a : [ "b" ] } , { a : "c" } ) ;
30- expectTypeOf ( patched ) . toEqualTypeOf < { a : string } > ( ) ;
29+ const patched = jsonMergePatch ( { a : [ "b" ] } , { a : "c" } as const ) ;
30+ expectTypeOf ( patched ) . toEqualTypeOf < { a : "c" } > ( ) ;
3131 } ) ;
3232
3333 it ( "should replace a string with an array" , ( ) => {
@@ -41,8 +41,8 @@ describe("jsonMergePatch type", () => {
4141 } ) ;
4242
4343 it ( "should replace an object array with a number array" , ( ) => {
44- const patched = jsonMergePatch ( { a : [ { b : "c" } ] } , { a : [ 1 ] as const } ) ;
45- expectTypeOf ( patched ) . toEqualTypeOf < { a : readonly [ 1 ] } > ( ) ;
44+ const patched = jsonMergePatch ( { a : [ { b : "c" } ] } , { a : [ 1 ] } ) ;
45+ expectTypeOf ( patched ) . toEqualTypeOf < { a : number [ ] } > ( ) ;
4646 } ) ;
4747
4848 it ( "should replace an array" , ( ) => {
@@ -51,8 +51,8 @@ describe("jsonMergePatch type", () => {
5151 } ) ;
5252
5353 it ( "should replace an object with an array" , ( ) => {
54- const patched = jsonMergePatch ( { a : "b" } , [ "c" ] as const ) ;
55- expectTypeOf ( patched ) . toEqualTypeOf < readonly [ "c" ] > ( ) ;
54+ const patched = jsonMergePatch ( { a : "b" } , [ "c" ] ) ;
55+ expectTypeOf ( patched ) . toEqualTypeOf < string [ ] > ( ) ;
5656 } ) ;
5757
5858 it ( "should replace an object with null" , ( ) => {
0 commit comments