@@ -64,13 +64,25 @@ interface CustomMatchers<R> extends Record<string, any> {
64
64
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
65
65
* @param {Array.<*> } members
66
66
*/
67
- toIncludeAllMembers < E = unknown > ( members : readonly E [ ] ) : R ;
67
+ toIncludeAllMembers < E = unknown > ( members : readonly E [ ] | E ) : R ;
68
+
69
+ /**
70
+ * Use `.toIncludeAllPartialMembers` when checking if an `Array` contains all the same partial members of a given set.
71
+ * @param {Array.<*> } members
72
+ */
73
+ toIncludeAllPartialMembers < E = unknown > ( members : readonly E [ ] | E ) : R ;
74
+
75
+ /**
76
+ * Use `.toIncludeSamePartialMembers` when checking if an `Array` contains exactly the same partial members as a given set, in any order
77
+ * @param {Array.<*> } members
78
+ */
79
+ toIncludeSamePartialMembers < E = unknown > ( members : readonly E [ ] ) : R ;
68
80
69
81
/**
70
82
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
71
83
* @param {Array.<*> } members
72
84
*/
73
- toIncludeAnyMembers < E = unknown > ( members : readonly E [ ] ) : R ;
85
+ toIncludeAnyMembers < E = unknown > ( members : readonly E [ ] | E ) : R ;
74
86
75
87
/**
76
88
* Use `.toIncludeSameMembers` when checking if two arrays contain equal values, in any order.
@@ -222,6 +234,26 @@ interface CustomMatchers<R> extends Record<string, any> {
222
234
*/
223
235
toBeObject ( ) : R ;
224
236
237
+ /**
238
+ * Use `.toChange` when checking if a value has changed.
239
+ * @param {Function } checker
240
+ */
241
+ toChange < E = unknown > ( checker : ( ) => E ) : R ;
242
+
243
+ /**
244
+ * Use `.toChangeBy` when checking if a value changed by an amount.
245
+ * @param {Function } checker
246
+ * @param {Number } by
247
+ */
248
+ toChangeBy ( checker : ( ) => number , by ?: number ) : R ;
249
+
250
+ /**
251
+ * Use `.toChangeTo` when checking if a value changed to a specific value.
252
+ * @param {Function } checker
253
+ * @param {* } to
254
+ */
255
+ toChangeTo < E = unknown > ( checker : ( ) => E , to : E ) : R ;
256
+
225
257
/**
226
258
* Use `.toContainKey` when checking if an object contains the provided key.
227
259
*
@@ -385,7 +417,10 @@ interface CustomMatchers<R> extends Record<string, any> {
385
417
* @param {Function } type
386
418
* @param {String | RegExp } message
387
419
*/
388
- toThrowWithMessage ( type : ( ...args : any [ ] ) => any , message : string | RegExp ) : R ;
420
+ toThrowWithMessage (
421
+ type : ( new ( ...args : any [ ] ) => { message : string } ) | ( ( ...args : any [ ] ) => { message : string } ) ,
422
+ message : string | RegExp ,
423
+ ) : R ;
389
424
390
425
/**
391
426
* Use `.toBeEmptyObject` when checking if a value is an empty `Object`.
@@ -669,24 +704,23 @@ declare namespace jest {
669
704
670
705
/**
671
706
* Use `.toChange` when checking if a value has changed.
672
- * @example
673
- * expect(() => value--).toChange(() => value);
707
+ * @param {Function } checker
674
708
*/
675
709
toChange < E = unknown > ( checker : ( ) => E ) : R ;
676
710
677
711
/**
678
- * Use `.toChangeTo ` when checking if a value changed to a specific value .
679
- * @example
680
- * expect(() => Model.deleteAll()).toChangeTo(() => Model.count(), 0);
712
+ * Use `.toChangeBy ` when checking if a value changed by an amount .
713
+ * @param { Function } checker
714
+ * @param { Number } by
681
715
*/
682
- toChangeTo < E = unknown > ( checker : ( ) => E , to : E ) : R ;
716
+ toChangeBy ( checker : ( ) => number , by ?: number ) : R ;
683
717
684
718
/**
685
- * Use `.toChangeBy ` when checking if a value changed by an amount .
686
- * @example
687
- * expect(() => value--).toChangeBy(() => value, -1);
719
+ * Use `.toChangeTo ` when checking if a value changed to a specific value .
720
+ * @param { Function } checker
721
+ * @param { * } to
688
722
*/
689
- toChangeBy ( checker : ( ) => number , by ?: number ) : R ;
723
+ toChangeTo < E = unknown > ( checker : ( ) => E , to : E ) : R ;
690
724
691
725
/**
692
726
* Use `.toContainKey` when checking if an object contains the provided key.
@@ -852,10 +886,7 @@ declare namespace jest {
852
886
* @param {String | RegExp } message
853
887
*/
854
888
toThrowWithMessage (
855
- type :
856
- | ( new ( ...args : any [ ] ) => { message : string } )
857
- | ( abstract new ( ...args : any [ ] ) => { message : string } )
858
- | ( ( ...args : any [ ] ) => { message : string } ) ,
889
+ type : ( new ( ...args : any [ ] ) => { message : string } ) | ( ( ...args : any [ ] ) => { message : string } ) ,
859
890
message : string | RegExp ,
860
891
) : R ;
861
892
0 commit comments