@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.
- package/README.md +11 -0
- package/dist/assertions/boolean.d.ts +443 -17
- package/dist/assertions/boolean.js +365 -8
- package/dist/assertions/boundary.d.ts +657 -13
- package/dist/assertions/boundary.js +537 -5
- package/dist/assertions/enum.d.ts +236 -8
- package/dist/assertions/enum.js +197 -5
- package/dist/assertions/equality/entry-equality.d.ts +287 -11
- package/dist/assertions/equality/entry-equality.js +243 -6
- package/dist/assertions/equality/json-equality.d.ts +244 -15
- package/dist/assertions/equality/json-equality.js +207 -11
- package/dist/assertions/equality/simple-equality.d.ts +849 -28
- package/dist/assertions/equality/simple-equality.js +712 -6
- package/dist/assertions/equality/ts-type-equality.d.ts +37 -1
- package/dist/assertions/equality/ts-type-equality.js +13 -1
- package/dist/assertions/extendable-assertions.d.ts +288 -120
- package/dist/assertions/extendable-assertions.js +32 -60
- package/dist/assertions/http.d.ts +217 -10
- package/dist/assertions/http.js +182 -6
- package/dist/assertions/instance.d.ts +189 -8
- package/dist/assertions/instance.js +159 -5
- package/dist/assertions/keys.d.ts +658 -13
- package/dist/assertions/keys.js +556 -5
- package/dist/assertions/length.d.ts +381 -9
- package/dist/assertions/length.js +309 -5
- package/dist/assertions/nullish.d.ts +169 -7
- package/dist/assertions/nullish.js +137 -6
- package/dist/assertions/numeric.d.ts +965 -11
- package/dist/assertions/numeric.js +819 -1
- package/dist/assertions/output.d.ts +107 -7
- package/dist/assertions/output.js +92 -5
- package/dist/assertions/primitive.d.ts +416 -13
- package/dist/assertions/primitive.js +352 -6
- package/dist/assertions/promise.d.ts +640 -21
- package/dist/assertions/promise.js +536 -15
- package/dist/assertions/regexp.d.ts +202 -3
- package/dist/assertions/regexp.js +173 -1
- package/dist/assertions/runtime-type.d.ts +1822 -41
- package/dist/assertions/runtime-type.js +1558 -35
- package/dist/assertions/throws.d.ts +265 -17
- package/dist/assertions/throws.js +229 -17
- package/dist/assertions/uuid.d.ts +233 -10
- package/dist/assertions/uuid.js +195 -6
- package/dist/assertions/values.d.ts +1086 -15
- package/dist/assertions/values.js +907 -6
- package/dist/augments/assertion.error.d.ts +2 -1
- package/dist/augments/assertion.error.js +2 -1
- package/dist/augments/guards/assert-wrap.d.ts +82 -37
- package/dist/augments/guards/assert-wrap.js +13 -2
- package/dist/augments/guards/assert.d.ts +30 -14
- package/dist/augments/guards/assert.js +21 -4
- package/dist/augments/guards/check-wrap.d.ts +94 -51
- package/dist/augments/guards/check-wrap.js +11 -3
- package/dist/augments/guards/check.d.ts +87 -37
- package/dist/augments/guards/check.js +9 -2
- package/dist/augments/guards/wait-until.d.ts +110 -103
- package/dist/augments/guards/wait-until.js +18 -3
- package/dist/augments/if-equals.d.ts +4 -2
- package/dist/guard-types/assert-wrap-function.d.ts +5 -2
- package/dist/guard-types/check-function.d.ts +5 -2
- package/dist/guard-types/check-wrap-wrapper-function.d.ts +4 -1
- package/dist/guard-types/guard-group.d.ts +7 -8
- package/dist/guard-types/wait-until-function.d.ts +8 -3
- package/dist/guard-types/wait-until-function.js +1 -1
- 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
|
-
|
|
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
|
};
|