lay-sing 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +55 -16
  2. package/esm/main/async.d.ts +9 -1
  3. package/esm/main/async.d.ts.map +1 -1
  4. package/esm/main/async.js.map +1 -1
  5. package/esm/main/boolean.d.ts +43 -19
  6. package/esm/main/boolean.d.ts.map +1 -1
  7. package/esm/main/boolean.js.map +1 -1
  8. package/esm/main/control.d.ts +65 -36
  9. package/esm/main/control.d.ts.map +1 -1
  10. package/esm/main/control.js.map +1 -1
  11. package/esm/main/doc.d.ts +33 -7
  12. package/esm/main/doc.d.ts.map +1 -1
  13. package/esm/main/doc.js.map +1 -1
  14. package/esm/main/function.d.ts +11 -3
  15. package/esm/main/function.d.ts.map +1 -1
  16. package/esm/main/function.js +0 -1
  17. package/esm/main/function.js.map +1 -1
  18. package/esm/main/index.d.ts +5 -0
  19. package/esm/main/index.d.ts.map +1 -1
  20. package/esm/main/index.js +5 -0
  21. package/esm/main/index.js.map +1 -1
  22. package/esm/main/key.d.ts +20 -18
  23. package/esm/main/key.d.ts.map +1 -1
  24. package/esm/main/key.js.map +1 -1
  25. package/esm/main/object.d.ts +57 -32
  26. package/esm/main/object.d.ts.map +1 -1
  27. package/esm/main/object.js.map +1 -1
  28. package/esm/main/tuple.d.ts +30 -6
  29. package/esm/main/tuple.d.ts.map +1 -1
  30. package/esm/main/tuple.js.map +1 -1
  31. package/esm/main/type/compare.d.ts +108 -18
  32. package/esm/main/type/compare.d.ts.map +1 -1
  33. package/esm/main/type/compare.js.map +1 -1
  34. package/esm/main/type/set.d.ts +15 -8
  35. package/esm/main/type/set.d.ts.map +1 -1
  36. package/esm/main/type/set.js.map +1 -1
  37. package/esm/test-utils/compare.d.ts +12 -0
  38. package/esm/test-utils/compare.d.ts.map +1 -1
  39. package/esm/test-utils/compare.js.map +1 -1
  40. package/esm/test-utils/expect.d.ts +63 -8
  41. package/esm/test-utils/expect.d.ts.map +1 -1
  42. package/esm/test-utils/expect.js.map +1 -1
  43. package/esm/test-utils/index.d.ts +5 -0
  44. package/esm/test-utils/index.d.ts.map +1 -1
  45. package/esm/test-utils/index.js +5 -1
  46. package/esm/test-utils/index.js.map +1 -1
  47. package/package.json +1 -1
  48. package/script/main/async.d.ts +9 -1
  49. package/script/main/async.d.ts.map +1 -1
  50. package/script/main/async.js.map +1 -1
  51. package/script/main/boolean.d.ts +43 -19
  52. package/script/main/boolean.d.ts.map +1 -1
  53. package/script/main/boolean.js.map +1 -1
  54. package/script/main/control.d.ts +65 -36
  55. package/script/main/control.d.ts.map +1 -1
  56. package/script/main/control.js.map +1 -1
  57. package/script/main/doc.d.ts +33 -7
  58. package/script/main/doc.d.ts.map +1 -1
  59. package/script/main/doc.js.map +1 -1
  60. package/script/main/function.d.ts +11 -3
  61. package/script/main/function.d.ts.map +1 -1
  62. package/script/main/function.js +0 -1
  63. package/script/main/function.js.map +1 -1
  64. package/script/main/index.d.ts +5 -0
  65. package/script/main/index.d.ts.map +1 -1
  66. package/script/main/index.js +5 -0
  67. package/script/main/index.js.map +1 -1
  68. package/script/main/key.d.ts +20 -18
  69. package/script/main/key.d.ts.map +1 -1
  70. package/script/main/key.js.map +1 -1
  71. package/script/main/object.d.ts +57 -32
  72. package/script/main/object.d.ts.map +1 -1
  73. package/script/main/object.js.map +1 -1
  74. package/script/main/tuple.d.ts +30 -6
  75. package/script/main/tuple.d.ts.map +1 -1
  76. package/script/main/tuple.js.map +1 -1
  77. package/script/main/type/compare.d.ts +108 -18
  78. package/script/main/type/compare.d.ts.map +1 -1
  79. package/script/main/type/compare.js.map +1 -1
  80. package/script/main/type/set.d.ts +15 -8
  81. package/script/main/type/set.d.ts.map +1 -1
  82. package/script/main/type/set.js.map +1 -1
  83. package/script/test-utils/compare.d.ts +12 -0
  84. package/script/test-utils/compare.d.ts.map +1 -1
  85. package/script/test-utils/compare.js.map +1 -1
  86. package/script/test-utils/expect.d.ts +63 -8
  87. package/script/test-utils/expect.d.ts.map +1 -1
  88. package/script/test-utils/expect.js.map +1 -1
  89. package/script/test-utils/index.d.ts +5 -0
  90. package/script/test-utils/index.d.ts.map +1 -1
  91. package/script/test-utils/index.js +5 -1
  92. package/script/test-utils/index.js.map +1 -1
@@ -1,4 +1,4 @@
1
- import type { Exact, Extends, If, IfTupleIncludes, ProperExtend, SafePick } from '../main/index.js';
1
+ import type { Exact, Extends, If, IfTupleIncludes, MutuallyAssignable, ProperExtend, SafePick } from '../main/index.js';
2
2
  /**
3
3
  * Represents the result of a type assertion based on a boolean condition.
4
4
  *
@@ -32,12 +32,34 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
32
32
  *
33
33
  * @example
34
34
  * ```ts
35
+ * import { expect } from '@leawind/lay-sing/test-utils'
36
+ *
35
37
  * expect<any>().toBe<any>().success
36
38
  * expect<never>().toBe<never>().success
37
39
  * expect<false>().toBe<true>().fail
38
40
  * ```
39
41
  */
40
- toBe<U>(): TypeAssertionResult<Exact<T, U>>;
42
+ toBe<U>(): TypeAssertionResult<Exact<T, U>, ExpectType<T, H>>;
43
+ /**
44
+ * Tests if the current type is mutually assignable with the provided type U.
45
+ *
46
+ * It's like:
47
+ *
48
+ * ```ts ignore
49
+ * [T] extends [U] ? [U] extends [T] ? Yes : No : No
50
+ * ```
51
+ *
52
+ * @template U The type to compare with
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * import { expect } from '@leawind/lay-sing/test-utils'
57
+ *
58
+ * expect<{ a: 1; b: 2 }>().toEqual<{ a: 1 } & { b: 2 }>().success
59
+ * expect<1>().toEqual<1 | 2>().fail
60
+ * ```
61
+ */
62
+ toEqual<U>(): TypeAssertionResult<MutuallyAssignable<T, U>, ExpectType<T, H>>;
41
63
  /**
42
64
  * Tests if the current type T extends the provided type U.
43
65
  *
@@ -45,12 +67,14 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
45
67
  *
46
68
  * @example
47
69
  * ```ts
70
+ * import { expect } from '@leawind/lay-sing/test-utils'
71
+ *
48
72
  * expect<3.14>().toExtend<number>().success
49
73
  * expect<2>().toExtend<string>().fail
50
74
  * expect<'hello'>().toExtend<string>().success
51
75
  * ```
52
76
  */
53
- toExtend<U>(): TypeAssertionResult<Extends<T, U>>;
77
+ toExtend<U>(): TypeAssertionResult<Extends<T, U>, ExpectType<T, H>>;
54
78
  /**
55
79
  * Tests if the current type T properly extends the provided type U (extends but is not the same).
56
80
  *
@@ -58,12 +82,14 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
58
82
  *
59
83
  * @example
60
84
  * ```ts
85
+ * import { expect } from '@leawind/lay-sing/test-utils'
86
+ *
61
87
  * expect<2>().toProperExtend<number>().success
62
88
  * expect<'a' | 'b'>().toProperExtend<string>().success
63
89
  * expect<number>().toProperExtend<number>().fail
64
90
  * ```
65
91
  */
66
- toProperExtend<U>(): TypeAssertionResult<ProperExtend<T, U>>;
92
+ toProperExtend<U>(): TypeAssertionResult<ProperExtend<T, U>, ExpectType<T, H>>;
67
93
  /**
68
94
  * Tests if the current type `T` has a property with key `K`.
69
95
  *
@@ -77,6 +103,8 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
77
103
  * ### Examples
78
104
  *
79
105
  * ```ts
106
+ * import { expect } from '@leawind/lay-sing/test-utils'
107
+ *
80
108
  * type WithProp = { prop: string; another: number; may?: 5 }
81
109
  *
82
110
  * // Single key checks
@@ -88,7 +116,10 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
88
116
  * expect<WithProp>().toHaveKey<'may' | 'unexist'>().fail
89
117
  * ```
90
118
  */
91
- toHaveKey<K extends PropertyKey>(): IfTupleIncludes<[never, any], K, never, TypeAssertionResult<Extends<K, keyof T>>>;
119
+ toHaveKey<K extends PropertyKey>(): IfTupleIncludes<[
120
+ never,
121
+ any
122
+ ], K, never, TypeAssertionResult<Extends<K, keyof T>, ExpectType<T, H>>>;
92
123
  };
93
124
  /**
94
125
  * Type-level testing utility that allows checking various relationships between types.
@@ -99,6 +130,8 @@ type ExpectTypeMethods<T, H extends PropertyKey = never> = {
99
130
  *
100
131
  * @example
101
132
  * ```ts
133
+ * import { expect } from '@leawind/lay-sing/test-utils'
134
+ *
102
135
  * // Test if two types are identical
103
136
  * expect<number>().toBe<number>().success
104
137
  * expect<number>().toBe<string>().fail
@@ -121,7 +154,9 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
121
154
  *
122
155
  * @example
123
156
  * ```ts
124
- * expect<3.14>().toExtendNumber // Available and would succeed
157
+ * import { expect } from '@leawind/lay-sing/test-utils'
158
+ *
159
+ * expect<3.14>().toExtendNumber
125
160
  * ```
126
161
  */
127
162
  toExtendNumber: ExpectType<T, H | 'toExtendNumber' | 'toExtend'>;
@@ -131,7 +166,9 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
131
166
  *
132
167
  * @example
133
168
  * ```ts
134
- * expect<'hello'>().toExtendString // Available and would succeed
169
+ * import { expect } from '@leawind/lay-sing/test-utils'
170
+ *
171
+ * expect<'hello'>().toExtendString
135
172
  * ```
136
173
  */
137
174
  toExtendString: ExpectType<T, H | 'toExtendString' | 'toExtend'>;
@@ -141,7 +178,9 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
141
178
  *
142
179
  * @example
143
180
  * ```ts
144
- * expect<true>().toExtendBoolean // Available and would succeed
181
+ * import { expect } from '@leawind/lay-sing/test-utils'
182
+ *
183
+ * expect<true>().toExtendBoolean
145
184
  * ```
146
185
  */
147
186
  toExtendBoolean: ExpectType<T, H | 'toExtendBoolean' | 'toExtend'>;
@@ -150,6 +189,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
150
189
  * Alias for {@link ExpectTypeMethods.toBe} where `U = any`
151
190
  *
152
191
  * ```ts
192
+ * import { expect } from '@leawind/lay-sing/test-utils'
193
+ *
153
194
  * expect<any>().toBeAny
154
195
  * expect<any>().toBe<any>().success
155
196
  * ```
@@ -159,6 +200,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
159
200
  * Alias for {@link ExpectTypeMethods.toBe} where `U = never`
160
201
  *
161
202
  * ```ts
203
+ * import { expect } from '@leawind/lay-sing/test-utils'
204
+ *
162
205
  * expect<never>().toBeNever
163
206
  * expect<never>().toBe<never>().success
164
207
  * ```
@@ -168,6 +211,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
168
211
  * Alias for {@link ExpectTypeMethods.toBe} where `U = unknown`
169
212
  *
170
213
  * ```ts
214
+ * import { expect } from '@leawind/lay-sing/test-utils'
215
+ *
171
216
  * expect<unknown>().toBeUnknown
172
217
  * expect<unknown>().toBe<unknown>().success
173
218
  * ```
@@ -177,6 +222,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
177
222
  * Alias for {@link ExpectTypeMethods.toBe} where `U = void`
178
223
  *
179
224
  * ```ts
225
+ * import { expect } from '@leawind/lay-sing/test-utils'
226
+ *
180
227
  * expect<void>().toBeVoid
181
228
  * expect<void>().toBe<void>().success
182
229
  * ```
@@ -186,6 +233,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
186
233
  * Alias for {@link ExpectTypeMethods.toBe} where `U = null`
187
234
  *
188
235
  * ```ts
236
+ * import { expect } from '@leawind/lay-sing/test-utils'
237
+ *
189
238
  * expect<null>().toBeNull
190
239
  * expect<null>().toBe<null>().success
191
240
  * ```
@@ -195,6 +244,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
195
244
  * Alias for {@link ExpectTypeMethods.toBe} where `U = undefined`
196
245
  *
197
246
  * ```ts
247
+ * import { expect } from '@leawind/lay-sing/test-utils'
248
+ *
198
249
  * expect<undefined>().toBeUndefined
199
250
  * expect<undefined>().toBe<undefined>().success
200
251
  * ```
@@ -204,6 +255,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
204
255
  * Alias for {@link ExpectTypeMethods.toBe} where `U = true`
205
256
  *
206
257
  * ```ts
258
+ * import { expect } from '@leawind/lay-sing/test-utils'
259
+ *
207
260
  * expect<true>().toBeTrue
208
261
  * expect<true>().toBe<true>().success
209
262
  * ```
@@ -213,6 +266,8 @@ export type ExpectType<T, H extends PropertyKey = never> = Omit<(ExpectTypeMetho
213
266
  * Alias for {@link ExpectTypeMethods.toBe} where `U = false`
214
267
  *
215
268
  * ```ts
269
+ * import { expect } from '@leawind/lay-sing/test-utils'
270
+ *
216
271
  * expect<false>().toBeFalse
217
272
  * expect<false>().toBe<false>().success
218
273
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/test-utils/expect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEnG;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,GAAG,IAAI,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,IAAI,GAAG,KAAK,GAC/F,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,GAC7B,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;IACnB;;;;OAIG;IACH,OAAO,EAAE,CAAC,CAAA;CACX,GACD,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG;IACpB;;;;OAIG;IACH,IAAI,EAAE,CAAC,CAAA;CACR,GACD,KAAK,CAAA;AAET,KAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI;IACzD;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,CAAC,KAAK,mBAAmB,CAAC,KAAK,CAA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AG,iBAAiB,CAAC,CAAA;IAEpE;;;;;;;;;OASG;IACH,SAAS,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,WAAW,GAAG,MAAM,GAAG,iBAAiB,CAAC,CAAA;CACvE,EACC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,GAC5B,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC,GAChC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,GACpC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,GAC9B,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,GAC9B,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,eAAe,CAAC,GACxC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,UAAU,CAAC,GAC9B,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,WAAW,CAAC,CACnC,CACF,EACD,CAAC,CACF,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/test-utils/expect.ts"],"names":[],"mappings":"","sourcesContent":["// deno-lint-ignore-file no-explicit-any\nimport type { Exact, Extends, If, IfTupleIncludes, ProperExtend, SafePick } from '../main/index.js'\n\n/**\n * Represents the result of a type assertion based on a boolean condition.\n *\n * - If `true`, the result has a `success` property;\n * - If `false`, the result has a `fail` property;\n * - Otherwise, the result is `never`\n *\n * @template B The boolean condition result (true or false)\n * @template R The type of the result value (default is void)\n */\nexport type TypeAssertionResult<B extends boolean, R = void> = Exact<B, never> extends true ? never\n : [boolean] extends [B] ? never\n : [B] extends [true] ? {\n /**\n * This field exist only when this type assertion succeed\n *\n * If you expect this assertion to fail, use `.fail`\n */\n success: R\n }\n : [B] extends [false] ? {\n /**\n * This field exist only when this type assertion failed\n *\n * If you expect this assertion to success, use `.success`\n */\n fail: R\n }\n : never\n\ntype ExpectTypeMethods<T, H extends PropertyKey = never> = {\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 * @example\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>(): TypeAssertionResult<Exact<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 * @example\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>(): TypeAssertionResult<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 * @example\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>(): TypeAssertionResult<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 * ### Behavior\n *\n * - For single keys: succeeds if the key exists in `T`\n * - For union types: succeeds only if **all** keys in the union exist in `T`\n *\n * ### Examples\n *\n * ```ts\n * type WithProp = { prop: string; another: number; may?: 5 }\n *\n * // Single key checks\n * expect<WithProp>().toHaveKey<'prop'>().success\n * expect<WithProp>().toHaveKey<'missing'>().fail\n *\n * // Union type checks\n * expect<WithProp>().toHaveKey<'prop' | 'another'>().success\n * expect<WithProp>().toHaveKey<'may' | 'unexist'>().fail\n * ```\n */\n toHaveKey<K extends PropertyKey>(): IfTupleIncludes<[never, any], K, never, TypeAssertionResult<Extends<K, keyof T>>>\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 * @example\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}>().toHaveKey<'name'>().success\n * ```\n */\nexport type ExpectType<T, H extends PropertyKey = never> = Omit<\n (\n & ExpectTypeMethods<T, H>\n & {\n T: T\n inspect: { [K in keyof T]: T[K] }\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 * @example\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 * @example\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 * @example\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 * Alias for {@link ExpectTypeMethods.toBe} where `U = any`\n *\n * ```ts\n * expect<any>().toBeAny\n * expect<any>().toBe<any>().success\n * ```\n */\n toBeAny: ExpectType<T, H | 'toBeAny' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = never`\n *\n * ```ts\n * expect<never>().toBeNever\n * expect<never>().toBe<never>().success\n * ```\n */\n toBeNever: ExpectType<T, H | 'toBeNever' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = unknown`\n *\n * ```ts\n * expect<unknown>().toBeUnknown\n * expect<unknown>().toBe<unknown>().success\n * ```\n */\n toBeUnknown: ExpectType<T, H | 'toBeUnknown' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = void`\n *\n * ```ts\n * expect<void>().toBeVoid\n * expect<void>().toBe<void>().success\n * ```\n */\n toBeVoid: ExpectType<T, H | 'toBeVoid' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = null`\n *\n * ```ts\n * expect<null>().toBeNull\n * expect<null>().toBe<null>().success\n * ```\n */\n toBeNull: ExpectType<T, H | 'toBeNull' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = undefined`\n *\n * ```ts\n * expect<undefined>().toBeUndefined\n * expect<undefined>().toBe<undefined>().success\n * ```\n */\n toBeUndefined: ExpectType<T, H | 'toBeUndefined' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = true`\n *\n * ```ts\n * expect<true>().toBeTrue\n * expect<true>().toBe<true>().success\n * ```\n */\n toBeTrue: ExpectType<T, H | 'toBeTrue' | 'toBe' | 'toExtendBoolean'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = false`\n *\n * ```ts\n * expect<false>().toBeFalse\n * expect<false>().toBe<false>().success\n * ```\n */\n toBeFalse: ExpectType<T, H | 'toBeFalse' | 'toBe' | 'toExtendBoolean'>\n },\n | If<Exact<T, any>, 'toBeAny'>\n | If<Exact<T, never>, 'toBeNever'>\n | If<Exact<T, unknown>, 'toBeUnknown'>\n | If<Exact<T, void>, 'toBeVoid'>\n | If<Exact<T, null>, 'toBeNull'>\n | If<Exact<T, undefined>, 'toBeUndefined'>\n | If<Exact<T, true>, 'toBeTrue'>\n | If<Exact<T, false>, 'toBeFalse'>\n >\n ),\n H\n>\n"]}
1
+ {"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/test-utils/expect.ts"],"names":[],"mappings":"","sourcesContent":["import type { Exact, Extends, If, IfTupleIncludes, MutuallyAssignable, ProperExtend, SafePick } from '../main/index.js'\n\n/**\n * Represents the result of a type assertion based on a boolean condition.\n *\n * - If `true`, the result has a `success` property;\n * - If `false`, the result has a `fail` property;\n * - Otherwise, the result is `never`\n *\n * @template B The boolean condition result (true or false)\n * @template R The type of the result value (default is void)\n */\nexport type TypeAssertionResult<B extends boolean, R = void> = Exact<B, never> extends true ? never\n : [boolean] extends [B] ? never\n : [B] extends [true] ? {\n /**\n * This field exist only when this type assertion succeed\n *\n * If you expect this assertion to fail, use `.fail`\n */\n success: R\n }\n : [B] extends [false] ? {\n /**\n * This field exist only when this type assertion failed\n *\n * If you expect this assertion to success, use `.success`\n */\n fail: R\n }\n : never\n\ntype ExpectTypeMethods<T, H extends PropertyKey = never> = {\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<any>().toBe<any>().success\n * expect<never>().toBe<never>().success\n * expect<false>().toBe<true>().fail\n * ```\n */\n toBe<U>(): TypeAssertionResult<Exact<T, U>, ExpectType<T, H>>\n\n /**\n * Tests if the current type is mutually assignable with the provided type U.\n *\n * It's like:\n *\n * ```ts ignore\n * [T] extends [U] ? [U] extends [T] ? Yes : No : No\n * ```\n *\n * @template U The type to compare with\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<{ a: 1; b: 2 }>().toEqual<{ a: 1 } & { b: 2 }>().success\n * expect<1>().toEqual<1 | 2>().fail\n * ```\n */\n toEqual<U>(): TypeAssertionResult<MutuallyAssignable<T, U>, ExpectType<T, H>>\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<3.14>().toExtend<number>().success\n * expect<2>().toExtend<string>().fail\n * expect<'hello'>().toExtend<string>().success\n * ```\n */\n toExtend<U>(): TypeAssertionResult<Extends<T, U>, ExpectType<T, H>>\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<2>().toProperExtend<number>().success\n * expect<'a' | 'b'>().toProperExtend<string>().success\n * expect<number>().toProperExtend<number>().fail\n * ```\n */\n toProperExtend<U>(): TypeAssertionResult<ProperExtend<T, U>, ExpectType<T, H>>\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 * ### Behavior\n *\n * - For single keys: succeeds if the key exists in `T`\n * - For union types: succeeds only if **all** keys in the union exist in `T`\n *\n * ### Examples\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * type WithProp = { prop: string; another: number; may?: 5 }\n *\n * // Single key checks\n * expect<WithProp>().toHaveKey<'prop'>().success\n * expect<WithProp>().toHaveKey<'missing'>().fail\n *\n * // Union type checks\n * expect<WithProp>().toHaveKey<'prop' | 'another'>().success\n * expect<WithProp>().toHaveKey<'may' | 'unexist'>().fail\n * ```\n */\n toHaveKey<K extends PropertyKey>(): IfTupleIncludes<\n [never, any],\n K,\n never,\n TypeAssertionResult<Extends<K, keyof T>, ExpectType<T, H>>\n >\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\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}>().toHaveKey<'name'>().success\n * ```\n */\nexport type ExpectType<T, H extends PropertyKey = never> = Omit<\n (\n & ExpectTypeMethods<T, H>\n & {\n T: T\n inspect: { [K in keyof T]: T[K] }\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<3.14>().toExtendNumber\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<'hello'>().toExtendString\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 * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<true>().toExtendBoolean\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 * Alias for {@link ExpectTypeMethods.toBe} where `U = any`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<any>().toBeAny\n * expect<any>().toBe<any>().success\n * ```\n */\n toBeAny: ExpectType<T, H | 'toBeAny' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = never`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<never>().toBeNever\n * expect<never>().toBe<never>().success\n * ```\n */\n toBeNever: ExpectType<T, H | 'toBeNever' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = unknown`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<unknown>().toBeUnknown\n * expect<unknown>().toBe<unknown>().success\n * ```\n */\n toBeUnknown: ExpectType<T, H | 'toBeUnknown' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = void`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<void>().toBeVoid\n * expect<void>().toBe<void>().success\n * ```\n */\n toBeVoid: ExpectType<T, H | 'toBeVoid' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = null`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<null>().toBeNull\n * expect<null>().toBe<null>().success\n * ```\n */\n toBeNull: ExpectType<T, H | 'toBeNull' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = undefined`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<undefined>().toBeUndefined\n * expect<undefined>().toBe<undefined>().success\n * ```\n */\n toBeUndefined: ExpectType<T, H | 'toBeUndefined' | 'toBe'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = true`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<true>().toBeTrue\n * expect<true>().toBe<true>().success\n * ```\n */\n toBeTrue: ExpectType<T, H | 'toBeTrue' | 'toBe' | 'toExtendBoolean'>\n\n /**\n * Alias for {@link ExpectTypeMethods.toBe} where `U = false`\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing/test-utils'\n *\n * expect<false>().toBeFalse\n * expect<false>().toBe<false>().success\n * ```\n */\n toBeFalse: ExpectType<T, H | 'toBeFalse' | 'toBe' | 'toExtendBoolean'>\n },\n | If<Exact<T, any>, 'toBeAny'>\n | If<Exact<T, never>, 'toBeNever'>\n | If<Exact<T, unknown>, 'toBeUnknown'>\n | If<Exact<T, void>, 'toBeVoid'>\n | If<Exact<T, null>, 'toBeNull'>\n | If<Exact<T, undefined>, 'toBeUndefined'>\n | If<Exact<T, true>, 'toBeTrue'>\n | If<Exact<T, false>, 'toBeFalse'>\n >\n ),\n H\n>\n"]}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)
3
+ *
4
+ * @module
5
+ */
1
6
  import type { CompareTypes } from './compare.js';
2
7
  import type { ExpectType } from './expect.js';
3
8
  export type { CompareTypes } from './compare.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,eAAO,MAAM,IAAI,EAAE,GA0BlB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACnD,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAK7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAA;AAC1C,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,IAAI,EAAE,GA0BlB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACnD,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAK7D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAA;AAC1C,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA"}
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)
4
+ *
5
+ * @module
6
+ */
2
7
  Object.defineProperty(exports, "__esModule", { value: true });
3
8
  exports.NOOP = void 0;
4
9
  exports.compare = compare;
@@ -28,7 +33,6 @@ exports.expect = expect;
28
33
  * await NOOP; // does not await (not thenable)
29
34
  * ```
30
35
  */
31
- // deno-lint-ignore no-explicit-any
32
36
  exports.NOOP = new Proxy(function () {
33
37
  return exports.NOOP;
34
38
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":";;;AAgFA,0BAEC;AAuBD,wBAEC;AArGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,mCAAmC;AACtB,QAAA,IAAI,GAAQ,IAAI,KAAK,CAChC;IACE,OAAO,YAAI,CAAA;AACb,CAAC,EACD;IACE,GAAG,CAAC,CAAC,EAAE,IAAI;QACT,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,MAAM;gBACT,OAAO,SAAS,CAAA;YAClB,KAAK,SAAS,CAAC;YACf,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC,WAAW;gBACrB,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAA;YACvB;gBACE,OAAO,YAAI,CAAA;QACf,CAAC;IACH,CAAC;IACD,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;IACf,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,YAAI;KACZ,CAAC;IACF,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI;IAC1B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;IACf,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC;CAC7B,CACF,CAAA;AAsBD,SAAgB,OAAO;IACrB,OAAO,YAAI,CAAA;AACb,CAAC;AAuBD,SAAgB,MAAM;IACpB,OAAO,YAAI,CAAA;AACb,CAAC","sourcesContent":["import type { CompareTypes } from './compare.js'\nimport type { ExpectType } from './expect.js'\n\nexport type { CompareTypes } from './compare.js'\nexport type { ExpectType } from './expect.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 * @example\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 */\n// deno-lint-ignore no-explicit-any\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 * 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 * @example\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\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 * @example\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/test-utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAiFH,0BAEC;AAuBD,wBAEC;AApGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACU,QAAA,IAAI,GAAQ,IAAI,KAAK,CAChC;IACE,OAAO,YAAI,CAAA;AACb,CAAC,EACD;IACE,GAAG,CAAC,CAAC,EAAE,IAAI;QACT,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,MAAM;gBACT,OAAO,SAAS,CAAA;YAClB,KAAK,SAAS,CAAC;YACf,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC,WAAW;gBACrB,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAA;YACvB;gBACE,OAAO,YAAI,CAAA;QACf,CAAC;IACH,CAAC;IACD,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;IACf,wBAAwB,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,YAAI;KACZ,CAAC;IACF,cAAc,EAAE,GAAG,EAAE,CAAC,IAAI;IAC1B,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI;IACf,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,CAAC;CAC7B,CACF,CAAA;AAsBD,SAAgB,OAAO;IACrB,OAAO,YAAI,CAAA;AACb,CAAC;AAuBD,SAAgB,MAAM;IACpB,OAAO,YAAI,CAAA;AACb,CAAC","sourcesContent":["/**\n * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)\n *\n * @module\n */\n\nimport type { CompareTypes } from './compare.js'\nimport type { ExpectType } from './expect.js'\n\nexport type { CompareTypes } from './compare.js'\nexport type { ExpectType } from './expect.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 * @example\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 * 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 * @example\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\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 * @example\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"]}