@augment-vir/assert 31.0.0 → 31.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/assertions/boolean.d.ts +20 -26
  2. package/dist/assertions/boolean.js +185 -41
  3. package/dist/assertions/boundary.d.ts +40 -256
  4. package/dist/assertions/boundary.js +265 -229
  5. package/dist/assertions/enum.d.ts +12 -13
  6. package/dist/assertions/enum.js +98 -20
  7. package/dist/assertions/equality/entry-equality.d.ts +11 -15
  8. package/dist/assertions/equality/entry-equality.js +210 -43
  9. package/dist/assertions/equality/json-equality.d.ts +11 -15
  10. package/dist/assertions/equality/json-equality.js +144 -43
  11. package/dist/assertions/equality/simple-equality.d.ts +39 -46
  12. package/dist/assertions/equality/simple-equality.js +316 -61
  13. package/dist/assertions/extendable-assertions.d.ts +0 -12
  14. package/dist/assertions/extendable-assertions.js +0 -12
  15. package/dist/assertions/http.d.ts +10 -14
  16. package/dist/assertions/http.js +96 -28
  17. package/dist/assertions/instance.d.ts +10 -18
  18. package/dist/assertions/instance.js +92 -26
  19. package/dist/assertions/keys.d.ts +59 -138
  20. package/dist/assertions/keys.js +279 -162
  21. package/dist/assertions/length.d.ts +30 -212
  22. package/dist/assertions/length.js +117 -175
  23. package/dist/assertions/nullish.d.ts +8 -20
  24. package/dist/assertions/nullish.js +85 -27
  25. package/dist/assertions/numeric.d.ts +67 -81
  26. package/dist/assertions/numeric.js +564 -133
  27. package/dist/assertions/output.d.ts +2 -3
  28. package/dist/assertions/output.js +1 -7
  29. package/dist/assertions/primitive.d.ts +33 -40
  30. package/dist/assertions/primitive.js +232 -66
  31. package/dist/assertions/promise.d.ts +20 -30
  32. package/dist/assertions/promise.js +244 -53
  33. package/dist/assertions/regexp.d.ts +12 -14
  34. package/dist/assertions/regexp.js +84 -21
  35. package/dist/assertions/runtime-type.d.ts +99 -150
  36. package/dist/assertions/runtime-type.js +805 -229
  37. package/dist/assertions/throws.d.ts +24 -25
  38. package/dist/assertions/throws.js +43 -5
  39. package/dist/assertions/uuid.d.ts +11 -16
  40. package/dist/assertions/uuid.js +91 -22
  41. package/dist/assertions/values.d.ts +81 -210
  42. package/dist/assertions/values.js +627 -234
  43. package/dist/augments/guards/assert-wrap.d.ts +7 -4
  44. package/dist/augments/guards/assert-wrap.js +5 -4
  45. package/dist/augments/guards/check-wrap.d.ts +7 -5
  46. package/dist/augments/guards/check-wrap.js +5 -4
  47. package/dist/augments/guards/check.d.ts +5 -5
  48. package/dist/augments/guards/check.js +5 -4
  49. package/dist/augments/guards/wait-until.d.ts +8 -4
  50. package/dist/augments/guards/wait-until.js +7 -8
  51. package/dist/guard-types/guard-group.d.ts +5 -2
  52. package/dist/guard-types/wait-until-function.d.ts +2 -10
  53. package/dist/guard-types/wait-until-function.js +1 -9
  54. package/dist/index.d.ts +1 -0
  55. package/package.json +2 -2
  56. package/dist/guard-types/assert-wrap-function.d.ts +0 -12
  57. package/dist/guard-types/assert-wrap-function.js +0 -14
  58. package/dist/guard-types/check-function.d.ts +0 -14
  59. package/dist/guard-types/check-function.js +0 -22
  60. package/dist/guard-types/check-wrap-wrapper-function.d.ts +0 -12
  61. package/dist/guard-types/check-wrap-wrapper-function.js +0 -19
  62. package/dist/guard-types/guard-override.d.ts +0 -4
  63. package/dist/guard-types/guard-override.js +0 -10
@@ -1,20 +1,13 @@
1
1
  import { type MaybePromise, type NarrowToExpected, type RequiredKeysOf } from '@augment-vir/core';
2
2
  import { type SetRequired } from 'type-fest';
3
3
  import { type WaitUntilOptions } from '../guard-types/wait-until-function.js';
4
- declare function isKeyOf<const Parent>(key: PropertyKey, parent: Parent, failureMessage?: string | undefined): asserts key is keyof Parent;
5
- declare function isNotKeyOf<const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined): asserts key is Exclude<Key, RequiredKeysOf<Parent>>;
6
4
  /** Helper type for `hasKey`. */
7
5
  type ExtractValue<Key extends PropertyKey, Parent> = Key extends keyof Parent ? SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never;
8
6
  /** Helper type for `hasKey`. */
9
7
  type CombinedParentValue<Key extends PropertyKey, Parent> = ExtractValue<Key, Parent> extends never ? unknown : ExtractValue<Key, Parent>;
10
8
  /** Helper type for `hasKey`. */
11
9
  type CombineTypeWithKey<Key extends PropertyKey, Parent> = Parent & Record<Key, CombinedParentValue<Key, Parent>>;
12
- /** Check if an object has the given property. */
13
- declare function hasKey<const Key extends PropertyKey, const Parent>(parent: Parent, key: Key, failureMessage?: string | undefined): asserts parent is CombineTypeWithKey<Key, Parent>;
14
- declare function lacksKey<const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined): asserts parent is Exclude<Parent, Record<Key, any>>;
15
- /** Check if an object has all the given properties. */
16
- declare function hasKeys<const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined): asserts parent is CombineTypeWithKey<Keys, Parent>;
17
- declare function lacksKeys<const Parent, const Key extends PropertyKey>(parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined): asserts parent is Exclude<Parent, Partial<Record<Key, any>>>;
10
+ declare function hasKey<const Key extends PropertyKey, const Parent>(this: void, parent: Parent, key: Key): parent is CombineTypeWithKey<Key, Parent>;
18
11
  export declare const keyGuards: {
19
12
  assert: {
20
13
  /**
@@ -35,7 +28,7 @@ export declare const keyGuards: {
35
28
  * @see
36
29
  * - {@link assert.isNotKeyOf} : the opposite assertion.
37
30
  */
38
- isKeyOf: typeof isKeyOf;
31
+ isKeyOf<const Parent>(this: void, key: PropertyKey, parent: Parent, failureMessage?: string | undefined): asserts key is keyof Parent;
39
32
  /**
40
33
  * Asserts that a key is _not_ contained within a parent value.
41
34
  *
@@ -54,7 +47,7 @@ export declare const keyGuards: {
54
47
  * @see
55
48
  * - {@link assert.isKeyOf} : the opposite assertion.
56
49
  */
57
- isNotKeyOf: typeof isNotKeyOf;
50
+ isNotKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent, failureMessage?: string | undefined): asserts key is Exclude<Key, RequiredKeysOf<Parent>>;
58
51
  /**
59
52
  * Asserts that a parent value has the key.
60
53
  *
@@ -74,7 +67,7 @@ export declare const keyGuards: {
74
67
  * - {@link assert.lacksKey} : the opposite assertion.
75
68
  * - {@link assert.hasKeys} : the multi-key assertion.
76
69
  */
77
- hasKey: typeof hasKey;
70
+ hasKey<const Key extends PropertyKey, const Parent>(this: void, parent: Parent, key: Key, failureMessage?: string | undefined): asserts parent is CombineTypeWithKey<Key, Parent>;
78
71
  /**
79
72
  * Asserts that a parent value does not have the key.
80
73
  *
@@ -94,7 +87,7 @@ export declare const keyGuards: {
94
87
  * - {@link assert.hasKey} : the opposite assertion.
95
88
  * - {@link assert.lacksKeys} : the multi-key assertion.
96
89
  */
97
- lacksKey: typeof lacksKey;
90
+ lacksKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key, failureMessage?: string | undefined): asserts parent is Exclude<Parent, Record<Key, any>>;
98
91
  /**
99
92
  * Asserts that a parent value has all the keys.
100
93
  *
@@ -105,14 +98,8 @@ export declare const keyGuards: {
105
98
  * ```ts
106
99
  * import {assert} from '@augment-vir/assert';
107
100
  *
108
- * assert.hasKeys({a: 0, b: 1}, [
109
- * 'a',
110
- * 'b',
111
- * ]); // passes
112
- * assert.hasKeys({a: 0, b: 1}, [
113
- * 'b',
114
- * 'c',
115
- * ]); // fails
101
+ * assert.hasKeys({a: 0, b: 1}, ['a', 'b']); // passes
102
+ * assert.hasKeys({a: 0, b: 1}, ['b', 'c']); // fails
116
103
  * ```
117
104
  *
118
105
  * @throws {@link AssertionError} If the parent does not have all the keys.
@@ -120,7 +107,7 @@ export declare const keyGuards: {
120
107
  * - {@link assert.lacksKeys} : the opposite assertion.
121
108
  * - {@link assert.hasKey} : the single-key assertion.
122
109
  */
123
- hasKeys: typeof hasKeys;
110
+ hasKeys<const Keys extends PropertyKey, const Parent>(this: void, parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined): asserts parent is CombineTypeWithKey<Keys, Parent>;
124
111
  /**
125
112
  * Asserts that a parent value none of the keys.
126
113
  *
@@ -131,14 +118,8 @@ export declare const keyGuards: {
131
118
  * ```ts
132
119
  * import {assert} from '@augment-vir/assert';
133
120
  *
134
- * assert.lacksKeys({a: 0, b: 1}, [
135
- * 'b',
136
- * 'c',
137
- * ]); // fails
138
- * assert.lacksKeys({a: 0, b: 1}, [
139
- * 'c',
140
- * 'd',
141
- * ]); // passes
121
+ * assert.lacksKeys({a: 0, b: 1}, ['b', 'c']); // fails
122
+ * assert.lacksKeys({a: 0, b: 1}, ['c', 'd']); // passes
142
123
  * ```
143
124
  *
144
125
  * @throws {@link AssertionError} If the parent has any of the keys.
@@ -146,7 +127,7 @@ export declare const keyGuards: {
146
127
  * - {@link assert.hasKeys} : the opposite assertion.
147
128
  * - {@link assert.lacksKey} : the single-key assertion.
148
129
  */
149
- lacksKeys: typeof lacksKeys;
130
+ lacksKeys<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined): asserts parent is Exclude<Parent, Partial<Record<Key, any>>>;
150
131
  };
151
132
  check: {
152
133
  /**
@@ -166,7 +147,7 @@ export declare const keyGuards: {
166
147
  * @see
167
148
  * - {@link check.isNotKeyOf} : the opposite check.
168
149
  */
169
- isKeyOf: <const Parent>(key: PropertyKey, parent: Parent) => key is keyof Parent;
150
+ isKeyOf<const Parent>(this: void, key: PropertyKey, parent: Parent): key is keyof Parent;
170
151
  /**
171
152
  * Checks that a key is _not_ contained within a parent value.
172
153
  *
@@ -184,7 +165,7 @@ export declare const keyGuards: {
184
165
  * @see
185
166
  * - {@link check.isKeyOf} : the opposite check.
186
167
  */
187
- isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => key is Exclude<Key, RequiredKeysOf<Parent>>;
168
+ isNotKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent): key is Exclude<Key, RequiredKeysOf<Parent>>;
188
169
  /**
189
170
  * Checks that a parent value has the key.
190
171
  *
@@ -203,7 +184,7 @@ export declare const keyGuards: {
203
184
  * - {@link check.lacksKey} : the opposite check.
204
185
  * - {@link check.hasKeys} : the multi-key check.
205
186
  */
206
- hasKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key) => parent is CombineTypeWithKey<Key, Parent>;
187
+ hasKey: typeof hasKey;
207
188
  /**
208
189
  * Checks that a parent value does not have the key.
209
190
  *
@@ -222,7 +203,7 @@ export declare const keyGuards: {
222
203
  * - {@link check.hasKey} : the opposite check.
223
204
  * - {@link check.lacksKeys} : the multi-key check.
224
205
  */
225
- lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => parent is Exclude<Parent, Record<Key, any>>;
206
+ lacksKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key): parent is Exclude<Parent, Record<Key, any>>;
226
207
  /**
227
208
  * Checks that a parent value has all the keys.
228
209
  *
@@ -233,21 +214,15 @@ export declare const keyGuards: {
233
214
  * ```ts
234
215
  * import {check} from '@augment-vir/assert';
235
216
  *
236
- * check.hasKeys({a: 0, b: 1}, [
237
- * 'a',
238
- * 'b',
239
- * ]); // returns `true`
240
- * check.hasKeys({a: 0, b: 1}, [
241
- * 'b',
242
- * 'c',
243
- * ]); // returns `false`
217
+ * check.hasKeys({a: 0, b: 1}, ['a', 'b']); // returns `true`
218
+ * check.hasKeys({a: 0, b: 1}, ['b', 'c']); // returns `false`
244
219
  * ```
245
220
  *
246
221
  * @see
247
222
  * - {@link check.lacksKeys} : the opposite check.
248
223
  * - {@link check.hasKey} : the single-key check.
249
224
  */
250
- hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>) => parent is CombineTypeWithKey<Keys, Parent>;
225
+ hasKeys<const Keys extends PropertyKey, const Parent>(this: void, parent: Parent, keys: ReadonlyArray<Keys>): parent is CombineTypeWithKey<Keys, Parent>;
251
226
  /**
252
227
  * Checks that a parent value none of the keys.
253
228
  *
@@ -258,21 +233,15 @@ export declare const keyGuards: {
258
233
  * ```ts
259
234
  * import {check} from '@augment-vir/assert';
260
235
  *
261
- * check.lacksKeys({a: 0, b: 1}, [
262
- * 'b',
263
- * 'c',
264
- * ]); // returns `false`
265
- * check.lacksKeys({a: 0, b: 1}, [
266
- * 'c',
267
- * 'd',
268
- * ]); // returns `true`
236
+ * check.lacksKeys({a: 0, b: 1}, ['b', 'c']); // returns `false`
237
+ * check.lacksKeys({a: 0, b: 1}, ['c', 'd']); // returns `true`
269
238
  * ```
270
239
  *
271
240
  * @see
272
241
  * - {@link check.hasKeys} : the opposite check.
273
242
  * - {@link check.lacksKey} : the single-key check.
274
243
  */
275
- lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, key: ReadonlyArray<Key>) => parent is Exclude<Parent, Partial<Record<Key, any>>>;
244
+ lacksKeys<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, keys: ReadonlyArray<Key>): parent is Exclude<Parent, Partial<Record<Key, any>>>;
276
245
  };
277
246
  assertWrap: {
278
247
  /**
@@ -295,7 +264,7 @@ export declare const keyGuards: {
295
264
  * @see
296
265
  * - {@link assertWrap.isNotKeyOf} : the opposite assertion.
297
266
  */
298
- isKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => NarrowToExpected<Key, keyof Parent>;
267
+ isKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent, failureMessage?: string | undefined): NarrowToExpected<Key, keyof Parent>;
299
268
  /**
300
269
  * Asserts that a key is _not_ contained within a parent value. Returns the key if the
301
270
  * assertion passes.
@@ -316,7 +285,7 @@ export declare const keyGuards: {
316
285
  * @see
317
286
  * - {@link assertWrap.isKeyOf} : the opposite assertion.
318
287
  */
319
- isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => Exclude<Key, RequiredKeysOf<Parent>>;
288
+ isNotKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent, failureMessage?: string | undefined): Exclude<Key, RequiredKeysOf<Parent>>;
320
289
  /**
321
290
  * Asserts that a parent value has the key. Returns the parent if the assertion passes.
322
291
  *
@@ -337,7 +306,7 @@ export declare const keyGuards: {
337
306
  * - {@link assertWrap.lacksKey} : the opposite assertion.
338
307
  * - {@link assertWrap.hasKeys} : the multi-key assertion.
339
308
  */
340
- hasKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => CombineTypeWithKey<Key, Parent>;
309
+ hasKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key, failureMessage?: string | undefined): CombineTypeWithKey<Key, Parent>;
341
310
  /**
342
311
  * Asserts that a parent value does not have the key. Returns the parent if the assertion
343
312
  * passes.
@@ -359,7 +328,7 @@ export declare const keyGuards: {
359
328
  * - {@link assertWrap.hasKey} : the opposite assertion.
360
329
  * - {@link assertWrap.lacksKeys} : the multi-key assertion.
361
330
  */
362
- lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => Exclude<Parent, Record<Key, any>>;
331
+ lacksKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key, failureMessage?: string | undefined): Exclude<Parent, Record<Key, any>>;
363
332
  /**
364
333
  * Asserts that a parent value has all the keys. Returns the parent if the assertion passes.
365
334
  *
@@ -370,14 +339,8 @@ export declare const keyGuards: {
370
339
  * ```ts
371
340
  * import {assertWrap} from '@augment-vir/assert';
372
341
  *
373
- * assertWrap.hasKeys({a: 0, b: 1}, [
374
- * 'a',
375
- * 'b',
376
- * ]); // returns `{a: 0, b: 1}`
377
- * assertWrap.hasKeys({a: 0, b: 1}, [
378
- * 'b',
379
- * 'c',
380
- * ]); // throws an error
342
+ * assertWrap.hasKeys({a: 0, b: 1}, ['a', 'b']); // returns `{a: 0, b: 1}`
343
+ * assertWrap.hasKeys({a: 0, b: 1}, ['b', 'c']); // throws an error
381
344
  * ```
382
345
  *
383
346
  * @returns The parent if it has all the keys.
@@ -386,7 +349,7 @@ export declare const keyGuards: {
386
349
  * - {@link assertWrap.lacksKeys} : the opposite assertion.
387
350
  * - {@link assertWrap.hasKey} : the single-key assertion.
388
351
  */
389
- hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined) => CombineTypeWithKey<Keys, Parent>;
352
+ hasKeys<const Keys extends PropertyKey, const Parent>(this: void, parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined): CombineTypeWithKey<Keys, Parent>;
390
353
  /**
391
354
  * Asserts that a parent value none of the keys. Returns the parent if the assertion passes.
392
355
  *
@@ -397,14 +360,8 @@ export declare const keyGuards: {
397
360
  * ```ts
398
361
  * import {assertWrap} from '@augment-vir/assert';
399
362
  *
400
- * assertWrap.lacksKeys({a: 0, b: 1}, [
401
- * 'b',
402
- * 'c',
403
- * ]); // throws an error
404
- * assertWrap.lacksKeys({a: 0, b: 1}, [
405
- * 'c',
406
- * 'd',
407
- * ]); // returns `{a: 0, b: 1}`
363
+ * assertWrap.lacksKeys({a: 0, b: 1}, ['b', 'c']); // throws an error
364
+ * assertWrap.lacksKeys({a: 0, b: 1}, ['c', 'd']); // returns `{a: 0, b: 1}`
408
365
  * ```
409
366
  *
410
367
  * @returns The parent if it does not have any of the keys.
@@ -413,7 +370,7 @@ export declare const keyGuards: {
413
370
  * - {@link assertWrap.hasKeys} : the opposite assertion.
414
371
  * - {@link assertWrap.lacksKey} : the single-key assertion.
415
372
  */
416
- lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, key: ReadonlyArray<Key>, failureMessage?: string | undefined) => Exclude<Parent, Partial<Record<Key, any>>>;
373
+ lacksKeys<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined): Exclude<Parent, Partial<Record<Key, any>>>;
417
374
  };
418
375
  checkWrap: {
419
376
  /**
@@ -435,7 +392,7 @@ export declare const keyGuards: {
435
392
  * @see
436
393
  * - {@link checkWrap.isNotKeyOf} : the opposite check.
437
394
  */
438
- isKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent) => NarrowToExpected<Key, keyof Parent> | undefined;
395
+ isKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent): NarrowToExpected<Key, keyof Parent> | undefined;
439
396
  /**
440
397
  * Checks that a key is _not_ contained within a parent value. Returns the key if the check
441
398
  * passes, otherwise `undefined`.
@@ -455,7 +412,7 @@ export declare const keyGuards: {
455
412
  * @see
456
413
  * - {@link checkWrap.isKeyOf} : the opposite check.
457
414
  */
458
- isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => Exclude<Key, RequiredKeysOf<Parent>> | undefined;
415
+ isNotKeyOf<const Key extends PropertyKey, const Parent>(this: void, key: Key, parent: Parent): Exclude<Key, RequiredKeysOf<Parent>> | undefined;
459
416
  /**
460
417
  * Checks that a parent value has the key. Returns the parent value if the check passes,
461
418
  * otherwise `undefined`.
@@ -476,7 +433,7 @@ export declare const keyGuards: {
476
433
  * - {@link checkWrap.lacksKey} : the opposite check.
477
434
  * - {@link checkWrap.hasKeys} : the multi-key check.
478
435
  */
479
- hasKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key) => CombineTypeWithKey<Key, Parent> | undefined;
436
+ hasKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key): CombineTypeWithKey<Key, Parent> | undefined;
480
437
  /**
481
438
  * Checks that a parent value does not have the key. Returns the parent value if the check
482
439
  * passes, otherwise `undefined`.
@@ -497,7 +454,7 @@ export declare const keyGuards: {
497
454
  * - {@link checkWrap.hasKey} : the opposite check.
498
455
  * - {@link checkWrap.lacksKeys} : the multi-key check.
499
456
  */
500
- lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => Exclude<Parent, Record<Key, any>> | undefined;
457
+ lacksKey<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, key: Key): Exclude<Parent, Record<Key, any>> | undefined;
501
458
  /**
502
459
  * Checks that a parent value has all the keys. Returns the parent value if the check
503
460
  * passes, otherwise `undefined`.
@@ -509,14 +466,8 @@ export declare const keyGuards: {
509
466
  * ```ts
510
467
  * import {checkWrap} from '@augment-vir/assert';
511
468
  *
512
- * checkWrap.hasKeys({a: 0, b: 1}, [
513
- * 'a',
514
- * 'b',
515
- * ]); // returns `{a: 0, b: 1}`
516
- * checkWrap.hasKeys({a: 0, b: 1}, [
517
- * 'b',
518
- * 'c',
519
- * ]); // returns `undefined`
469
+ * checkWrap.hasKeys({a: 0, b: 1}, ['a', 'b']); // returns `{a: 0, b: 1}`
470
+ * checkWrap.hasKeys({a: 0, b: 1}, ['b', 'c']); // returns `undefined`
520
471
  * ```
521
472
  *
522
473
  * @returns The parent value if the check passes, otherwise `undefined`.
@@ -524,7 +475,7 @@ export declare const keyGuards: {
524
475
  * - {@link checkWrap.lacksKeys} : the opposite check.
525
476
  * - {@link checkWrap.hasKey} : the single-key check.
526
477
  */
527
- hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>) => CombineTypeWithKey<Keys, Parent> | undefined;
478
+ hasKeys<const Keys extends PropertyKey, const Parent>(this: void, parent: Parent, keys: ReadonlyArray<Keys>): CombineTypeWithKey<Keys, Parent> | undefined;
528
479
  /**
529
480
  * Checks that a parent value none of the keys. Returns the parent value if the check
530
481
  * passes, otherwise `undefined`.
@@ -536,14 +487,8 @@ export declare const keyGuards: {
536
487
  * ```ts
537
488
  * import {checkWrap} from '@augment-vir/assert';
538
489
  *
539
- * checkWrap.lacksKeys({a: 0, b: 1}, [
540
- * 'b',
541
- * 'c',
542
- * ]); // returns `undefined`
543
- * checkWrap.lacksKeys({a: 0, b: 1}, [
544
- * 'c',
545
- * 'd',
546
- * ]); // returns `{a: 0, b: 1}`
490
+ * checkWrap.lacksKeys({a: 0, b: 1}, ['b', 'c']); // returns `undefined`
491
+ * checkWrap.lacksKeys({a: 0, b: 1}, ['c', 'd']); // returns `{a: 0, b: 1}`
547
492
  * ```
548
493
  *
549
494
  * @returns The parent value if the check passes, otherwise `undefined`.
@@ -551,7 +496,7 @@ export declare const keyGuards: {
551
496
  * - {@link checkWrap.hasKeys} : the opposite check.
552
497
  * - {@link checkWrap.lacksKey} : the single-key check.
553
498
  */
554
- lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, key: ReadonlyArray<Key>) => Exclude<Parent, Partial<Record<Key, any>>> | undefined;
499
+ lacksKeys<const Parent, const Key extends PropertyKey>(this: void, parent: Parent, keys: ReadonlyArray<Key>): Exclude<Parent, Partial<Record<Key, any>>> | undefined;
555
500
  };
556
501
  waitUntil: {
557
502
  /**
@@ -575,7 +520,7 @@ export declare const keyGuards: {
575
520
  * @see
576
521
  * - {@link waitUntil.isNotKeyOf} : the opposite assertion.
577
522
  */
578
- isKeyOf: <const Key extends PropertyKey, const Parent>(parent: Parent, callback: () => MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<NarrowToExpected<Key, keyof Parent>>;
523
+ isKeyOf: <const Key extends PropertyKey, const Parent>(this: void, parent: Parent, callback: () => MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<NarrowToExpected<Key, keyof Parent>>;
579
524
  /**
580
525
  * Repeatedly calls a callback until its output is a key that is _not_ contained within the
581
526
  * first, parent value. Once the callback output passes, it is returned. If the attempts
@@ -597,7 +542,7 @@ export declare const keyGuards: {
597
542
  * @see
598
543
  * - {@link waitUntil.isNotKeyOf} : the opposite assertion.
599
544
  */
600
- isNotKeyOf: <const Key extends PropertyKey, const Parent>(parent: Parent, callback: () => MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Key, RequiredKeysOf<Parent>>>;
545
+ isNotKeyOf: <const Key extends PropertyKey, const Parent>(this: void, parent: Parent, callback: () => MaybePromise<Key>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Key, RequiredKeysOf<Parent>>>;
601
546
  /**
602
547
  * Repeatedly calls a callback until its output is a parent value that has the first, key
603
548
  * input. Once the callback output passes, it is returned. If the attempts time out, an
@@ -624,7 +569,7 @@ export declare const keyGuards: {
624
569
  * - {@link waitUntil.lacksKey} : the opposite assertion.
625
570
  * - {@link waitUntil.hasKeys} : the multi-key assertion.
626
571
  */
627
- hasKey: <const Parent, const Key extends PropertyKey>(key: Key, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<CombineTypeWithKey<Key, Parent>>;
572
+ hasKey: <const Parent, const Key extends PropertyKey>(this: void, key: Key, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<CombineTypeWithKey<Key, Parent>>;
628
573
  /**
629
574
  * Repeatedly calls a callback until its output is a parent value that does not have the
630
575
  * first, key input. Once the callback output passes, it is returned. If the attempts time
@@ -651,7 +596,7 @@ export declare const keyGuards: {
651
596
  * - {@link waitUntil.hasKey} : the opposite assertion.
652
597
  * - {@link waitUntil.lacksKeys} : the multi-key assertion.
653
598
  */
654
- lacksKey: <const Parent, const Key extends PropertyKey>(key: Key, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Record<Key, any>>>;
599
+ lacksKey: <const Parent, const Key extends PropertyKey>(this: void, key: Key, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Record<Key, any>>>;
655
600
  /**
656
601
  * Repeatedly calls a callback until its output is a parent value that has all of the first,
657
602
  * keys input. Once the callback output passes, it is returned. If the attempts time out, an
@@ -664,24 +609,12 @@ export declare const keyGuards: {
664
609
  * ```ts
665
610
  * import {waitUntil} from '@augment-vir/assert';
666
611
  *
667
- * await waitUntil.hasKeys(
668
- * [
669
- * 'a',
670
- * 'b',
671
- * ],
672
- * () => {
673
- * return {a: 0, b: 1};
674
- * },
675
- * ); // returns `{a: 0, b: 1}`
676
- * await waitUntil.hasKeys(
677
- * [
678
- * 'b',
679
- * 'c',
680
- * ],
681
- * () => {
682
- * return {a: 0, b: 1};
683
- * },
684
- * ); // throws an error
612
+ * await waitUntil.hasKeys(['a', 'b'], () => {
613
+ * return {a: 0, b: 1};
614
+ * }); // returns `{a: 0, b: 1}`
615
+ * await waitUntil.hasKeys(['b', 'c'], () => {
616
+ * return {a: 0, b: 1};
617
+ * }); // throws an error
685
618
  * ```
686
619
  *
687
620
  * @returns The callback output once it passes.
@@ -690,7 +623,7 @@ export declare const keyGuards: {
690
623
  * - {@link waitUntil.lacksKeys} : the opposite assertion.
691
624
  * - {@link waitUntil.hasKey} : the single-key assertion.
692
625
  */
693
- hasKeys: <const Keys extends PropertyKey, const Parent>(keys: ReadonlyArray<Keys>, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<CombineTypeWithKey<Keys, Parent>>;
626
+ hasKeys: <const Keys extends PropertyKey, const Parent>(this: void, keys: ReadonlyArray<Keys>, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<CombineTypeWithKey<Keys, Parent>>;
694
627
  /**
695
628
  * Repeatedly calls a callback until its output is a parent value that does not have any of
696
629
  * the first, keys input. Once the callback output passes, it is returned. If the attempts
@@ -703,24 +636,12 @@ export declare const keyGuards: {
703
636
  * ```ts
704
637
  * import {waitUntil} from '@augment-vir/assert';
705
638
  *
706
- * await waitUntil.hasKeys(
707
- * [
708
- * 'a',
709
- * 'b',
710
- * ],
711
- * () => {
712
- * return {a: 0, b: 1};
713
- * },
714
- * ); // throws an error
715
- * await waitUntil.hasKeys(
716
- * [
717
- * 'b',
718
- * 'c',
719
- * ],
720
- * () => {
721
- * return {a: 0, b: 1};
722
- * },
723
- * ); // returns `{a: 0, b: 1}`
639
+ * await waitUntil.hasKeys(['a', 'b'], () => {
640
+ * return {a: 0, b: 1};
641
+ * }); // throws an error
642
+ * await waitUntil.hasKeys(['b', 'c'], () => {
643
+ * return {a: 0, b: 1};
644
+ * }); // returns `{a: 0, b: 1}`
724
645
  * ```
725
646
  *
726
647
  * @returns The callback output once it passes.
@@ -729,7 +650,7 @@ export declare const keyGuards: {
729
650
  * - {@link waitUntil.hasKeys} : the opposite assertion.
730
651
  * - {@link waitUntil.lacksKey} : the single-key assertion.
731
652
  */
732
- lacksKeys: <const Parent, const Keys extends PropertyKey>(keys: ReadonlyArray<Keys>, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Partial<Record<Keys, any>>>>;
653
+ lacksKeys: <const Parent, const Keys extends PropertyKey>(this: void, keys: ReadonlyArray<Keys>, callback: () => MaybePromise<Parent>, options?: WaitUntilOptions | undefined, failureMessage?: string | undefined) => Promise<Exclude<Parent, Partial<Record<Keys, any>>>>;
733
654
  };
734
655
  };
735
656
  export {};