lay-sing 0.1.2 → 0.2.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 (103) hide show
  1. package/README.md +40 -67
  2. package/esm/main/boolean.d.ts +1 -2
  3. package/esm/main/boolean.d.ts.map +1 -1
  4. package/esm/main/boolean.js.map +1 -1
  5. package/esm/main/control.d.ts +15 -20
  6. package/esm/main/control.d.ts.map +1 -1
  7. package/esm/main/control.js.map +1 -1
  8. package/esm/main/function.d.ts +2 -4
  9. package/esm/main/function.d.ts.map +1 -1
  10. package/esm/main/function.js.map +1 -1
  11. package/esm/main/index.d.ts +1 -1
  12. package/esm/main/index.d.ts.map +1 -1
  13. package/esm/main/index.js +3 -1
  14. package/esm/main/index.js.map +1 -1
  15. package/esm/main/key.d.ts +53 -17
  16. package/esm/main/key.d.ts.map +1 -1
  17. package/esm/main/key.js.map +1 -1
  18. package/esm/main/object.d.ts +45 -31
  19. package/esm/main/object.d.ts.map +1 -1
  20. package/esm/main/object.js.map +1 -1
  21. package/esm/main/tuple.d.ts +40 -0
  22. package/esm/main/tuple.d.ts.map +1 -0
  23. package/esm/main/tuple.js +2 -0
  24. package/esm/main/tuple.js.map +1 -0
  25. package/esm/main/type/compare.d.ts +9 -9
  26. package/esm/main/type/compare.d.ts.map +1 -1
  27. package/esm/main/type/compare.js.map +1 -1
  28. package/esm/main/type/index.d.ts.map +1 -1
  29. package/esm/main/type/index.js +2 -0
  30. package/esm/main/type/index.js.map +1 -1
  31. package/esm/main/type/set.d.ts +4 -6
  32. package/esm/main/type/set.d.ts.map +1 -1
  33. package/esm/main/type/set.js.map +1 -1
  34. package/esm/test-utils/compare.d.ts +69 -0
  35. package/esm/test-utils/compare.d.ts.map +1 -0
  36. package/esm/test-utils/compare.js +2 -0
  37. package/esm/test-utils/compare.js.map +1 -0
  38. package/esm/test-utils/expect.d.ts +223 -0
  39. package/esm/test-utils/expect.d.ts.map +1 -0
  40. package/esm/test-utils/expect.js +2 -0
  41. package/esm/test-utils/expect.js.map +1 -0
  42. package/esm/test-utils/index.d.ts +72 -0
  43. package/esm/test-utils/index.d.ts.map +1 -0
  44. package/esm/{test-utils.js → test-utils/index.js} +5 -5
  45. package/esm/test-utils/index.js.map +1 -0
  46. package/package.json +3 -3
  47. package/script/main/boolean.d.ts +1 -2
  48. package/script/main/boolean.d.ts.map +1 -1
  49. package/script/main/boolean.js.map +1 -1
  50. package/script/main/control.d.ts +15 -20
  51. package/script/main/control.d.ts.map +1 -1
  52. package/script/main/control.js.map +1 -1
  53. package/script/main/function.d.ts +2 -4
  54. package/script/main/function.d.ts.map +1 -1
  55. package/script/main/function.js.map +1 -1
  56. package/script/main/index.d.ts +1 -1
  57. package/script/main/index.d.ts.map +1 -1
  58. package/script/main/index.js +3 -1
  59. package/script/main/index.js.map +1 -1
  60. package/script/main/key.d.ts +53 -17
  61. package/script/main/key.d.ts.map +1 -1
  62. package/script/main/key.js.map +1 -1
  63. package/script/main/object.d.ts +45 -31
  64. package/script/main/object.d.ts.map +1 -1
  65. package/script/main/object.js.map +1 -1
  66. package/script/main/tuple.d.ts +40 -0
  67. package/script/main/tuple.d.ts.map +1 -0
  68. package/script/main/{array.js → tuple.js} +1 -1
  69. package/script/main/tuple.js.map +1 -0
  70. package/script/main/type/compare.d.ts +9 -9
  71. package/script/main/type/compare.d.ts.map +1 -1
  72. package/script/main/type/compare.js.map +1 -1
  73. package/script/main/type/index.d.ts.map +1 -1
  74. package/script/main/type/index.js +2 -0
  75. package/script/main/type/index.js.map +1 -1
  76. package/script/main/type/set.d.ts +4 -6
  77. package/script/main/type/set.d.ts.map +1 -1
  78. package/script/main/type/set.js.map +1 -1
  79. package/script/test-utils/compare.d.ts +69 -0
  80. package/script/test-utils/compare.d.ts.map +1 -0
  81. package/script/test-utils/compare.js +3 -0
  82. package/script/test-utils/compare.js.map +1 -0
  83. package/script/test-utils/expect.d.ts +223 -0
  84. package/script/test-utils/expect.d.ts.map +1 -0
  85. package/script/test-utils/expect.js +3 -0
  86. package/script/test-utils/expect.js.map +1 -0
  87. package/script/test-utils/index.d.ts +72 -0
  88. package/script/test-utils/index.d.ts.map +1 -0
  89. package/script/{test-utils.js → test-utils/index.js} +6 -6
  90. package/script/test-utils/index.js.map +1 -0
  91. package/esm/main/array.d.ts +0 -48
  92. package/esm/main/array.d.ts.map +0 -1
  93. package/esm/main/array.js +0 -2
  94. package/esm/main/array.js.map +0 -1
  95. package/esm/test-utils.d.ts +0 -348
  96. package/esm/test-utils.d.ts.map +0 -1
  97. package/esm/test-utils.js.map +0 -1
  98. package/script/main/array.d.ts +0 -48
  99. package/script/main/array.d.ts.map +0 -1
  100. package/script/main/array.js.map +0 -1
  101. package/script/test-utils.d.ts +0 -348
  102. package/script/test-utils.d.ts.map +0 -1
  103. package/script/test-utils.js.map +0 -1
@@ -1,348 +0,0 @@
1
- import type { Diff, Disjoint, Extends, If, MutuallyAssignable, Overlap, ProperExtend, SafePick, Same } from './main/index.js';
2
- /**
3
- * A universal no-op placeholder implemented via `Proxy`.
4
- *
5
- * `NOOP` can be accessed, called, or chained indefinitely without throwing.
6
- * Every operation returns itself, making it safe to use as a dummy fallback
7
- * for APIs, optional hooks, or unimplemented interfaces.
8
- *
9
- * ### Special behaviors
10
- *
11
- * - Callable: invoking `NOOP()` returns `NOOP`
12
- * - Property access: `NOOP.anything` returns `NOOP`
13
- * - Promise-safe: `NOOP.then` is `undefined`, so it is not treated as a Promise
14
- * - Primitive coercion (`toString`, `valueOf`, `Symbol.toPrimitive`) yields
15
- * a stable string representation: `"[NOOP]"`
16
- *
17
- * This is useful in scenarios where a value is required syntactically but
18
- * should perform no action and never fail at runtime.
19
- *
20
- * ### Examples
21
- *
22
- * ```ts
23
- * NOOP.foo.bar().baz.qux; // safe, returns NOOP
24
- * String(NOOP); // "[NOOP]"
25
- * await NOOP; // does not await (not thenable)
26
- * ```
27
- */
28
- export declare const NOOP: any;
29
- /**
30
- * Represents the result of a type assertion based on a boolean condition.
31
- * If the condition is true, the result has a `success` property; otherwise, it has a `fail` property.
32
- *
33
- * @template B The boolean condition result (true or false)
34
- * @template R The type of the result value (default is void)
35
- */
36
- type Result<B extends true | false, R = void> = B extends true ? {
37
- /**
38
- * ## Expect to succeed without type error
39
- */
40
- success: R;
41
- } : {
42
- /**
43
- * ## Expect to fail with type error
44
- */
45
- fail: R;
46
- };
47
- /**
48
- * Type-level testing utility that allows checking various relationships between types.
49
- * Provides methods to test type equality, extension, properties, and more.
50
- *
51
- * @template T The type being tested
52
- * @template H Hidden property keys that are already used (internal tracking)
53
- *
54
- * ### Examples
55
- *
56
- * ```ts
57
- * // Test if two types are identical
58
- * expect<number>().toBe<number>().success
59
- * expect<number>().toBe<string>().fail
60
- * // Test if one type extends another
61
- * expect<2>().toExtend<number>().success
62
- * expect<2>().toExtend<string>().fail
63
- * // Test if type has a specific property
64
- * expect<{name: string}>().toHaveProperty<'name'>().success
65
- * ```
66
- */
67
- export type ExpectType<T, H extends PropertyKey = never> = Omit<({
68
- T: T;
69
- inspect: {
70
- [K in keyof T]: T[K];
71
- };
72
- /**
73
- * Tests if the current type is exactly the same as the provided type U.
74
- *
75
- * @template U The type to compare with
76
- *
77
- * ### Examples
78
- *
79
- * ```ts
80
- * expect<any>().toBe<any>().success
81
- * expect<never>().toBe<never>().success
82
- * expect<false>().toBe<true>().fail
83
- * ```
84
- */
85
- toBe<U>(): Result<Same<T, U>>;
86
- /**
87
- * Tests if the current type T extends the provided type U.
88
- *
89
- * @template U The type to check extension against
90
- *
91
- * ### Examples
92
- *
93
- * ```ts
94
- * expect<3.14>().toExtend<number>().success
95
- * expect<2>().toExtend<string>().fail
96
- * expect<'hello'>().toExtend<string>().success
97
- * ```
98
- */
99
- toExtend<U>(): Result<Extends<T, U>>;
100
- /**
101
- * Tests if the current type T properly extends the provided type U (extends but is not the same).
102
- *
103
- * @template U The type to check proper extension against
104
- *
105
- * ### Examples
106
- *
107
- * ```ts
108
- * expect<2>().toProperExtend<number>().success
109
- * expect<'a' | 'b'>().toProperExtend<string>().success
110
- * expect<number>().toProperExtend<number>().fail
111
- * ```
112
- */
113
- toProperExtend<U>(): Result<ProperExtend<T, U>>;
114
- /**
115
- * Tests if the current type T has a property with key K.
116
- *
117
- * @template K The property key to check for
118
- *
119
- * ### Examples
120
- *
121
- * ```ts
122
- * type WithProp = { prop: string; another: number }
123
- * expect<WithProp>().toHaveProperty<'prop'>().success
124
- * expect<WithProp>().toHaveProperty<'another'>().success
125
- * expect<WithProp>().toHaveProperty<'missing'>().fail
126
- * ```
127
- */
128
- toHaveProperty<K extends PropertyKey>(): Result<Extends<K, keyof T>>;
129
- } & SafePick<{
130
- /**
131
- * Tests if the current type extends the Number primitive type.
132
- * Available only if the current type extends number.
133
- *
134
- * ### Examples
135
- *
136
- * ```ts
137
- * expect<3.14>().toExtendNumber // Available and would succeed
138
- * ```
139
- */
140
- toExtendNumber: ExpectType<T, H | 'toExtendNumber' | 'toExtend'>;
141
- /**
142
- * Tests if the current type extends the String primitive type.
143
- * Available only if the current type extends string.
144
- *
145
- * ### Examples
146
- *
147
- * ```ts
148
- * expect<'hello'>().toExtendString // Available and would succeed
149
- * ```
150
- */
151
- toExtendString: ExpectType<T, H | 'toExtendString' | 'toExtend'>;
152
- /**
153
- * Tests if the current type extends the Boolean primitive type.
154
- * Available only if the current type extends boolean.
155
- *
156
- * ### Examples
157
- *
158
- * ```ts
159
- * expect<true>().toExtendBoolean // Available and would succeed
160
- * ```
161
- */
162
- toExtendBoolean: ExpectType<T, H | 'toExtendBoolean' | 'toExtend'>;
163
- }, If<Extends<T, number>, 'toExtendNumber'> | If<Extends<T, string>, 'toExtendString'> | If<Extends<T, boolean>, 'toExtendBoolean'>> & SafePick<{
164
- /**
165
- * Tests if the current type is exactly `any`.
166
- * Available only if the current type is `any`.
167
- *
168
- * ### Examples
169
- *
170
- * ```ts
171
- * expect<any>().toBeAny // Available and would succeed
172
- * ```
173
- */
174
- toBeAny: ExpectType<T, H | 'toBeAny' | 'toBe'>;
175
- /**
176
- * Tests if the current type is exactly `never`.
177
- * Available only if the current type is `never`.
178
- *
179
- * ### Examples
180
- *
181
- * ```ts
182
- * expect<never>().toBeNever // Available and would succeed
183
- * ```
184
- */
185
- toBeNever: ExpectType<T, H | 'toBeNever' | 'toBe'>;
186
- /**
187
- * Tests if the current type is exactly `unknown`.
188
- * Available only if the current type is `unknown`.
189
- *
190
- * ### Examples
191
- *
192
- * ```ts
193
- * expect<unknown>().toBeUnknown // Available and would succeed
194
- * ```
195
- */
196
- toBeUnknown: ExpectType<T, H | 'toBeUnknown' | 'toBe'>;
197
- /**
198
- * Tests if the current type is exactly `void`.
199
- * Available only if the current type is `void`.
200
- *
201
- * ### Examples
202
- *
203
- * ```ts
204
- * expect<void>().toBeVoid // Available and would succeed
205
- * ```
206
- */
207
- toBeVoid: ExpectType<T, H | 'toBeVoid' | 'toBe'>;
208
- /**
209
- * Tests if the current type is exactly `true` (boolean literal).
210
- * Available only if the current type is `true`.
211
- *
212
- * ### Examples
213
- *
214
- * ```ts
215
- * expect<true>().toBeTrue // Available and would succeed
216
- * ```
217
- */
218
- toBeTrue: ExpectType<T, H | 'toBeTrue' | 'toBe' | 'toExtendBoolean'>;
219
- /**
220
- * Tests if the current type is exactly `false` (boolean literal).
221
- * Available only if the current type is `false`.
222
- *
223
- * ### Examples
224
- *
225
- * ```ts
226
- * expect<false>().toBeFalse // Available and would succeed
227
- * ```
228
- */
229
- toBeFalse: ExpectType<T, H | 'toBeFalse' | 'toBe' | 'toExtendBoolean'>;
230
- }, If<Same<T, any>, 'toBeAny'> | If<Same<T, never>, 'toBeNever'> | If<Same<T, unknown>, 'toBeUnknown'> | If<Same<T, void>, 'toBeVoid'> | If<Same<T, true>, 'toBeTrue'> | If<Same<T, false>, 'toBeFalse'>>), H>;
231
- /**
232
- * Creates an instance of ExpectType to perform type-level assertions on the given type.
233
- * This function enables testing various type relationships at compile time.
234
- * NOTE: This function does nothing at runtime and is purely for type-level testing.
235
- *
236
- * @template T The type to be tested
237
- *
238
- * @returns An ExpectType instance with methods to test type relationships
239
- *
240
- * ### Examples
241
- *
242
- * ```ts
243
- * // Test exact type equality
244
- * expect<number>().toBe<number>().success
245
- * expect<number>().toBe<string>().fail
246
- * // Test if one type extends another
247
- * expect<3.14>().toExtend<number>().success
248
- * expect<2>().toExtend<string>().fail
249
- * ```
250
- */
251
- export declare function expect<T>(): ExpectType<T>;
252
- export declare function expect<T>(_: T): ExpectType<T>;
253
- /**
254
- * Type-level utility that compares two types and provides methods to test their relationship.
255
- * Offers options to check if types are same, different, overlapping, disjoint, or mutually assignable.
256
- *
257
- * @template T First type to compare
258
- * @template U Second type to compare
259
- * @template H Hidden property keys that are already used (internal tracking)
260
- *
261
- * ### Examples
262
- *
263
- * ```ts
264
- * // Check if two types are the same
265
- * compare<number, number>().same // Available
266
- * // Check if two types are different
267
- * compare<number, string>().different // Available
268
- * // Check if two types overlap
269
- * compare<4, number>().overlap.different // Available
270
- * ```
271
- */
272
- export type CompareTypes<T, U, H extends PropertyKey = never> = Omit<SafePick<{
273
- /**
274
- * Available when types T and U are exactly the same.
275
- *
276
- * ### Examples
277
- *
278
- * ```ts
279
- * compare<3, 3>().same // Available
280
- * compare<boolean, boolean>().same // Available
281
- * ```
282
- */
283
- same: CompareTypes<T, U, H | 'same'>;
284
- /**
285
- * Available when types T and U are different.
286
- *
287
- * ### Examples
288
- *
289
- * ```ts
290
- * compare<4, 'abc'>().different // Available
291
- * compare<number, 4>().different // Available
292
- * ```
293
- */
294
- different: CompareTypes<T, U, H | 'different'>;
295
- /**
296
- * Available when types T and U have some overlap.
297
- *
298
- * ### Examples
299
- *
300
- * ```ts
301
- * compare<4, number>().overlap // Available since 4 overlaps with number
302
- * ```
303
- */
304
- overlap: CompareTypes<T, U, H | 'overlap'>;
305
- /**
306
- * Available when types T and U have no overlap (are disjoint).
307
- *
308
- * ### Examples
309
- *
310
- * ```ts
311
- * compare<4, 'abc'>().different.disjoint // Available since 4 and 'abc' are disjoint
312
- * ```
313
- */
314
- disjoint: CompareTypes<T, U, H | 'disjoint'>;
315
- /**
316
- * Available when types T and U are mutually assignable (each type can be assigned to the other).
317
- *
318
- * ### Examples
319
- *
320
- * ```ts
321
- * compare<1 | 2, 1 | 2>().mutuallyAssignable // Available since identical union types are mutually assignable
322
- * ```
323
- */
324
- mutuallyAssignable: CompareTypes<T, U, H | 'mutuallyAssignable'>;
325
- }, If<Same<T, U>, 'same'> | If<Diff<T, U>, 'different'> | If<Overlap<T, U>, 'overlap'> | If<Disjoint<T, U>, 'disjoint'> | If<MutuallyAssignable<T, U>, 'mutuallyAssignable'>>, H>;
326
- /**
327
- * Creates an instance of CompareTypes to perform type-level comparisons between two types.
328
- * This function enables testing various relationships between types at compile time.
329
- * NOTE: This function does nothing at runtime and is purely for type-level testing.
330
- *
331
- * @template T First type to compare
332
- * @template U Second type to compare
333
- *
334
- * @returns A CompareTypes instance with methods to test relationships between T and U
335
- *
336
- * ### Examples
337
- *
338
- * ```ts
339
- * // Compare two identical types
340
- * compare<number, number>().same // Results in an available property
341
- * // Compare two different but overlapping types
342
- * compare<4, number>().overlap.different // Results in available properties
343
- * ```
344
- */
345
- export declare function compare<T, U>(): CompareTypes<T, U>;
346
- export declare function compare<T, U>(t: T, u: U): CompareTypes<T, U>;
347
- export {};
348
- //# sourceMappingURL=test-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,EAAE,EACF,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACL,MAAM,iBAAiB,CAAA;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,IAAI,EAAE,GA0BlB,CAAA;AAED;;;;;;GAMG;AACH,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,GAAG,KAAK,EAAE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CAAC,CAAC,WAAW,CAAC;CAC7B,CACF,CAAA;AAkQD,SAAgB,MAAM;IACpB,OAAO,YAAI,CAAA;AACb,CAAC;AA+GD,SAAgB,OAAO;IACrB,OAAO,YAAI,CAAA;AACb,CAAC","sourcesContent":["// deno-lint-ignore-file no-explicit-any\nimport type {\n Diff,\n Disjoint,\n Extends,\n If,\n MutuallyAssignable,\n Overlap,\n ProperExtend,\n SafePick,\n Same,\n} from './main/index.js'\n\n/**\n * A universal no-op placeholder implemented via `Proxy`.\n *\n * `NOOP` can be accessed, called, or chained indefinitely without throwing.\n * Every operation returns itself, making it safe to use as a dummy fallback\n * for APIs, optional hooks, or unimplemented interfaces.\n *\n * ### Special behaviors\n *\n * - Callable: invoking `NOOP()` returns `NOOP`\n * - Property access: `NOOP.anything` returns `NOOP`\n * - Promise-safe: `NOOP.then` is `undefined`, so it is not treated as a Promise\n * - Primitive coercion (`toString`, `valueOf`, `Symbol.toPrimitive`) yields\n * a stable string representation: `\"[NOOP]\"`\n *\n * This is useful in scenarios where a value is required syntactically but\n * should perform no action and never fail at runtime.\n *\n * ### Examples\n *\n * ```ts\n * NOOP.foo.bar().baz.qux; // safe, returns NOOP\n * String(NOOP); // \"[NOOP]\"\n * await NOOP; // does not await (not thenable)\n * ```\n */\nexport const NOOP: any = new Proxy(\n function () {\n return NOOP\n },\n {\n get(_, prop) {\n switch (prop) {\n case 'then':\n return undefined\n case 'valueOf':\n case 'toString':\n case Symbol.toPrimitive:\n return () => '[NOOP]'\n default:\n return NOOP\n }\n },\n set: () => true,\n getOwnPropertyDescriptor: () => ({\n configurable: true,\n value: NOOP,\n }),\n getPrototypeOf: () => null,\n has: () => true,\n ownKeys: () => ['prototype'],\n },\n)\n\n/**\n * Represents the result of a type assertion based on a boolean condition.\n * If the condition is true, the result has a `success` property; otherwise, it has a `fail` property.\n *\n * @template B The boolean condition result (true or false)\n * @template R The type of the result value (default is void)\n */\ntype Result<B extends true | false, R = void> = B extends true ? {\n /**\n * ## Expect to succeed without type error\n */\n success: R\n }\n : {\n /**\n * ## Expect to fail with type error\n */\n fail: R\n }\n\n/**\n * Type-level testing utility that allows checking various relationships between types.\n * Provides methods to test type equality, extension, properties, and more.\n *\n * @template T The type being tested\n * @template H Hidden property keys that are already used (internal tracking)\n *\n * ### Examples\n *\n * ```ts\n * // Test if two types are identical\n * expect<number>().toBe<number>().success\n * expect<number>().toBe<string>().fail\n * // Test if one type extends another\n * expect<2>().toExtend<number>().success\n * expect<2>().toExtend<string>().fail\n * // Test if type has a specific property\n * expect<{name: string}>().toHaveProperty<'name'>().success\n * ```\n */\nexport type ExpectType<T, H extends PropertyKey = never> = Omit<\n (\n & {\n T: T\n inspect: { [K in keyof T]: T[K] }\n\n /**\n * Tests if the current type is exactly the same as the provided type U.\n *\n * @template U The type to compare with\n *\n * ### Examples\n *\n * ```ts\n * expect<any>().toBe<any>().success\n * expect<never>().toBe<never>().success\n * expect<false>().toBe<true>().fail\n * ```\n */\n toBe<U>(): Result<Same<T, U>>\n\n /**\n * Tests if the current type T extends the provided type U.\n *\n * @template U The type to check extension against\n *\n * ### Examples\n *\n * ```ts\n * expect<3.14>().toExtend<number>().success\n * expect<2>().toExtend<string>().fail\n * expect<'hello'>().toExtend<string>().success\n * ```\n */\n toExtend<U>(): Result<Extends<T, U>>\n\n /**\n * Tests if the current type T properly extends the provided type U (extends but is not the same).\n *\n * @template U The type to check proper extension against\n *\n * ### Examples\n *\n * ```ts\n * expect<2>().toProperExtend<number>().success\n * expect<'a' | 'b'>().toProperExtend<string>().success\n * expect<number>().toProperExtend<number>().fail\n * ```\n */\n toProperExtend<U>(): Result<ProperExtend<T, U>>\n\n /**\n * Tests if the current type T has a property with key K.\n *\n * @template K The property key to check for\n *\n * ### Examples\n *\n * ```ts\n * type WithProp = { prop: string; another: number }\n * expect<WithProp>().toHaveProperty<'prop'>().success\n * expect<WithProp>().toHaveProperty<'another'>().success\n * expect<WithProp>().toHaveProperty<'missing'>().fail\n * ```\n */\n toHaveProperty<K extends PropertyKey>(): Result<Extends<K, keyof T>>\n }\n & SafePick<\n {\n /**\n * Tests if the current type extends the Number primitive type.\n * Available only if the current type extends number.\n *\n * ### Examples\n *\n * ```ts\n * expect<3.14>().toExtendNumber // Available and would succeed\n * ```\n */\n toExtendNumber: ExpectType<T, H | 'toExtendNumber' | 'toExtend'>\n\n /**\n * Tests if the current type extends the String primitive type.\n * Available only if the current type extends string.\n *\n * ### Examples\n *\n * ```ts\n * expect<'hello'>().toExtendString // Available and would succeed\n * ```\n */\n toExtendString: ExpectType<T, H | 'toExtendString' | 'toExtend'>\n\n /**\n * Tests if the current type extends the Boolean primitive type.\n * Available only if the current type extends boolean.\n *\n * ### Examples\n *\n * ```ts\n * expect<true>().toExtendBoolean // Available and would succeed\n * ```\n */\n toExtendBoolean: ExpectType<T, H | 'toExtendBoolean' | 'toExtend'>\n },\n | If<Extends<T, number>, 'toExtendNumber'>\n | If<Extends<T, string>, 'toExtendString'>\n | If<Extends<T, boolean>, 'toExtendBoolean'>\n >\n & SafePick<\n {\n /**\n * Tests if the current type is exactly `any`.\n * Available only if the current type is `any`.\n *\n * ### Examples\n *\n * ```ts\n * expect<any>().toBeAny // Available and would succeed\n * ```\n */\n toBeAny: ExpectType<T, H | 'toBeAny' | 'toBe'>\n\n /**\n * Tests if the current type is exactly `never`.\n * Available only if the current type is `never`.\n *\n * ### Examples\n *\n * ```ts\n * expect<never>().toBeNever // Available and would succeed\n * ```\n */\n toBeNever: ExpectType<T, H | 'toBeNever' | 'toBe'>\n\n /**\n * Tests if the current type is exactly `unknown`.\n * Available only if the current type is `unknown`.\n *\n * ### Examples\n *\n * ```ts\n * expect<unknown>().toBeUnknown // Available and would succeed\n * ```\n */\n toBeUnknown: ExpectType<T, H | 'toBeUnknown' | 'toBe'>\n\n /**\n * Tests if the current type is exactly `void`.\n * Available only if the current type is `void`.\n *\n * ### Examples\n *\n * ```ts\n * expect<void>().toBeVoid // Available and would succeed\n * ```\n */\n toBeVoid: ExpectType<T, H | 'toBeVoid' | 'toBe'>\n\n /**\n * Tests if the current type is exactly `true` (boolean literal).\n * Available only if the current type is `true`.\n *\n * ### Examples\n *\n * ```ts\n * expect<true>().toBeTrue // Available and would succeed\n * ```\n */\n toBeTrue: ExpectType<T, H | 'toBeTrue' | 'toBe' | 'toExtendBoolean'>\n\n /**\n * Tests if the current type is exactly `false` (boolean literal).\n * Available only if the current type is `false`.\n *\n * ### Examples\n *\n * ```ts\n * expect<false>().toBeFalse // Available and would succeed\n * ```\n */\n toBeFalse: ExpectType<T, H | 'toBeFalse' | 'toBe' | 'toExtendBoolean'>\n },\n | If<Same<T, any>, 'toBeAny'>\n | If<Same<T, never>, 'toBeNever'>\n | If<Same<T, unknown>, 'toBeUnknown'>\n | If<Same<T, void>, 'toBeVoid'>\n | If<Same<T, true>, 'toBeTrue'>\n | If<Same<T, false>, 'toBeFalse'>\n >\n ),\n H\n>\n\n/**\n * Creates an instance of ExpectType to perform type-level assertions on the given type.\n * This function enables testing various type relationships at compile time.\n * NOTE: This function does nothing at runtime and is purely for type-level testing.\n *\n * @template T The type to be tested\n *\n * @returns An ExpectType instance with methods to test type relationships\n *\n * ### Examples\n *\n * ```ts\n * // Test exact type equality\n * expect<number>().toBe<number>().success\n * expect<number>().toBe<string>().fail\n * // Test if one type extends another\n * expect<3.14>().toExtend<number>().success\n * expect<2>().toExtend<string>().fail\n * ```\n */\nexport function expect<T>(): ExpectType<T>\nexport function expect<T>(_: T): ExpectType<T>\nexport function expect<T>(): ExpectType<T> {\n return NOOP\n}\n\n/**\n * Type-level utility that compares two types and provides methods to test their relationship.\n * Offers options to check if types are same, different, overlapping, disjoint, or mutually assignable.\n *\n * @template T First type to compare\n * @template U Second type to compare\n * @template H Hidden property keys that are already used (internal tracking)\n *\n * ### Examples\n *\n * ```ts\n * // Check if two types are the same\n * compare<number, number>().same // Available\n * // Check if two types are different\n * compare<number, string>().different // Available\n * // Check if two types overlap\n * compare<4, number>().overlap.different // Available\n * ```\n */\nexport type CompareTypes<T, U, H extends PropertyKey = never> = Omit<\n SafePick<\n {\n /**\n * Available when types T and U are exactly the same.\n *\n * ### Examples\n *\n * ```ts\n * compare<3, 3>().same // Available\n * compare<boolean, boolean>().same // Available\n * ```\n */\n same: CompareTypes<T, U, H | 'same'>\n\n /**\n * Available when types T and U are different.\n *\n * ### Examples\n *\n * ```ts\n * compare<4, 'abc'>().different // Available\n * compare<number, 4>().different // Available\n * ```\n */\n different: CompareTypes<T, U, H | 'different'>\n\n /**\n * Available when types T and U have some overlap.\n *\n * ### Examples\n *\n * ```ts\n * compare<4, number>().overlap // Available since 4 overlaps with number\n * ```\n */\n overlap: CompareTypes<T, U, H | 'overlap'>\n\n /**\n * Available when types T and U have no overlap (are disjoint).\n *\n * ### Examples\n *\n * ```ts\n * compare<4, 'abc'>().different.disjoint // Available since 4 and 'abc' are disjoint\n * ```\n */\n disjoint: CompareTypes<T, U, H | 'disjoint'>\n\n /**\n * Available when types T and U are mutually assignable (each type can be assigned to the other).\n *\n * ### Examples\n *\n * ```ts\n * compare<1 | 2, 1 | 2>().mutuallyAssignable // Available since identical union types are mutually assignable\n * ```\n */\n mutuallyAssignable: CompareTypes<T, U, H | 'mutuallyAssignable'>\n },\n | If<Same<T, U>, 'same'>\n | If<Diff<T, U>, 'different'>\n | If<Overlap<T, U>, 'overlap'>\n | If<Disjoint<T, U>, 'disjoint'>\n | If<MutuallyAssignable<T, U>, 'mutuallyAssignable'>\n >,\n H\n>\n\n/**\n * Creates an instance of CompareTypes to perform type-level comparisons between two types.\n * This function enables testing various relationships between types at compile time.\n * NOTE: This function does nothing at runtime and is purely for type-level testing.\n *\n * @template T First type to compare\n * @template U Second type to compare\n *\n * @returns A CompareTypes instance with methods to test relationships between T and U\n *\n * ### Examples\n *\n * ```ts\n * // Compare two identical types\n * compare<number, number>().same // Results in an available property\n * // Compare two different but overlapping types\n * compare<4, number>().overlap.different // Results in available properties\n * ```\n */\nexport function compare<T, U>(): CompareTypes<T, U>\nexport function compare<T, U>(t: T, u: U): CompareTypes<T, U>\nexport function compare<T, U>(): CompareTypes<T, U> {\n return NOOP\n}\n"]}