@augment-vir/assert 30.0.0

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 (99) hide show
  1. package/LICENSE-CC0 +121 -0
  2. package/LICENSE-MIT +21 -0
  3. package/dist/assertions/boolean.d.ts +97 -0
  4. package/dist/assertions/boolean.js +47 -0
  5. package/dist/assertions/boundary.d.ts +83 -0
  6. package/dist/assertions/boundary.js +104 -0
  7. package/dist/assertions/enum.d.ts +38 -0
  8. package/dist/assertions/enum.js +42 -0
  9. package/dist/assertions/equality/entry-equality.d.ts +40 -0
  10. package/dist/assertions/equality/entry-equality.js +56 -0
  11. package/dist/assertions/equality/json-equality.d.ts +42 -0
  12. package/dist/assertions/equality/json-equality.js +75 -0
  13. package/dist/assertions/equality/simple-equality.d.ts +85 -0
  14. package/dist/assertions/equality/simple-equality.js +61 -0
  15. package/dist/assertions/equality/ts-type-equality.d.ts +42 -0
  16. package/dist/assertions/equality/ts-type-equality.js +18 -0
  17. package/dist/assertions/extendable-assertions.d.ts +762 -0
  18. package/dist/assertions/extendable-assertions.js +108 -0
  19. package/dist/assertions/http.d.ts +36 -0
  20. package/dist/assertions/http.js +41 -0
  21. package/dist/assertions/instance.d.ts +43 -0
  22. package/dist/assertions/instance.js +41 -0
  23. package/dist/assertions/keys.d.ts +90 -0
  24. package/dist/assertions/keys.js +111 -0
  25. package/dist/assertions/length.d.ts +56 -0
  26. package/dist/assertions/length.js +68 -0
  27. package/dist/assertions/nullish.d.ts +43 -0
  28. package/dist/assertions/nullish.js +42 -0
  29. package/dist/assertions/numeric.d.ts +69 -0
  30. package/dist/assertions/numeric.js +60 -0
  31. package/dist/assertions/output.d.ts +83 -0
  32. package/dist/assertions/output.example.d.ts +1 -0
  33. package/dist/assertions/output.example.js +13 -0
  34. package/dist/assertions/output.js +173 -0
  35. package/dist/assertions/primitive.d.ts +58 -0
  36. package/dist/assertions/primitive.js +62 -0
  37. package/dist/assertions/promise.d.ts +65 -0
  38. package/dist/assertions/promise.js +69 -0
  39. package/dist/assertions/regexp.d.ts +19 -0
  40. package/dist/assertions/regexp.js +18 -0
  41. package/dist/assertions/runtime-type.d.ts +274 -0
  42. package/dist/assertions/runtime-type.example.d.ts +1 -0
  43. package/dist/assertions/runtime-type.example.js +3 -0
  44. package/dist/assertions/runtime-type.js +242 -0
  45. package/dist/assertions/throws.d.ts +109 -0
  46. package/dist/assertions/throws.example.d.ts +1 -0
  47. package/dist/assertions/throws.example.js +11 -0
  48. package/dist/assertions/throws.js +166 -0
  49. package/dist/assertions/uuid.d.ts +35 -0
  50. package/dist/assertions/uuid.js +33 -0
  51. package/dist/assertions/values.d.ts +106 -0
  52. package/dist/assertions/values.js +113 -0
  53. package/dist/augments/assertion-exports.d.ts +5 -0
  54. package/dist/augments/assertion-exports.js +1 -0
  55. package/dist/augments/assertion.error.d.ts +23 -0
  56. package/dist/augments/assertion.error.example.d.ts +1 -0
  57. package/dist/augments/assertion.error.example.js +3 -0
  58. package/dist/augments/assertion.error.js +26 -0
  59. package/dist/augments/guards/assert-wrap.d.ts +244 -0
  60. package/dist/augments/guards/assert-wrap.example.d.ts +1 -0
  61. package/dist/augments/guards/assert-wrap.example.js +9 -0
  62. package/dist/augments/guards/assert-wrap.js +32 -0
  63. package/dist/augments/guards/assert.d.ts +177 -0
  64. package/dist/augments/guards/assert.example.d.ts +1 -0
  65. package/dist/augments/guards/assert.example.js +4 -0
  66. package/dist/augments/guards/assert.js +32 -0
  67. package/dist/augments/guards/check-wrap.d.ts +247 -0
  68. package/dist/augments/guards/check-wrap.example.d.ts +1 -0
  69. package/dist/augments/guards/check-wrap.example.js +9 -0
  70. package/dist/augments/guards/check-wrap.js +34 -0
  71. package/dist/augments/guards/check.d.ts +229 -0
  72. package/dist/augments/guards/check.example.d.ts +1 -0
  73. package/dist/augments/guards/check.example.js +5 -0
  74. package/dist/augments/guards/check.js +21 -0
  75. package/dist/augments/guards/wait-until.d.ts +262 -0
  76. package/dist/augments/guards/wait-until.example.d.ts +1 -0
  77. package/dist/augments/guards/wait-until.example.js +13 -0
  78. package/dist/augments/guards/wait-until.js +34 -0
  79. package/dist/augments/if-equals.d.ts +17 -0
  80. package/dist/augments/if-equals.js +1 -0
  81. package/dist/guard-types/assert-function.d.ts +2 -0
  82. package/dist/guard-types/assert-function.js +3 -0
  83. package/dist/guard-types/assert-wrap-function.d.ts +9 -0
  84. package/dist/guard-types/assert-wrap-function.js +14 -0
  85. package/dist/guard-types/check-function.d.ts +11 -0
  86. package/dist/guard-types/check-function.js +22 -0
  87. package/dist/guard-types/check-wrap-wrapper-function.d.ts +9 -0
  88. package/dist/guard-types/check-wrap-wrapper-function.js +19 -0
  89. package/dist/guard-types/guard-group.d.ts +13 -0
  90. package/dist/guard-types/guard-group.js +3 -0
  91. package/dist/guard-types/guard-override.d.ts +4 -0
  92. package/dist/guard-types/guard-override.js +10 -0
  93. package/dist/guard-types/wait-until-function.d.ts +63 -0
  94. package/dist/guard-types/wait-until-function.js +95 -0
  95. package/dist/index.d.ts +9 -0
  96. package/dist/index.js +8 -0
  97. package/dist/test-timeout.mock.d.ts +3 -0
  98. package/dist/test-timeout.mock.js +8 -0
  99. package/package.json +54 -0
@@ -0,0 +1,247 @@
1
+ /**
2
+ * A group of guard methods that do the following:
3
+ *
4
+ * 1. Run the method's assertion on the given inputs.
5
+ * 2. If the assertion fails, return `undefined`.
6
+ * 3. If the assertion succeeds, the first input is returned and (when possible) type guarded.
7
+ *
8
+ * This is a combination of {@link assertWrap} and {@link check}.
9
+ *
10
+ * @category Assert
11
+ * @example
12
+ *
13
+ * ```ts
14
+ * import {checkWrap} from '@augment-vir/assert';
15
+ *
16
+ * // `result1` will be `['a']`
17
+ * const result1 = checkWrap.deepEquals(['a'], ['a']);
18
+ *
19
+ * const value: unknown = 'some value' as unknown;
20
+ * // `result2` will be `'some value'` and it will have the type of `string`
21
+ * const result2 = checkWrap.isString(value);
22
+ *
23
+ * const value2: unknown = 'some value' as unknown;
24
+ * // `result` will be `undefined`
25
+ * const result3 = checkWrap.isNumber(value2);
26
+ * ```
27
+ *
28
+ * @returns The original given value (type guarded when possible) or, if the expectation fails,
29
+ * `undefined`.
30
+ * @package @augment-vir/assert
31
+ */
32
+ export declare const checkWrap: import("../../guard-types/check-wrap-wrapper-function.js").CheckWrapGroup<{
33
+ output: {
34
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
35
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
36
+ };
37
+ isHttpStatus: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").HttpStatus;
38
+ isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>;
39
+ hasValue: (parent: object, value: unknown, failureMessage?: string | undefined) => void;
40
+ lacksValue: (parent: object, value: unknown, failureMessage?: string | undefined) => void;
41
+ hasValues: (parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined) => void;
42
+ lacksValues: (parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined) => void;
43
+ isIn: typeof import("../../assertions/values.js").isIn;
44
+ isNotIn: <const Parent extends object | string, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined) => asserts child is Exclude<Child, import("@augment-vir/core").Values<Parent>>;
45
+ isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>;
46
+ isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("../assertion-exports.js").Empty>;
47
+ isUuid: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").Uuid;
48
+ isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").Uuid>;
49
+ isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
50
+ throws: {
51
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
52
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Promise<void>;
53
+ (callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
54
+ (callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<void>;
55
+ };
56
+ strictEquals: typeof import("../../assertions/equality/simple-equality.js").strictEquals;
57
+ notStrictEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
58
+ looseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
59
+ notLooseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
60
+ deepEquals: typeof import("../../assertions/equality/simple-equality.js").deepEquals;
61
+ notDeepEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
62
+ isArray: (actual: unknown, failureMessage?: string | undefined) => asserts actual is unknown[];
63
+ isBigInt: (actual: unknown, failureMessage?: string | undefined) => asserts actual is bigint;
64
+ isBoolean: (actual: unknown, failureMessage?: string | undefined) => asserts actual is boolean;
65
+ isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>;
66
+ isNull: (actual: unknown, failureMessage?: string | undefined) => asserts actual is null;
67
+ isNumber: (actual: unknown, failureMessage?: string | undefined) => asserts actual is number;
68
+ isObject: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").UnknownObject;
69
+ isString: (actual: unknown, failureMessage?: string | undefined) => asserts actual is string;
70
+ isSymbol: (actual: unknown, failureMessage?: string | undefined) => asserts actual is symbol;
71
+ isUndefined: (actual: unknown, failureMessage?: string | undefined) => asserts actual is undefined;
72
+ isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, ReadonlyArray<unknown>>;
73
+ isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, bigint>;
74
+ isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, boolean>;
75
+ isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").AnyFunction>;
76
+ isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, number>;
77
+ isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").UnknownObject>;
78
+ isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, string>;
79
+ isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, symbol>;
80
+ isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, undefined>;
81
+ isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
82
+ matches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
83
+ mismatches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
84
+ isPromiseLike: (actual: unknown, failureMessage?: string | undefined) => asserts actual is PromiseLike<any>;
85
+ isNotPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, PromiseLike<any>>;
86
+ isPromise: (actual: unknown, failureMessage?: string | undefined) => asserts actual is Promise<any>;
87
+ isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, Promise<any>>;
88
+ isPropertyKey: (input: unknown, failureMessage?: string | undefined) => asserts input is PropertyKey;
89
+ isNotPropertyKey: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, PropertyKey>;
90
+ isPrimitive: (input: unknown, failureMessage?: string | undefined) => asserts input is import("type-fest").Primitive;
91
+ isNotPrimitive: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, import("type-fest").Primitive>;
92
+ isAbove: (actual: number, expected: number, failureMessage?: string | undefined) => void;
93
+ isAtLeast: (actual: number, expected: number, failureMessage?: string | undefined) => void;
94
+ isBelow: (actual: number, expected: number, failureMessage?: string | undefined) => void;
95
+ isAtMost: (actual: number, expected: number, failureMessage?: string | undefined) => void;
96
+ isNaN: (actual: number, failureMessage?: string | undefined) => void;
97
+ isFinite: (actual: number, failureMessage?: string | undefined) => void;
98
+ isInfinite: (actual: number, failureMessage?: string | undefined) => void;
99
+ isApproximately: (actual: number, expected: number, delta: number, failureMessage?: string | undefined) => void;
100
+ isNotApproximately: (actual: number, expected: number, delta: number, failureMessage?: string | undefined) => void;
101
+ isDefined: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, undefined | null>;
102
+ isNullish: (input: unknown, failureMessage?: string | undefined) => asserts input is null | undefined;
103
+ isLengthAtLeast: {
104
+ <const Element, const Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length, failureMessage?: string | undefined): asserts actual is import("@augment-vir/core").AtLeastTuple<Element, Length>;
105
+ (actual: string | import("@augment-vir/core").AnyObject, length: number, failureMessage?: string | undefined): void;
106
+ };
107
+ isLengthExactly: {
108
+ <const Element, const Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length, failureMessage?: string | undefined): asserts actual is import("@augment-vir/core").Tuple<Element, Length>;
109
+ (actual: string | import("@augment-vir/core").AnyObject, length: number, failureMessage?: string | undefined): void;
110
+ };
111
+ isKeyOf: <const Parent>(key: PropertyKey, parent: Parent, failureMessage?: string | undefined) => asserts key is keyof Parent;
112
+ isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => asserts key is Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>>;
113
+ hasKey: <const Key extends PropertyKey, const Parent>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Parent & Record<Key, (Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>;
114
+ lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Record<Key, any>>;
115
+ hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined) => asserts parent is Parent & Record<Keys, (Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>;
116
+ lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Partial<Record<Key, any>>>;
117
+ jsonEquals: <const Actual, const Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => asserts actual is Expected;
118
+ notJsonEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
119
+ instanceOf: <const Instance>(instance: unknown, constructor: import("type-fest").Constructor<Instance>, failureMessage?: string | undefined) => asserts instance is Instance;
120
+ notInstanceOf: <const Actual, const Instance>(instance: Actual, constructor: import("type-fest").Constructor<Instance>, failureMessage?: string | undefined) => asserts instance is Exclude<Actual, Instance>;
121
+ isEnumValue: typeof import("../../assertions/enum.js").isEnumValue;
122
+ isNotEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected, failureMessage?: string | undefined) => asserts child is Exclude<Actual, Expected[keyof Expected] | `${Expected[keyof Expected]}`>;
123
+ entriesEqual: <const Actual extends object, const Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => asserts actual is Expected;
124
+ notEntriesEqual: (actual: object, expected: object, failureMessage?: string | undefined) => void;
125
+ endsWith: {
126
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
127
+ (parent: string, child: string, failureMessage?: string | undefined): void;
128
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
129
+ };
130
+ endsWithout: {
131
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
132
+ (parent: string, child: string, failureMessage?: string | undefined): void;
133
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
134
+ };
135
+ startsWith: {
136
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
137
+ (parent: string, child: string, failureMessage?: string | undefined): void;
138
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
139
+ };
140
+ startsWithout: {
141
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
142
+ (parent: string, child: string, failureMessage?: string | undefined): void;
143
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
144
+ };
145
+ isFalsy: (input: unknown, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").FalsyValue;
146
+ isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
147
+ isTrue: (input: unknown, failureMessage?: string | undefined) => asserts input is true;
148
+ isFalse: (input: unknown, failureMessage?: string | undefined) => asserts input is false;
149
+ }, {
150
+ isFalsy: <T>(input: T) => import("../assertion-exports.js").Falsy<T> | undefined;
151
+ isTruthy: <T>(input: T) => import("../assertion-exports.js").Truthy<T> | undefined;
152
+ } & {
153
+ strictEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => Expected | undefined;
154
+ deepEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => import("@augment-vir/core").NarrowToExpected<Actual, Expected> | undefined;
155
+ } & {
156
+ output: {
157
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined : Promise<Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined> : Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined;
158
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined : Promise<Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined> : Awaited<ReturnType<NoInfer<FunctionToCall>>> | undefined;
159
+ };
160
+ } & {
161
+ isFunction: <const Actual>(actual: Actual) => import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction> | undefined;
162
+ isUndefined: undefined;
163
+ isNotUndefined: undefined;
164
+ isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, ReadonlyArray<unknown>> | undefined;
165
+ isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, bigint> | undefined;
166
+ isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, boolean> | undefined;
167
+ isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("@augment-vir/core").AnyFunction> | undefined;
168
+ isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, null> | undefined;
169
+ isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, number> | undefined;
170
+ isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("@augment-vir/core").UnknownObject> | undefined;
171
+ isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, string> | undefined;
172
+ isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, symbol> | undefined;
173
+ } & {
174
+ throws: {
175
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Error | undefined;
176
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Promise<Error | undefined>;
177
+ (callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Error | undefined;
178
+ (callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<Error | undefined>;
179
+ };
180
+ } & {
181
+ isIn: <const Child, const Parent>(child: Child, parent: Parent) => import("@augment-vir/core").NarrowToExpected<Child, import("@augment-vir/core").Values<Parent>> | undefined;
182
+ isNotIn: <const Parent, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined) => Exclude<Child, import("@augment-vir/core").Values<Parent>> | undefined;
183
+ isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual) => import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty> | undefined;
184
+ isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual) => Exclude<Actual, import("../assertion-exports.js").Empty> | undefined;
185
+ } & {
186
+ endsWith: {
187
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): typeof parent | undefined;
188
+ (parent: string, child: string, failureMessage?: string | undefined): typeof parent | undefined;
189
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): typeof parent | undefined;
190
+ };
191
+ endsWithout: {
192
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): typeof parent | undefined;
193
+ (parent: string, child: string, failureMessage?: string | undefined): typeof parent | undefined;
194
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): typeof parent | undefined;
195
+ };
196
+ startsWith: {
197
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): typeof parent | undefined;
198
+ (parent: string, child: string, failureMessage?: string | undefined): typeof parent | undefined;
199
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): typeof parent | undefined;
200
+ };
201
+ startsWithout: {
202
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): typeof parent | undefined;
203
+ (parent: string, child: string, failureMessage?: string | undefined): typeof parent | undefined;
204
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): typeof parent | undefined;
205
+ };
206
+ } & {
207
+ isEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected) => import("@augment-vir/core").NarrowToExpected<Actual, Expected[keyof Expected]> | undefined;
208
+ isNotEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected) => Exclude<Actual, Expected[keyof Expected] | `${Expected[keyof Expected]}`> | undefined;
209
+ } & {
210
+ entriesEqual: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => import("@augment-vir/core").NarrowToExpected<Actual, Expected> | undefined;
211
+ } & {
212
+ jsonEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => import("@augment-vir/core").NarrowToExpected<Actual, Expected> | undefined;
213
+ } & {
214
+ isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>> | undefined;
215
+ } & {
216
+ instanceOf: <const Instance>(instance: unknown, constructor: import("type-fest").Constructor<Instance>) => Instance | undefined;
217
+ notInstanceOf: <const Actual, const Instance>(instance: Actual, constructor: import("type-fest").Constructor<Instance>) => Exclude<Actual, Instance> | undefined;
218
+ } & {
219
+ isKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent) => import("@augment-vir/core").NarrowToExpected<Key, keyof Parent> | undefined;
220
+ isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>> | undefined;
221
+ hasKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key) => (Parent & Record<Key, (Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>) | undefined;
222
+ lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => Exclude<Parent, Record<Key, any>> | undefined;
223
+ hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>) => (Parent & Record<Keys, (Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>) | undefined;
224
+ lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, key: ReadonlyArray<Key>) => Exclude<Parent, Partial<Record<Key, any>>> | undefined;
225
+ } & {
226
+ isLengthAtLeast: {
227
+ <Element, Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length): import("@augment-vir/core").AtLeastTuple<Element, Length> | undefined;
228
+ <Actual extends string | import("@augment-vir/core").AnyObject>(actual: Actual, length: number): Actual | undefined;
229
+ };
230
+ isLengthExactly: {
231
+ <Element, Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length): import("@augment-vir/core").Tuple<Element, Length> | undefined;
232
+ <Actual extends string | import("@augment-vir/core").AnyObject>(actual: Actual, length: number): Actual | undefined;
233
+ };
234
+ } & {
235
+ isDefined: undefined;
236
+ isNullish: undefined;
237
+ } & {
238
+ isNotPrimitive: <const Actual>(input: Actual) => Exclude<Actual, import("type-fest").Primitive> | undefined;
239
+ isNotPropertyKey: <const Actual>(input: Actual) => Exclude<Actual, PropertyKey> | undefined;
240
+ } & {
241
+ isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, Promise<any>> | undefined;
242
+ isNotPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, PromiseLike<any>> | undefined;
243
+ } & {
244
+ isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("@augment-vir/core").Uuid> | undefined;
245
+ }>;
246
+ /** Type of {@link checkWrap}. */
247
+ export type CheckWrap = typeof checkWrap;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { checkWrap } from '@augment-vir/assert';
2
+ // `result1` will be `['a']`
3
+ const result1 = checkWrap.deepEquals(['a'], ['a']);
4
+ const value = 'some value';
5
+ // `result2` will be `'some value'` and it will have the type of `string`
6
+ const result2 = checkWrap.isString(value);
7
+ const value2 = 'some value';
8
+ // `result` will be `undefined`
9
+ const result3 = checkWrap.isNumber(value2);
@@ -0,0 +1,34 @@
1
+ import { checkWrapOverrides, extendableAssertions } from '../../assertions/extendable-assertions.js';
2
+ import { createCheckWrapGroup } from '../../guard-types/check-wrap-wrapper-function.js';
3
+ /**
4
+ * A group of guard methods that do the following:
5
+ *
6
+ * 1. Run the method's assertion on the given inputs.
7
+ * 2. If the assertion fails, return `undefined`.
8
+ * 3. If the assertion succeeds, the first input is returned and (when possible) type guarded.
9
+ *
10
+ * This is a combination of {@link assertWrap} and {@link check}.
11
+ *
12
+ * @category Assert
13
+ * @example
14
+ *
15
+ * ```ts
16
+ * import {checkWrap} from '@augment-vir/assert';
17
+ *
18
+ * // `result1` will be `['a']`
19
+ * const result1 = checkWrap.deepEquals(['a'], ['a']);
20
+ *
21
+ * const value: unknown = 'some value' as unknown;
22
+ * // `result2` will be `'some value'` and it will have the type of `string`
23
+ * const result2 = checkWrap.isString(value);
24
+ *
25
+ * const value2: unknown = 'some value' as unknown;
26
+ * // `result` will be `undefined`
27
+ * const result3 = checkWrap.isNumber(value2);
28
+ * ```
29
+ *
30
+ * @returns The original given value (type guarded when possible) or, if the expectation fails,
31
+ * `undefined`.
32
+ * @package @augment-vir/assert
33
+ */
34
+ export const checkWrap = createCheckWrapGroup(extendableAssertions, checkWrapOverrides);
@@ -0,0 +1,229 @@
1
+ /**
2
+ * A group of guard methods that return a boolean type guard rather than an assertion type guard.
3
+ *
4
+ * @category Assert
5
+ * @example
6
+ *
7
+ * ```ts
8
+ * import {check} from '@augment-vir/assert';
9
+ *
10
+ * const value: unknown = 'some value' as unknown;
11
+ * if (check.isString(value)) {
12
+ * // `value` will now be typed as a `string` in here
13
+ * }
14
+ * ```
15
+ *
16
+ * @returns A boolean (as a type guard when possible).
17
+ * @package @augment-vir/assert
18
+ */
19
+ export declare const check: import("../../guard-types/check-function.js").CheckGroup<{
20
+ output: {
21
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
22
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
23
+ };
24
+ isHttpStatus: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").HttpStatus;
25
+ isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>;
26
+ hasValue: (parent: object, value: unknown, failureMessage?: string | undefined) => void;
27
+ lacksValue: (parent: object, value: unknown, failureMessage?: string | undefined) => void;
28
+ hasValues: (parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined) => void;
29
+ lacksValues: (parent: object, values: ReadonlyArray<unknown>, failureMessage?: string | undefined) => void;
30
+ isIn: typeof import("../../assertions/values.js").isIn;
31
+ isNotIn: <const Parent extends object | string, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined) => asserts child is Exclude<Child, import("@augment-vir/core").Values<Parent>>;
32
+ isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>;
33
+ isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("../assertion-exports.js").Empty>;
34
+ isUuid: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").Uuid;
35
+ isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").Uuid>;
36
+ isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
37
+ throws: {
38
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
39
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Promise<void>;
40
+ (callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
41
+ (callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<void>;
42
+ };
43
+ strictEquals: typeof import("../../assertions/equality/simple-equality.js").strictEquals;
44
+ notStrictEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
45
+ looseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
46
+ notLooseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
47
+ deepEquals: typeof import("../../assertions/equality/simple-equality.js").deepEquals;
48
+ notDeepEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
49
+ isArray: (actual: unknown, failureMessage?: string | undefined) => asserts actual is unknown[];
50
+ isBigInt: (actual: unknown, failureMessage?: string | undefined) => asserts actual is bigint;
51
+ isBoolean: (actual: unknown, failureMessage?: string | undefined) => asserts actual is boolean;
52
+ isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>;
53
+ isNull: (actual: unknown, failureMessage?: string | undefined) => asserts actual is null;
54
+ isNumber: (actual: unknown, failureMessage?: string | undefined) => asserts actual is number;
55
+ isObject: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").UnknownObject;
56
+ isString: (actual: unknown, failureMessage?: string | undefined) => asserts actual is string;
57
+ isSymbol: (actual: unknown, failureMessage?: string | undefined) => asserts actual is symbol;
58
+ isUndefined: (actual: unknown, failureMessage?: string | undefined) => asserts actual is undefined;
59
+ isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, ReadonlyArray<unknown>>;
60
+ isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, bigint>;
61
+ isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, boolean>;
62
+ isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").AnyFunction>;
63
+ isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, number>;
64
+ isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").UnknownObject>;
65
+ isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, string>;
66
+ isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, symbol>;
67
+ isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, undefined>;
68
+ isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
69
+ matches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
70
+ mismatches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
71
+ isPromiseLike: (actual: unknown, failureMessage?: string | undefined) => asserts actual is PromiseLike<any>;
72
+ isNotPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, PromiseLike<any>>;
73
+ isPromise: (actual: unknown, failureMessage?: string | undefined) => asserts actual is Promise<any>;
74
+ isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, Promise<any>>;
75
+ isPropertyKey: (input: unknown, failureMessage?: string | undefined) => asserts input is PropertyKey;
76
+ isNotPropertyKey: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, PropertyKey>;
77
+ isPrimitive: (input: unknown, failureMessage?: string | undefined) => asserts input is import("type-fest").Primitive;
78
+ isNotPrimitive: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, import("type-fest").Primitive>;
79
+ isAbove: (actual: number, expected: number, failureMessage?: string | undefined) => void;
80
+ isAtLeast: (actual: number, expected: number, failureMessage?: string | undefined) => void;
81
+ isBelow: (actual: number, expected: number, failureMessage?: string | undefined) => void;
82
+ isAtMost: (actual: number, expected: number, failureMessage?: string | undefined) => void;
83
+ isNaN: (actual: number, failureMessage?: string | undefined) => void;
84
+ isFinite: (actual: number, failureMessage?: string | undefined) => void;
85
+ isInfinite: (actual: number, failureMessage?: string | undefined) => void;
86
+ isApproximately: (actual: number, expected: number, delta: number, failureMessage?: string | undefined) => void;
87
+ isNotApproximately: (actual: number, expected: number, delta: number, failureMessage?: string | undefined) => void;
88
+ isDefined: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is Exclude<Actual, undefined | null>;
89
+ isNullish: (input: unknown, failureMessage?: string | undefined) => asserts input is null | undefined;
90
+ isLengthAtLeast: {
91
+ <const Element, const Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length, failureMessage?: string | undefined): asserts actual is import("@augment-vir/core").AtLeastTuple<Element, Length>;
92
+ (actual: string | import("@augment-vir/core").AnyObject, length: number, failureMessage?: string | undefined): void;
93
+ };
94
+ isLengthExactly: {
95
+ <const Element, const Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length, failureMessage?: string | undefined): asserts actual is import("@augment-vir/core").Tuple<Element, Length>;
96
+ (actual: string | import("@augment-vir/core").AnyObject, length: number, failureMessage?: string | undefined): void;
97
+ };
98
+ isKeyOf: <const Parent>(key: PropertyKey, parent: Parent, failureMessage?: string | undefined) => asserts key is keyof Parent;
99
+ isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => asserts key is Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>>;
100
+ hasKey: <const Key extends PropertyKey, const Parent>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Parent & Record<Key, (Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>;
101
+ lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Record<Key, any>>;
102
+ hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined) => asserts parent is Parent & Record<Keys, (Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>;
103
+ lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Partial<Record<Key, any>>>;
104
+ jsonEquals: <const Actual, const Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => asserts actual is Expected;
105
+ notJsonEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
106
+ instanceOf: <const Instance>(instance: unknown, constructor: import("type-fest").Constructor<Instance>, failureMessage?: string | undefined) => asserts instance is Instance;
107
+ notInstanceOf: <const Actual, const Instance>(instance: Actual, constructor: import("type-fest").Constructor<Instance>, failureMessage?: string | undefined) => asserts instance is Exclude<Actual, Instance>;
108
+ isEnumValue: typeof import("../../assertions/enum.js").isEnumValue;
109
+ isNotEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected, failureMessage?: string | undefined) => asserts child is Exclude<Actual, Expected[keyof Expected] | `${Expected[keyof Expected]}`>;
110
+ entriesEqual: <const Actual extends object, const Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => asserts actual is Expected;
111
+ notEntriesEqual: (actual: object, expected: object, failureMessage?: string | undefined) => void;
112
+ endsWith: {
113
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
114
+ (parent: string, child: string, failureMessage?: string | undefined): void;
115
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
116
+ };
117
+ endsWithout: {
118
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
119
+ (parent: string, child: string, failureMessage?: string | undefined): void;
120
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
121
+ };
122
+ startsWith: {
123
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
124
+ (parent: string, child: string, failureMessage?: string | undefined): void;
125
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
126
+ };
127
+ startsWithout: {
128
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): void;
129
+ (parent: string, child: string, failureMessage?: string | undefined): void;
130
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
131
+ };
132
+ isFalsy: (input: unknown, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").FalsyValue;
133
+ isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
134
+ isTrue: (input: unknown, failureMessage?: string | undefined) => asserts input is true;
135
+ isFalse: (input: unknown, failureMessage?: string | undefined) => asserts input is false;
136
+ }, {
137
+ isTruthy: <T>(input: T) => input is import("../assertion-exports.js").Truthy<T>;
138
+ } & {
139
+ strictEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => actual is Expected;
140
+ deepEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => actual is Expected;
141
+ } & {
142
+ output: {
143
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? boolean : Promise<boolean> : boolean;
144
+ <const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? boolean : Promise<boolean> : boolean;
145
+ };
146
+ } & {
147
+ isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>;
148
+ isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, ReadonlyArray<unknown>>;
149
+ isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, bigint>;
150
+ isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, boolean>;
151
+ isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, import("@augment-vir/core").AnyFunction>;
152
+ isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, null>;
153
+ isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, number>;
154
+ isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, import("@augment-vir/core").UnknownObject>;
155
+ isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, string>;
156
+ isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, undefined>;
157
+ isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, symbol>;
158
+ } & {
159
+ throws: {
160
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined): boolean;
161
+ (callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined): Promise<boolean>;
162
+ (callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined): boolean;
163
+ (callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined): import("@augment-vir/core").MaybePromise<boolean>;
164
+ };
165
+ } & {
166
+ isIn: <const Parent>(child: unknown, parent: Parent) => child is import("@augment-vir/core").Values<Parent>;
167
+ isNotIn: <const Parent, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined) => child is Exclude<Child, import("@augment-vir/core").Values<Parent>>;
168
+ isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual) => actual is import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>;
169
+ isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual) => actual is Exclude<Actual, import("../assertion-exports.js").Empty>;
170
+ } & {
171
+ endsWith: {
172
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): boolean;
173
+ (parent: string, child: string, failureMessage?: string | undefined): boolean;
174
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): boolean;
175
+ };
176
+ endsWithout: {
177
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): boolean;
178
+ (parent: string, child: string, failureMessage?: string | undefined): boolean;
179
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): boolean;
180
+ };
181
+ startsWith: {
182
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): boolean;
183
+ (parent: string, child: string, failureMessage?: string | undefined): boolean;
184
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): boolean;
185
+ };
186
+ startsWithout: {
187
+ <const ArrayElement>(parent: ReadonlyArray<ArrayElement>, child: ArrayElement, failureMessage?: string | undefined): boolean;
188
+ (parent: string, child: string, failureMessage?: string | undefined): boolean;
189
+ (parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): boolean;
190
+ };
191
+ } & {
192
+ isEnumValue: <const Expected extends import("@augment-vir/core").EnumBaseType>(child: unknown, checkEnum: Expected) => child is Expected[keyof Expected];
193
+ isNotEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected) => child is Exclude<Actual, Expected[keyof Expected] | `${Expected[keyof Expected]}`>;
194
+ } & {
195
+ entriesEqual: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => actual is Expected;
196
+ } & {
197
+ jsonEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected) => actual is Expected;
198
+ } & {
199
+ isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => actual is import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>;
200
+ } & {
201
+ instanceOf: <const Instance>(instance: unknown, constructor: import("type-fest").Constructor<Instance>) => instance is Instance;
202
+ notInstanceOf: <const Actual, const Instance>(instance: Actual, constructor: import("type-fest").Constructor<Instance>) => instance is Exclude<Actual, Instance>;
203
+ } & {
204
+ isKeyOf: <const Parent>(key: PropertyKey, parent: Parent) => key is keyof Parent;
205
+ isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => key is Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>>;
206
+ hasKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key) => parent is Parent & Record<Key, (Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>;
207
+ lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => parent is Exclude<Parent, Record<Key, any>>;
208
+ hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>) => parent is Parent & Record<Keys, (Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>;
209
+ lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, key: ReadonlyArray<Key>) => parent is Exclude<Parent, Partial<Record<Key, any>>>;
210
+ } & {
211
+ isLengthAtLeast: {
212
+ <Element, Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length): actual is import("@augment-vir/core").AtLeastTuple<Element, Length>;
213
+ (actual: string | import("@augment-vir/core").AnyObject, length: number): boolean;
214
+ };
215
+ isLengthExactly: {
216
+ <Element, Length extends number>(actual: ReadonlyArray<Element | undefined>, length: Length): actual is import("@augment-vir/core").Tuple<Element, Length>;
217
+ (actual: string | import("@augment-vir/core").AnyObject, length: number): boolean;
218
+ };
219
+ } & {
220
+ isDefined: <Actual>(input: Actual) => input is Exclude<Actual, undefined | null>;
221
+ } & {
222
+ isNotPrimitive: <const Actual>(input: Actual) => input is Exclude<Actual, import("type-fest").Primitive>;
223
+ isNotPropertyKey: <const Actual>(input: Actual) => input is Exclude<Actual, PropertyKey>;
224
+ } & {
225
+ isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, Promise<any>>;
226
+ isNotPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, PromiseLike<any>>;
227
+ } & {
228
+ isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => actual is Exclude<Actual, import("@augment-vir/core").Uuid>;
229
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { check } from '@augment-vir/assert';
2
+ const value = 'some value';
3
+ if (check.isString(value)) {
4
+ // `value` will now be typed as a `string` in here
5
+ }
@@ -0,0 +1,21 @@
1
+ import { checkOverrides, extendableAssertions } from '../../assertions/extendable-assertions.js';
2
+ import { createCheckGroup } from '../../guard-types/check-function.js';
3
+ /**
4
+ * A group of guard methods that return a boolean type guard rather than an assertion type guard.
5
+ *
6
+ * @category Assert
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * import {check} from '@augment-vir/assert';
11
+ *
12
+ * const value: unknown = 'some value' as unknown;
13
+ * if (check.isString(value)) {
14
+ * // `value` will now be typed as a `string` in here
15
+ * }
16
+ * ```
17
+ *
18
+ * @returns A boolean (as a type guard when possible).
19
+ * @package @augment-vir/assert
20
+ */
21
+ export const check = createCheckGroup(extendableAssertions, checkOverrides);