@augment-vir/assert 30.0.0 → 30.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 (65) hide show
  1. package/README.md +11 -0
  2. package/dist/assertions/boolean.d.ts +443 -17
  3. package/dist/assertions/boolean.js +365 -8
  4. package/dist/assertions/boundary.d.ts +657 -13
  5. package/dist/assertions/boundary.js +537 -5
  6. package/dist/assertions/enum.d.ts +236 -8
  7. package/dist/assertions/enum.js +197 -5
  8. package/dist/assertions/equality/entry-equality.d.ts +287 -11
  9. package/dist/assertions/equality/entry-equality.js +243 -6
  10. package/dist/assertions/equality/json-equality.d.ts +244 -15
  11. package/dist/assertions/equality/json-equality.js +207 -11
  12. package/dist/assertions/equality/simple-equality.d.ts +849 -28
  13. package/dist/assertions/equality/simple-equality.js +712 -6
  14. package/dist/assertions/equality/ts-type-equality.d.ts +37 -1
  15. package/dist/assertions/equality/ts-type-equality.js +13 -1
  16. package/dist/assertions/extendable-assertions.d.ts +288 -120
  17. package/dist/assertions/extendable-assertions.js +32 -60
  18. package/dist/assertions/http.d.ts +217 -10
  19. package/dist/assertions/http.js +182 -6
  20. package/dist/assertions/instance.d.ts +189 -8
  21. package/dist/assertions/instance.js +159 -5
  22. package/dist/assertions/keys.d.ts +658 -13
  23. package/dist/assertions/keys.js +556 -5
  24. package/dist/assertions/length.d.ts +381 -9
  25. package/dist/assertions/length.js +309 -5
  26. package/dist/assertions/nullish.d.ts +169 -7
  27. package/dist/assertions/nullish.js +137 -6
  28. package/dist/assertions/numeric.d.ts +965 -11
  29. package/dist/assertions/numeric.js +819 -1
  30. package/dist/assertions/output.d.ts +107 -7
  31. package/dist/assertions/output.js +92 -5
  32. package/dist/assertions/primitive.d.ts +416 -13
  33. package/dist/assertions/primitive.js +352 -6
  34. package/dist/assertions/promise.d.ts +640 -21
  35. package/dist/assertions/promise.js +536 -15
  36. package/dist/assertions/regexp.d.ts +202 -3
  37. package/dist/assertions/regexp.js +173 -1
  38. package/dist/assertions/runtime-type.d.ts +1822 -41
  39. package/dist/assertions/runtime-type.js +1558 -35
  40. package/dist/assertions/throws.d.ts +265 -17
  41. package/dist/assertions/throws.js +229 -17
  42. package/dist/assertions/uuid.d.ts +233 -10
  43. package/dist/assertions/uuid.js +195 -6
  44. package/dist/assertions/values.d.ts +1086 -15
  45. package/dist/assertions/values.js +907 -6
  46. package/dist/augments/assertion.error.d.ts +2 -1
  47. package/dist/augments/assertion.error.js +2 -1
  48. package/dist/augments/guards/assert-wrap.d.ts +82 -37
  49. package/dist/augments/guards/assert-wrap.js +13 -2
  50. package/dist/augments/guards/assert.d.ts +30 -14
  51. package/dist/augments/guards/assert.js +21 -4
  52. package/dist/augments/guards/check-wrap.d.ts +94 -51
  53. package/dist/augments/guards/check-wrap.js +11 -3
  54. package/dist/augments/guards/check.d.ts +87 -37
  55. package/dist/augments/guards/check.js +9 -2
  56. package/dist/augments/guards/wait-until.d.ts +110 -103
  57. package/dist/augments/guards/wait-until.js +18 -3
  58. package/dist/augments/if-equals.d.ts +4 -2
  59. package/dist/guard-types/assert-wrap-function.d.ts +5 -2
  60. package/dist/guard-types/check-function.d.ts +5 -2
  61. package/dist/guard-types/check-wrap-wrapper-function.d.ts +4 -1
  62. package/dist/guard-types/guard-group.d.ts +7 -8
  63. package/dist/guard-types/wait-until-function.d.ts +8 -3
  64. package/dist/guard-types/wait-until-function.js +1 -1
  65. package/package.json +17 -4
@@ -19,7 +19,7 @@ input: Actual): AssertTypeOf<Actual>;
19
19
  /** Uses the expect-type package to assert type matching. */
20
20
  declare function tsType<Actual>(): AssertTypeOf<Actual>;
21
21
  export declare const tsTypeGuards: {
22
- assertions: {
22
+ assert: {
23
23
  /**
24
24
  * Check if a value or type matches type expectations. Use this to write type tests.
25
25
  *
@@ -36,7 +36,43 @@ export declare const tsTypeGuards: {
36
36
  * assert.tsType('hello').equals<string>();
37
37
  * ```
38
38
  */
39
+ /**
40
+ * Asserts within the TypeScript type system that a given type or value matches type
41
+ * expectations (using the [`expect-type`](https://www.npmjs.com/package/expect-type) package.
42
+ * Make sure to call a method on the first call to actually assert anything.
43
+ *
44
+ * Use this to write type tests. Don't use this in production code. It won't cause issues, but
45
+ * it's a useless no-op at run-time (it's not even a type guard).
46
+ *
47
+ * Performs no type guarding.
48
+ *
49
+ * @example
50
+ *
51
+ * ```ts
52
+ * import {assert} from '@augment-vir/assert';
53
+ *
54
+ * assert.tsType('hello').equals<string>();
55
+ * assert.tsType<'hello>().equals<'hello'>();
56
+ * assert.tsType<'hello>().notEquals<string>();
57
+ * assert.tsType('hello').notEquals<number>();
58
+ * ```
59
+ *
60
+ * @returns Never returns anything.
61
+ * @throws Never throws anything.
62
+ */
39
63
  tsType: typeof tsType;
40
64
  };
65
+ assertWrap: {
66
+ tsType: undefined;
67
+ };
68
+ check: {
69
+ tsType: undefined;
70
+ };
71
+ checkWrap: {
72
+ tsType: undefined;
73
+ };
74
+ waitUntil: {
75
+ tsType: undefined;
76
+ };
41
77
  };
42
78
  export {};
@@ -14,5 +14,17 @@ const assertions = {
14
14
  tsType,
15
15
  };
16
16
  export const tsTypeGuards = {
17
- assertions,
17
+ assert: assertions,
18
+ assertWrap: {
19
+ tsType: undefined,
20
+ },
21
+ check: {
22
+ tsType: undefined,
23
+ },
24
+ checkWrap: {
25
+ tsType: undefined,
26
+ },
27
+ waitUntil: {
28
+ tsType: undefined,
29
+ },
18
30
  };