lay-sing 0.2.1 → 0.4.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 (340) hide show
  1. package/README.md +31 -35
  2. package/esm/main/expect/index.d.ts +31 -0
  3. package/esm/main/expect/index.d.ts.map +1 -0
  4. package/esm/main/expect/index.js +2 -0
  5. package/esm/main/expect/index.js.map +1 -0
  6. package/esm/main/expect/to/be.d.ts +23 -0
  7. package/esm/main/expect/to/be.d.ts.map +1 -0
  8. package/esm/main/expect/to/be.js +2 -0
  9. package/esm/main/expect/to/be.js.map +1 -0
  10. package/esm/main/expect/to/equal.d.ts +26 -0
  11. package/esm/main/expect/to/equal.d.ts.map +1 -0
  12. package/esm/main/expect/to/equal.js +2 -0
  13. package/esm/main/expect/to/equal.js.map +1 -0
  14. package/esm/main/expect/to/extend.d.ts +31 -0
  15. package/esm/main/expect/to/extend.d.ts.map +1 -0
  16. package/esm/main/expect/to/extend.js +2 -0
  17. package/esm/main/expect/to/extend.js.map +1 -0
  18. package/esm/main/expect/to/have-key.d.ts +38 -0
  19. package/esm/main/expect/to/have-key.d.ts.map +1 -0
  20. package/esm/main/expect/to/have-key.js +2 -0
  21. package/esm/main/expect/to/have-key.js.map +1 -0
  22. package/esm/main/expect/to/index.d.ts +13 -0
  23. package/esm/main/expect/to/index.d.ts.map +1 -0
  24. package/esm/main/expect/to/index.js +2 -0
  25. package/esm/main/expect/to/index.js.map +1 -0
  26. package/esm/main/expect/to/proper-extends.d.ts +21 -0
  27. package/esm/main/expect/to/proper-extends.d.ts.map +1 -0
  28. package/esm/main/expect/to/proper-extends.js +2 -0
  29. package/esm/main/expect/to/proper-extends.js.map +1 -0
  30. package/esm/main/index.d.ts +26 -11
  31. package/esm/main/index.d.ts.map +1 -1
  32. package/esm/main/index.js +22 -13
  33. package/esm/main/index.js.map +1 -1
  34. package/esm/main/noop.d.ts +27 -0
  35. package/esm/main/noop.d.ts.map +1 -0
  36. package/esm/{test-utils/index.js → main/noop.js} +1 -12
  37. package/esm/main/noop.js.map +1 -0
  38. package/esm/utils/compare/assignable.d.ts +30 -0
  39. package/esm/utils/compare/assignable.d.ts.map +1 -0
  40. package/esm/utils/compare/assignable.js +2 -0
  41. package/esm/utils/compare/assignable.js.map +1 -0
  42. package/esm/utils/compare/exact.d.ts +50 -0
  43. package/esm/utils/compare/exact.d.ts.map +1 -0
  44. package/esm/utils/compare/exact.js +2 -0
  45. package/esm/utils/compare/exact.js.map +1 -0
  46. package/esm/utils/compare/extends.d.ts +46 -0
  47. package/esm/utils/compare/extends.d.ts.map +1 -0
  48. package/esm/utils/compare/extends.js +2 -0
  49. package/esm/utils/compare/extends.js.map +1 -0
  50. package/esm/utils/compare/index.d.ts +5 -0
  51. package/esm/utils/compare/index.d.ts.map +1 -0
  52. package/esm/utils/compare/index.js +7 -0
  53. package/esm/utils/compare/index.js.map +1 -0
  54. package/esm/utils/compare/overlap.d.ts +47 -0
  55. package/esm/utils/compare/overlap.d.ts.map +1 -0
  56. package/esm/utils/compare/overlap.js +2 -0
  57. package/esm/utils/compare/overlap.js.map +1 -0
  58. package/esm/utils/index.d.ts +11 -0
  59. package/esm/utils/index.d.ts.map +1 -0
  60. package/esm/utils/index.js +13 -0
  61. package/esm/utils/index.js.map +1 -0
  62. package/esm/utils/logic/assert.d.ts +18 -0
  63. package/esm/utils/logic/assert.d.ts.map +1 -0
  64. package/esm/utils/logic/assert.js +2 -0
  65. package/esm/utils/logic/assert.js.map +1 -0
  66. package/esm/utils/logic/if.d.ts +37 -0
  67. package/esm/utils/logic/if.d.ts.map +1 -0
  68. package/esm/utils/logic/if.js +2 -0
  69. package/esm/utils/logic/if.js.map +1 -0
  70. package/esm/utils/logic/index.d.ts +4 -0
  71. package/esm/utils/logic/index.d.ts.map +1 -0
  72. package/esm/utils/logic/index.js +6 -0
  73. package/esm/utils/logic/index.js.map +1 -0
  74. package/{script/main/control.d.ts → esm/utils/logic/switch.d.ts} +15 -40
  75. package/esm/utils/logic/switch.d.ts.map +1 -0
  76. package/esm/utils/logic/switch.js +2 -0
  77. package/esm/utils/logic/switch.js.map +1 -0
  78. package/esm/utils/misc.d.ts +34 -0
  79. package/esm/utils/misc.d.ts.map +1 -0
  80. package/esm/utils/misc.js +2 -0
  81. package/esm/utils/misc.js.map +1 -0
  82. package/esm/utils/object/index.d.ts +4 -0
  83. package/esm/utils/object/index.d.ts.map +1 -0
  84. package/esm/utils/object/index.js +6 -0
  85. package/esm/utils/object/index.js.map +1 -0
  86. package/{script/main/key.d.ts → esm/utils/object/keys.d.ts} +34 -34
  87. package/esm/utils/object/keys.d.ts.map +1 -0
  88. package/esm/utils/object/keys.js +2 -0
  89. package/esm/utils/object/keys.js.map +1 -0
  90. package/esm/utils/object/pick.d.ts +16 -0
  91. package/esm/utils/object/pick.d.ts.map +1 -0
  92. package/esm/utils/object/pick.js +2 -0
  93. package/esm/utils/object/pick.js.map +1 -0
  94. package/esm/utils/object/props.d.ts +17 -0
  95. package/esm/utils/object/props.d.ts.map +1 -0
  96. package/esm/utils/object/props.js +2 -0
  97. package/esm/utils/object/props.js.map +1 -0
  98. package/esm/utils/tuple/append.d.ts +17 -0
  99. package/esm/utils/tuple/append.d.ts.map +1 -0
  100. package/esm/utils/tuple/append.js +2 -0
  101. package/esm/utils/tuple/append.js.map +1 -0
  102. package/esm/utils/tuple/concat.d.ts +31 -0
  103. package/esm/utils/tuple/concat.d.ts.map +1 -0
  104. package/esm/utils/tuple/concat.js +2 -0
  105. package/esm/utils/tuple/concat.js.map +1 -0
  106. package/esm/utils/tuple/includes.d.ts +20 -0
  107. package/esm/utils/tuple/includes.d.ts.map +1 -0
  108. package/esm/utils/tuple/includes.js +2 -0
  109. package/esm/utils/tuple/includes.js.map +1 -0
  110. package/esm/utils/tuple/index.d.ts +4 -0
  111. package/esm/utils/tuple/index.d.ts.map +1 -0
  112. package/esm/utils/tuple/index.js +6 -0
  113. package/esm/utils/tuple/index.js.map +1 -0
  114. package/package.json +5 -5
  115. package/script/main/expect/index.d.ts +31 -0
  116. package/script/main/expect/index.d.ts.map +1 -0
  117. package/script/main/{async.js → expect/index.js} +1 -1
  118. package/script/main/expect/index.js.map +1 -0
  119. package/script/main/expect/to/be.d.ts +23 -0
  120. package/script/main/expect/to/be.d.ts.map +1 -0
  121. package/script/main/{type/set.js → expect/to/be.js} +1 -1
  122. package/script/main/expect/to/be.js.map +1 -0
  123. package/script/main/expect/to/equal.d.ts +26 -0
  124. package/script/main/expect/to/equal.d.ts.map +1 -0
  125. package/script/main/expect/to/equal.js +3 -0
  126. package/script/main/expect/to/equal.js.map +1 -0
  127. package/script/main/expect/to/extend.d.ts +31 -0
  128. package/script/main/expect/to/extend.d.ts.map +1 -0
  129. package/script/main/expect/to/extend.js +3 -0
  130. package/script/main/expect/to/extend.js.map +1 -0
  131. package/script/main/expect/to/have-key.d.ts +38 -0
  132. package/script/main/expect/to/have-key.d.ts.map +1 -0
  133. package/script/main/expect/to/have-key.js +3 -0
  134. package/script/main/expect/to/have-key.js.map +1 -0
  135. package/script/main/expect/to/index.d.ts +13 -0
  136. package/script/main/expect/to/index.d.ts.map +1 -0
  137. package/script/main/expect/to/index.js +3 -0
  138. package/script/main/expect/to/index.js.map +1 -0
  139. package/script/main/expect/to/proper-extends.d.ts +21 -0
  140. package/script/main/expect/to/proper-extends.d.ts.map +1 -0
  141. package/script/main/expect/to/proper-extends.js +3 -0
  142. package/script/main/expect/to/proper-extends.js.map +1 -0
  143. package/script/main/index.d.ts +26 -11
  144. package/script/main/index.d.ts.map +1 -1
  145. package/script/main/index.js +24 -27
  146. package/script/main/index.js.map +1 -1
  147. package/script/main/noop.d.ts +27 -0
  148. package/script/main/noop.d.ts.map +1 -0
  149. package/script/{test-utils/index.js → main/noop.js} +1 -14
  150. package/script/main/noop.js.map +1 -0
  151. package/script/utils/compare/assignable.d.ts +30 -0
  152. package/script/utils/compare/assignable.d.ts.map +1 -0
  153. package/script/utils/compare/assignable.js +3 -0
  154. package/script/utils/compare/assignable.js.map +1 -0
  155. package/script/utils/compare/exact.d.ts +50 -0
  156. package/script/utils/compare/exact.d.ts.map +1 -0
  157. package/script/utils/compare/exact.js +3 -0
  158. package/script/utils/compare/exact.js.map +1 -0
  159. package/script/utils/compare/extends.d.ts +46 -0
  160. package/script/utils/compare/extends.d.ts.map +1 -0
  161. package/script/{main/boolean.js → utils/compare/extends.js} +1 -1
  162. package/script/utils/compare/extends.js.map +1 -0
  163. package/script/utils/compare/index.d.ts +5 -0
  164. package/script/utils/compare/index.d.ts.map +1 -0
  165. package/script/utils/compare/index.js +23 -0
  166. package/script/utils/compare/index.js.map +1 -0
  167. package/script/utils/compare/overlap.d.ts +47 -0
  168. package/script/utils/compare/overlap.d.ts.map +1 -0
  169. package/script/{main/control.js → utils/compare/overlap.js} +1 -1
  170. package/script/utils/compare/overlap.js.map +1 -0
  171. package/script/utils/index.d.ts +11 -0
  172. package/script/utils/index.d.ts.map +1 -0
  173. package/script/utils/index.js +29 -0
  174. package/script/utils/index.js.map +1 -0
  175. package/script/utils/logic/assert.d.ts +18 -0
  176. package/script/utils/logic/assert.d.ts.map +1 -0
  177. package/script/utils/logic/assert.js +3 -0
  178. package/script/utils/logic/assert.js.map +1 -0
  179. package/script/utils/logic/if.d.ts +37 -0
  180. package/script/utils/logic/if.d.ts.map +1 -0
  181. package/script/{main/key.js → utils/logic/if.js} +1 -1
  182. package/script/utils/logic/if.js.map +1 -0
  183. package/script/utils/logic/index.d.ts +4 -0
  184. package/script/utils/logic/index.d.ts.map +1 -0
  185. package/script/utils/logic/index.js +22 -0
  186. package/script/utils/logic/index.js.map +1 -0
  187. package/{esm/main/control.d.ts → script/utils/logic/switch.d.ts} +15 -40
  188. package/script/utils/logic/switch.d.ts.map +1 -0
  189. package/script/utils/logic/switch.js +3 -0
  190. package/script/utils/logic/switch.js.map +1 -0
  191. package/script/utils/misc.d.ts +34 -0
  192. package/script/utils/misc.d.ts.map +1 -0
  193. package/script/{main/json.js → utils/misc.js} +1 -1
  194. package/script/utils/misc.js.map +1 -0
  195. package/script/utils/object/index.d.ts +4 -0
  196. package/script/utils/object/index.d.ts.map +1 -0
  197. package/script/{main/type → utils/object}/index.js +3 -2
  198. package/script/utils/object/index.js.map +1 -0
  199. package/{esm/main/key.d.ts → script/utils/object/keys.d.ts} +34 -34
  200. package/script/utils/object/keys.d.ts.map +1 -0
  201. package/script/{main/doc.js → utils/object/keys.js} +1 -1
  202. package/script/utils/object/keys.js.map +1 -0
  203. package/script/utils/object/pick.d.ts +16 -0
  204. package/script/utils/object/pick.d.ts.map +1 -0
  205. package/script/utils/object/pick.js +3 -0
  206. package/script/utils/object/pick.js.map +1 -0
  207. package/script/utils/object/props.d.ts +17 -0
  208. package/script/utils/object/props.d.ts.map +1 -0
  209. package/script/utils/object/props.js +3 -0
  210. package/script/utils/object/props.js.map +1 -0
  211. package/script/utils/tuple/append.d.ts +17 -0
  212. package/script/utils/tuple/append.d.ts.map +1 -0
  213. package/script/utils/tuple/append.js +3 -0
  214. package/script/utils/tuple/append.js.map +1 -0
  215. package/script/utils/tuple/concat.d.ts +31 -0
  216. package/script/utils/tuple/concat.d.ts.map +1 -0
  217. package/script/utils/tuple/concat.js +3 -0
  218. package/script/utils/tuple/concat.js.map +1 -0
  219. package/script/utils/tuple/includes.d.ts +20 -0
  220. package/script/utils/tuple/includes.d.ts.map +1 -0
  221. package/script/utils/tuple/includes.js +3 -0
  222. package/script/utils/tuple/includes.js.map +1 -0
  223. package/script/utils/tuple/index.d.ts +4 -0
  224. package/script/utils/tuple/index.d.ts.map +1 -0
  225. package/script/utils/tuple/index.js +22 -0
  226. package/script/utils/tuple/index.js.map +1 -0
  227. package/esm/main/async.d.ts +0 -13
  228. package/esm/main/async.d.ts.map +0 -1
  229. package/esm/main/async.js +0 -2
  230. package/esm/main/async.js.map +0 -1
  231. package/esm/main/boolean.d.ts +0 -59
  232. package/esm/main/boolean.d.ts.map +0 -1
  233. package/esm/main/boolean.js +0 -2
  234. package/esm/main/boolean.js.map +0 -1
  235. package/esm/main/control.d.ts.map +0 -1
  236. package/esm/main/control.js +0 -2
  237. package/esm/main/control.js.map +0 -1
  238. package/esm/main/doc.d.ts +0 -56
  239. package/esm/main/doc.d.ts.map +0 -1
  240. package/esm/main/doc.js +0 -2
  241. package/esm/main/doc.js.map +0 -1
  242. package/esm/main/function.d.ts +0 -27
  243. package/esm/main/function.d.ts.map +0 -1
  244. package/esm/main/function.js +0 -2
  245. package/esm/main/function.js.map +0 -1
  246. package/esm/main/json.d.ts +0 -44
  247. package/esm/main/json.d.ts.map +0 -1
  248. package/esm/main/json.js +0 -2
  249. package/esm/main/json.js.map +0 -1
  250. package/esm/main/key.d.ts.map +0 -1
  251. package/esm/main/key.js +0 -2
  252. package/esm/main/key.js.map +0 -1
  253. package/esm/main/object.d.ts +0 -120
  254. package/esm/main/object.d.ts.map +0 -1
  255. package/esm/main/object.js +0 -2
  256. package/esm/main/object.js.map +0 -1
  257. package/esm/main/tuple.d.ts +0 -64
  258. package/esm/main/tuple.d.ts.map +0 -1
  259. package/esm/main/tuple.js +0 -2
  260. package/esm/main/tuple.js.map +0 -1
  261. package/esm/main/type/compare.d.ts +0 -169
  262. package/esm/main/type/compare.d.ts.map +0 -1
  263. package/esm/main/type/compare.js +0 -2
  264. package/esm/main/type/compare.js.map +0 -1
  265. package/esm/main/type/index.d.ts +0 -3
  266. package/esm/main/type/index.d.ts.map +0 -1
  267. package/esm/main/type/index.js +0 -5
  268. package/esm/main/type/index.js.map +0 -1
  269. package/esm/main/type/set.d.ts +0 -34
  270. package/esm/main/type/set.d.ts.map +0 -1
  271. package/esm/main/type/set.js +0 -2
  272. package/esm/main/type/set.js.map +0 -1
  273. package/esm/main/typed-array.d.ts +0 -5
  274. package/esm/main/typed-array.d.ts.map +0 -1
  275. package/esm/main/typed-array.js +0 -2
  276. package/esm/main/typed-array.js.map +0 -1
  277. package/esm/test-utils/compare.d.ts +0 -81
  278. package/esm/test-utils/compare.d.ts.map +0 -1
  279. package/esm/test-utils/compare.js +0 -2
  280. package/esm/test-utils/compare.js.map +0 -1
  281. package/esm/test-utils/expect.d.ts +0 -278
  282. package/esm/test-utils/expect.d.ts.map +0 -1
  283. package/esm/test-utils/expect.js +0 -2
  284. package/esm/test-utils/expect.js.map +0 -1
  285. package/esm/test-utils/index.d.ts +0 -77
  286. package/esm/test-utils/index.d.ts.map +0 -1
  287. package/esm/test-utils/index.js.map +0 -1
  288. package/script/main/async.d.ts +0 -13
  289. package/script/main/async.d.ts.map +0 -1
  290. package/script/main/async.js.map +0 -1
  291. package/script/main/boolean.d.ts +0 -59
  292. package/script/main/boolean.d.ts.map +0 -1
  293. package/script/main/boolean.js.map +0 -1
  294. package/script/main/control.d.ts.map +0 -1
  295. package/script/main/control.js.map +0 -1
  296. package/script/main/doc.d.ts +0 -56
  297. package/script/main/doc.d.ts.map +0 -1
  298. package/script/main/doc.js.map +0 -1
  299. package/script/main/function.d.ts +0 -27
  300. package/script/main/function.d.ts.map +0 -1
  301. package/script/main/function.js +0 -3
  302. package/script/main/function.js.map +0 -1
  303. package/script/main/json.d.ts +0 -44
  304. package/script/main/json.d.ts.map +0 -1
  305. package/script/main/json.js.map +0 -1
  306. package/script/main/key.d.ts.map +0 -1
  307. package/script/main/key.js.map +0 -1
  308. package/script/main/object.d.ts +0 -120
  309. package/script/main/object.d.ts.map +0 -1
  310. package/script/main/object.js +0 -3
  311. package/script/main/object.js.map +0 -1
  312. package/script/main/tuple.d.ts +0 -64
  313. package/script/main/tuple.d.ts.map +0 -1
  314. package/script/main/tuple.js +0 -3
  315. package/script/main/tuple.js.map +0 -1
  316. package/script/main/type/compare.d.ts +0 -169
  317. package/script/main/type/compare.d.ts.map +0 -1
  318. package/script/main/type/compare.js +0 -3
  319. package/script/main/type/compare.js.map +0 -1
  320. package/script/main/type/index.d.ts +0 -3
  321. package/script/main/type/index.d.ts.map +0 -1
  322. package/script/main/type/index.js.map +0 -1
  323. package/script/main/type/set.d.ts +0 -34
  324. package/script/main/type/set.d.ts.map +0 -1
  325. package/script/main/type/set.js.map +0 -1
  326. package/script/main/typed-array.d.ts +0 -5
  327. package/script/main/typed-array.d.ts.map +0 -1
  328. package/script/main/typed-array.js +0 -3
  329. package/script/main/typed-array.js.map +0 -1
  330. package/script/test-utils/compare.d.ts +0 -81
  331. package/script/test-utils/compare.d.ts.map +0 -1
  332. package/script/test-utils/compare.js +0 -3
  333. package/script/test-utils/compare.js.map +0 -1
  334. package/script/test-utils/expect.d.ts +0 -278
  335. package/script/test-utils/expect.d.ts.map +0 -1
  336. package/script/test-utils/expect.js +0 -3
  337. package/script/test-utils/expect.js.map +0 -1
  338. package/script/test-utils/index.d.ts +0 -77
  339. package/script/test-utils/index.d.ts.map +0 -1
  340. package/script/test-utils/index.js.map +0 -1
@@ -0,0 +1,21 @@
1
+ import type { ProperExtend } from '../../../utils/index.js';
2
+ import type { TypeAssertionResult } from '../index.js';
3
+ export type ProperExtends<T> = {
4
+ /**
5
+ * Tests if the current type T properly extends the provided type U (extends but is not the same).
6
+ *
7
+ * @template U The type to check proper extension against
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import { expect } from '@leawind/lay-sing'
12
+ *
13
+ * expect<2>().to.properExtend<number>().pass
14
+ * expect<'a' | 'b'>().to.properExtend<string>().pass
15
+ * expect<number>().to.properExtend<number>().fail
16
+ * ```
17
+ */
18
+ <U>(): TypeAssertionResult<ProperExtend<T, U>>;
19
+ <U>(_: U): TypeAssertionResult<ProperExtend<T, U>>;
20
+ };
21
+ //# sourceMappingURL=proper-extends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proper-extends.d.ts","sourceRoot":"","sources":["../../../../src/main/expect/to/proper-extends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEtD,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B;;;;;;;;;;;;;OAaG;IACH,CAAC,CAAC,KAAK,mBAAmB,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC9C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;CACnD,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=proper-extends.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proper-extends.js","sourceRoot":"","sources":["../../../../src/main/expect/to/proper-extends.ts"],"names":[],"mappings":"","sourcesContent":["import type { ProperExtend } from '../../../utils/index.js'\nimport type { TypeAssertionResult } from '../index.js'\n\nexport type ProperExtends<T> = {\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'\n *\n * expect<2>().to.properExtend<number>().pass\n * expect<'a' | 'b'>().to.properExtend<string>().pass\n * expect<number>().to.properExtend<number>().fail\n * ```\n */\n <U>(): TypeAssertionResult<ProperExtend<T, U>>\n <U>(_: U): TypeAssertionResult<ProperExtend<T, U>>\n}\n"]}
@@ -3,15 +3,30 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- export * from './async.js';
7
- export * from './boolean.js';
8
- export * from './control.js';
9
- export * from './doc.js';
10
- export * from './function.js';
11
- export * from './json.js';
12
- export * from './key.js';
13
- export * from './object.js';
14
- export * from './tuple.js';
15
- export * from './type/index.js';
16
- export * from './typed-array.js';
6
+ import type { ExpectType } from './expect/index.js';
7
+ export type { ExpectType } from './expect/index.js';
8
+ export { NOOP } from './noop.js';
9
+ /**
10
+ * Creates an instance of ExpectType to perform type-level assertions on the given type.
11
+ * This function enables testing various type relationships at compile time.
12
+ * NOTE: This function does nothing at runtime and is purely for type-level testing.
13
+ *
14
+ * @template T The type to be tested
15
+ *
16
+ * @returns An ExpectType instance with methods to test type relationships
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Test exact type equality
21
+ * expect<number>().to.be<number>().pass
22
+ * expect<number>().to.be<string>().fail
23
+ * // Test if one type extends another
24
+ * expect<3.14>().to.extend<number>().pass
25
+ * expect<2>().to.extend<string>().fail
26
+ * ```
27
+ */
28
+ export declare const expect: {
29
+ <T>(): ExpectType<T>;
30
+ <T>(_: T): ExpectType<T>;
31
+ };
17
32
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAGnD,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,EAAE;IACnB,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAA;IACpB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;CAClB,CAAA"}
@@ -4,32 +4,29 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
7
  Object.defineProperty(exports, "__esModule", { value: true });
22
- // Index start >>>>>>>>>>>>>>>>
23
- __exportStar(require("./async.js"), exports);
24
- __exportStar(require("./boolean.js"), exports);
25
- __exportStar(require("./control.js"), exports);
26
- __exportStar(require("./doc.js"), exports);
27
- __exportStar(require("./function.js"), exports);
28
- __exportStar(require("./json.js"), exports);
29
- __exportStar(require("./key.js"), exports);
30
- __exportStar(require("./object.js"), exports);
31
- __exportStar(require("./tuple.js"), exports);
32
- __exportStar(require("./type/index.js"), exports);
33
- __exportStar(require("./typed-array.js"), exports);
34
- // <<<<<<<<<<<<<<<< Index end
8
+ exports.expect = exports.NOOP = void 0;
9
+ const noop_js_1 = require("./noop.js");
10
+ var noop_js_2 = require("./noop.js");
11
+ Object.defineProperty(exports, "NOOP", { enumerable: true, get: function () { return noop_js_2.NOOP; } });
12
+ /**
13
+ * Creates an instance of ExpectType to perform type-level assertions on the given type.
14
+ * This function enables testing various type relationships at compile time.
15
+ * NOTE: This function does nothing at runtime and is purely for type-level testing.
16
+ *
17
+ * @template T The type to be tested
18
+ *
19
+ * @returns An ExpectType instance with methods to test type relationships
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * // Test exact type equality
24
+ * expect<number>().to.be<number>().pass
25
+ * expect<number>().to.be<string>().fail
26
+ * // Test if one type extends another
27
+ * expect<3.14>().to.extend<number>().pass
28
+ * expect<2>().to.extend<string>().fail
29
+ * ```
30
+ */
31
+ exports.expect = noop_js_1.NOOP;
35
32
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,+BAA+B;AAC/B,6CAA0B;AAC1B,+CAA4B;AAC5B,+CAA4B;AAC5B,2CAAwB;AACxB,gDAA6B;AAC7B,4CAAyB;AACzB,2CAAwB;AACxB,8CAA2B;AAC3B,6CAA0B;AAC1B,kDAA+B;AAC/B,mDAAgC;AAChC,+BAA+B","sourcesContent":["/**\n * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)\n *\n * @module\n */\n\n// Index start >>>>>>>>>>>>>>>>\nexport * from './async.js'\nexport * from './boolean.js'\nexport * from './control.js'\nexport * from './doc.js'\nexport * from './function.js'\nexport * from './json.js'\nexport * from './key.js'\nexport * from './object.js'\nexport * from './tuple.js'\nexport * from './type/index.js'\nexport * from './typed-array.js'\n// <<<<<<<<<<<<<<<< Index end\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,uCAAgC;AAGhC,qCAAgC;AAAvB,+FAAA,IAAI,OAAA;AAEb;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,MAAM,GAGf,cAAI,CAAA","sourcesContent":["/**\n * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)\n *\n * @module\n */\n\nimport type { ExpectType } from './expect/index.js'\nimport { NOOP } from './noop.js'\n\nexport type { ExpectType } from './expect/index.js'\nexport { NOOP } from './noop.js'\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>().to.be<number>().pass\n * expect<number>().to.be<string>().fail\n * // Test if one type extends another\n * expect<3.14>().to.extend<number>().pass\n * expect<2>().to.extend<string>().fail\n * ```\n */\nexport const expect: {\n <T>(): ExpectType<T>\n <T>(_: T): ExpectType<T>\n} = NOOP\n"]}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A universal no-op placeholder implemented via `Proxy`.
3
+ *
4
+ * `NOOP` can be accessed, called, or chained indefinitely without throwing.
5
+ * Every operation returns itself, making it safe to use as a dummy fallback
6
+ * for APIs, optional hooks, or unimplemented interfaces.
7
+ *
8
+ * ### Special behaviors
9
+ *
10
+ * - Callable: invoking `NOOP()` returns `NOOP`
11
+ * - Property access: `NOOP.anything` returns `NOOP`
12
+ * - Promise-safe: `NOOP.then` is `undefined`, so it is not treated as a Promise
13
+ * - Primitive coercion (`toString`, `valueOf`, `Symbol.toPrimitive`) yields
14
+ * a stable string representation: `"[NOOP]"`
15
+ *
16
+ * This is useful in scenarios where a value is required syntactically but
17
+ * should perform no action and never fail at runtime.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * NOOP.foo.bar().baz.qux; // safe, returns NOOP
22
+ * String(NOOP); // "[NOOP]"
23
+ * await NOOP; // does not await (not thenable)
24
+ * ```
25
+ */
26
+ export declare const NOOP: any;
27
+ //# sourceMappingURL=noop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.d.ts","sourceRoot":"","sources":["../../src/main/noop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,IAAI,EAAE,GA0BlB,CAAA"}
@@ -1,13 +1,6 @@
1
1
  "use strict";
2
- /**
3
- * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)
4
- *
5
- * @module
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.NOOP = void 0;
9
- exports.compare = compare;
10
- exports.expect = expect;
11
4
  /**
12
5
  * A universal no-op placeholder implemented via `Proxy`.
13
6
  *
@@ -57,10 +50,4 @@ exports.NOOP = new Proxy(function () {
57
50
  has: () => true,
58
51
  ownKeys: () => ['prototype'],
59
52
  });
60
- function compare() {
61
- return exports.NOOP;
62
- }
63
- function expect() {
64
- return exports.NOOP;
65
- }
66
- //# sourceMappingURL=index.js.map
53
+ //# sourceMappingURL=noop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"noop.js","sourceRoot":"","sources":["../../src/main/noop.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;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","sourcesContent":["/**\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"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Checks whether two types are mutually assignable.
3
+ *
4
+ * This is equivalent to checking that:
5
+ * - `A` extends `B`
6
+ * - `B` extends `A`
7
+ *
8
+ * In other words, the two types describe the same set of values,
9
+ * even if they are written differently.
10
+ *
11
+ * @template A - The first type to check
12
+ * @template B - The second type to check
13
+ * @template Yes - The result if types are mutually assignable (defaults to `true`)
14
+ * @template No - The result if types are not mutually assignable (defaults to `false`)
15
+ *
16
+ * ### Result
17
+ *
18
+ * - `Yes`: `A` and `B` are mutually assignable
19
+ * - `No`: Otherwise
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * type T1 = MutuallyAssignable<number, number> // true
24
+ * type T2 = MutuallyAssignable<1 | 2, 2 | 1> // true
25
+ * type F1 = MutuallyAssignable<string, number> // false
26
+ * type F2 = MutuallyAssignable<1, number> // false
27
+ * ```
28
+ */
29
+ export type MutuallyAssignable<A, B, Yes = true, No = false> = [A] extends [B] ? [B] extends [A] ? Yes : No : No;
30
+ //# sourceMappingURL=assignable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignable.d.ts","sourceRoot":"","sources":["../../../src/utils/compare/assignable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,MAAM,kBAAkB,CAC5B,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=assignable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assignable.js","sourceRoot":"","sources":["../../../src/utils/compare/assignable.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Checks whether two types are mutually assignable.\n *\n * This is equivalent to checking that:\n * - `A` extends `B`\n * - `B` extends `A`\n *\n * In other words, the two types describe the same set of values,\n * even if they are written differently.\n *\n * @template A - The first type to check\n * @template B - The second type to check\n * @template Yes - The result if types are mutually assignable (defaults to `true`)\n * @template No - The result if types are not mutually assignable (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` and `B` are mutually assignable\n * - `No`: Otherwise\n *\n * @example\n * ```ts\n * type T1 = MutuallyAssignable<number, number> // true\n * type T2 = MutuallyAssignable<1 | 2, 2 | 1> // true\n * type F1 = MutuallyAssignable<string, number> // false\n * type F2 = MutuallyAssignable<1, number> // false\n * ```\n */\nexport type MutuallyAssignable<\n A,\n B,\n Yes = true,\n No = false,\n> = [A] extends [B] ? [B] extends [A] ? Yes : No : No\n"]}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Checks whether two types are exactly the same.
3
+ *
4
+ * **⚠️Important:** parameter `A` and `B` are not distributive. When they are union type, it does not check each member separately.
5
+ *
6
+ * @template A - The first type to compare
7
+ * @template B - The second type to compare
8
+ * @template Yes - The result if types are exactly the same (defaults to `true`)
9
+ * @template No - The result if types are not exactly the same (defaults to `false`)
10
+ *
11
+ * ### Result
12
+ *
13
+ * - `Yes`: `A` and `B` are exactly the same
14
+ * - `No`: Otherwise
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import { expect } from '@leawind/lay-sing'
19
+ *
20
+ * expect<Exact<string, string>>().to.be.true
21
+ * expect<Exact<never, never>>().to.be.true
22
+ * expect<Exact<any, any>>().to.be.true
23
+ *
24
+ * expect<Exact<{ a: 3 }, { a?: 3 }>>().to.be.false
25
+ * expect<Exact<1 | 2, 1>>().to.be.false
26
+ * expect<Exact<1, number>>().to.be.false
27
+ * expect<Exact<() => void, () => undefined>>().to.be.false
28
+ * ```
29
+ */
30
+ export type Exact<A, B, Yes = true, No = false> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? Yes : No;
31
+ /**
32
+ * Checks whether two types are not exactly the same.
33
+ *
34
+ * This is the logical negation of `Exact<A, B>`.
35
+ *
36
+ * @template A - The first type to compare
37
+ * @template B - The second type to compare
38
+ * @template Yes - The result if types are not exactly the same (defaults to `true`)
39
+ * @template No - The result if types are exactly the same (defaults to `false`)
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * type T1 = NotExact<number, string> // true
44
+ * type T2 = NotExact<1, number> // true
45
+ * type F1 = NotExact<number, number> // false
46
+ * type F2 = NotExact<1, 1> // false
47
+ * ```
48
+ */
49
+ export type NotExact<A, B, Yes = true, No = false> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? No : Yes;
50
+ //# sourceMappingURL=exact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exact.d.ts","sourceRoot":"","sources":["../../../src/utils/compare/exact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,KAAK,CACf,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;AAEpF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,QAAQ,CAClB,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=exact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exact.js","sourceRoot":"","sources":["../../../src/utils/compare/exact.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Checks whether two types are exactly the same.\n *\n * **⚠️Important:** parameter `A` and `B` are not distributive. When they are union type, it does not check each member separately.\n *\n * @template A - The first type to compare\n * @template B - The second type to compare\n * @template Yes - The result if types are exactly the same (defaults to `true`)\n * @template No - The result if types are not exactly the same (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` and `B` are exactly the same\n * - `No`: Otherwise\n *\n * @example\n * ```ts\n * import { expect } from '@leawind/lay-sing'\n *\n * expect<Exact<string, string>>().to.be.true\n * expect<Exact<never, never>>().to.be.true\n * expect<Exact<any, any>>().to.be.true\n *\n * expect<Exact<{ a: 3 }, { a?: 3 }>>().to.be.false\n * expect<Exact<1 | 2, 1>>().to.be.false\n * expect<Exact<1, number>>().to.be.false\n * expect<Exact<() => void, () => undefined>>().to.be.false\n * ```\n */\nexport type Exact<\n A,\n B,\n Yes = true,\n No = false,\n> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? Yes : No\n\n/**\n * Checks whether two types are not exactly the same.\n *\n * This is the logical negation of `Exact<A, B>`.\n *\n * @template A - The first type to compare\n * @template B - The second type to compare\n * @template Yes - The result if types are not exactly the same (defaults to `true`)\n * @template No - The result if types are exactly the same (defaults to `false`)\n *\n * @example\n * ```ts\n * type T1 = NotExact<number, string> // true\n * type T2 = NotExact<1, number> // true\n * type F1 = NotExact<number, number> // false\n * type F2 = NotExact<1, 1> // false\n * ```\n */\nexport type NotExact<\n A,\n B,\n Yes = true,\n No = false,\n> = (<T>() => T extends A ? 1 : 2) extends (<T>() => T extends B ? 1 : 2) ? No : Yes\n"]}
@@ -0,0 +1,46 @@
1
+ import type { Exact } from '../index.js';
2
+ /**
3
+ * Checks whether type `A` extends type `B`.
4
+ *
5
+ * **⚠️Important:** parameter `A` and `B` are not distributive. When they are union type, it treats them as a single entity.
6
+ *
7
+ * @template A - The type to check if it extends another type
8
+ * @template B - The type to check if `A` extends
9
+ * @template Yes - The result if `A` extends `B` (defaults to `true`)
10
+ * @template No - The result if `A` does not extend `B` (defaults to `false`)
11
+ *
12
+ * ### Result
13
+ *
14
+ * - `Yes`: `A` is assignable to `B`
15
+ * - `No`: Otherwise
16
+ */
17
+ export type Extends<A, B, Yes = true, No = false> = [A] extends [B] ? Yes : No;
18
+ /**
19
+ * Checks whether type `A` is a *proper* subtype of type `B`.
20
+ *
21
+ * A proper extension means:
22
+ * - `A` extends `B`
23
+ * - `A` is not exactly the same type as `B`
24
+ *
25
+ * @template A - The type to check if it is a proper subtype
26
+ * @template B - The type to check against
27
+ * @template Yes - The result if `A` is a proper subtype of `B` (defaults to `true`)
28
+ * @template No - The result if `A` is not a proper subtype of `B` (defaults to `false`)
29
+ *
30
+ * ### Result
31
+ *
32
+ * - `Yes`: `A` is a proper subtype of `B`
33
+ * - `No`: Otherwise
34
+ *
35
+ * **Note:** the result will never be `boolean`.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * type T1 = ProperExtend<true, boolean> // true
40
+ * type T2 = ProperExtend<1, number> // true
41
+ * type F1 = ProperExtend<boolean, boolean> // false
42
+ * type F2 = ProperExtend<number, string> // false
43
+ * ```
44
+ */
45
+ export type ProperExtend<A, B, Yes = true, No = false> = [A] extends [B] ? Exact<A, B> extends false ? Yes : No : No;
46
+ //# sourceMappingURL=extends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends.d.ts","sourceRoot":"","sources":["../../../src/utils/compare/extends.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,OAAO,CACjB,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,YAAY,CACtB,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,KAAK,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=boolean.js.map
3
+ //# sourceMappingURL=extends.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extends.js","sourceRoot":"","sources":["../../../src/utils/compare/extends.ts"],"names":[],"mappings":"","sourcesContent":["import type { Exact } from '../index.js'\n\n/**\n * Checks whether type `A` extends type `B`.\n *\n * **⚠️Important:** parameter `A` and `B` are not distributive. When they are union type, it treats them as a single entity.\n *\n * @template A - The type to check if it extends another type\n * @template B - The type to check if `A` extends\n * @template Yes - The result if `A` extends `B` (defaults to `true`)\n * @template No - The result if `A` does not extend `B` (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` is assignable to `B`\n * - `No`: Otherwise\n */\nexport type Extends<\n A,\n B,\n Yes = true,\n No = false,\n> = [A] extends [B] ? Yes : No\n\n/**\n * Checks whether type `A` is a *proper* subtype of type `B`.\n *\n * A proper extension means:\n * - `A` extends `B`\n * - `A` is not exactly the same type as `B`\n *\n * @template A - The type to check if it is a proper subtype\n * @template B - The type to check against\n * @template Yes - The result if `A` is a proper subtype of `B` (defaults to `true`)\n * @template No - The result if `A` is not a proper subtype of `B` (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` is a proper subtype of `B`\n * - `No`: Otherwise\n *\n * **Note:** the result will never be `boolean`.\n *\n * @example\n * ```ts\n * type T1 = ProperExtend<true, boolean> // true\n * type T2 = ProperExtend<1, number> // true\n * type F1 = ProperExtend<boolean, boolean> // false\n * type F2 = ProperExtend<number, string> // false\n * ```\n */\nexport type ProperExtend<\n A,\n B,\n Yes = true,\n No = false,\n> = [A] extends [B] ? Exact<A, B> extends false ? Yes : No : No\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './assignable.js';
2
+ export * from './exact.js';
3
+ export * from './extends.js';
4
+ export * from './overlap.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/compare/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // Index start >>>>>>>>>>>>>>>>
18
+ __exportStar(require("./assignable.js"), exports);
19
+ __exportStar(require("./exact.js"), exports);
20
+ __exportStar(require("./extends.js"), exports);
21
+ __exportStar(require("./overlap.js"), exports);
22
+ // <<<<<<<<<<<<<<<< Index end
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/compare/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,kDAA+B;AAC/B,6CAA0B;AAC1B,+CAA4B;AAC5B,+CAA4B;AAC5B,+BAA+B","sourcesContent":["// Index start >>>>>>>>>>>>>>>>\nexport * from './assignable.js'\nexport * from './exact.js'\nexport * from './extends.js'\nexport * from './overlap.js'\n// <<<<<<<<<<<<<<<< Index end\n"]}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Checks whether two types have any overlapping members.
3
+ *
4
+ * @template A - The first type to check for overlap
5
+ * @template B - The second type to check for overlap
6
+ * @template Yes - The result if types overlap (defaults to `true`)
7
+ * @template No - The result if types do not overlap (defaults to `false`)
8
+ *
9
+ * ### Result
10
+ *
11
+ * - `Yes`: `A` and `B` share at least one common type
12
+ * - `No`: `A` and `B` are completely disjoint
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * type T1 = Overlap<1 | 2, 2 | 3> // true
17
+ * type T2 = Overlap<string, 'hello'> // true
18
+ * type F1 = Overlap<string, number> // false
19
+ * type F2 = Overlap<1, 'one'> // false
20
+ * ```
21
+ */
22
+ export type Overlap<A, B, Yes = true, No = false> = [A & B] extends [never] ? No : Yes;
23
+ /**
24
+ * Checks whether two types are disjoint.
25
+ *
26
+ * This is the logical negation of `Overlap<A, B>`.
27
+ *
28
+ * @template A - The first type to check for disjointness
29
+ * @template B - The second type to check for disjointness
30
+ * @template Yes - The result if types are disjoint (defaults to `true`)
31
+ * @template No - The result if types are not disjoint (defaults to `false`)
32
+ *
33
+ * ### Result
34
+ *
35
+ * - `Yes`: `A` and `B` have no overlap
36
+ * - `No`: `A` and `B` share at least one common type
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * type T1 = Disjoint<string, number> // true
41
+ * type T2 = Disjoint<1, 'one'> // true
42
+ * type F1 = Disjoint<1 | 2, 2 | 3> // false
43
+ * type F2 = Disjoint<string, 'hello'> // false
44
+ * ```
45
+ */
46
+ export type Disjoint<A, B, Yes = true, No = false> = [A & B] extends [never] ? Yes : No;
47
+ //# sourceMappingURL=overlap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlap.d.ts","sourceRoot":"","sources":["../../../src/utils/compare/overlap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,OAAO,CACjB,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA;AAEtC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,QAAQ,CAClB,CAAC,EACD,CAAC,EACD,GAAG,GAAG,IAAI,EACV,EAAE,GAAG,KAAK,IACR,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=control.js.map
3
+ //# sourceMappingURL=overlap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlap.js","sourceRoot":"","sources":["../../../src/utils/compare/overlap.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Checks whether two types have any overlapping members.\n *\n * @template A - The first type to check for overlap\n * @template B - The second type to check for overlap\n * @template Yes - The result if types overlap (defaults to `true`)\n * @template No - The result if types do not overlap (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` and `B` share at least one common type\n * - `No`: `A` and `B` are completely disjoint\n *\n * @example\n * ```ts\n * type T1 = Overlap<1 | 2, 2 | 3> // true\n * type T2 = Overlap<string, 'hello'> // true\n * type F1 = Overlap<string, number> // false\n * type F2 = Overlap<1, 'one'> // false\n * ```\n */\nexport type Overlap<\n A,\n B,\n Yes = true,\n No = false,\n> = [A & B] extends [never] ? No : Yes\n\n/**\n * Checks whether two types are disjoint.\n *\n * This is the logical negation of `Overlap<A, B>`.\n *\n * @template A - The first type to check for disjointness\n * @template B - The second type to check for disjointness\n * @template Yes - The result if types are disjoint (defaults to `true`)\n * @template No - The result if types are not disjoint (defaults to `false`)\n *\n * ### Result\n *\n * - `Yes`: `A` and `B` have no overlap\n * - `No`: `A` and `B` share at least one common type\n *\n * @example\n * ```ts\n * type T1 = Disjoint<string, number> // true\n * type T2 = Disjoint<1, 'one'> // true\n * type F1 = Disjoint<1 | 2, 2 | 3> // false\n * type F2 = Disjoint<string, 'hello'> // false\n * ```\n */\nexport type Disjoint<\n A,\n B,\n Yes = true,\n No = false,\n> = [A & B] extends [never] ? Yes : No\n"]}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)
3
+ *
4
+ * @module
5
+ */
6
+ export * from './compare/index.js';
7
+ export * from './logic/index.js';
8
+ export * from './misc.js';
9
+ export * from './object/index.js';
10
+ export * from './tuple/index.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)
4
+ *
5
+ * @module
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ // Index start >>>>>>>>>>>>>>>>
23
+ __exportStar(require("./compare/index.js"), exports);
24
+ __exportStar(require("./logic/index.js"), exports);
25
+ __exportStar(require("./misc.js"), exports);
26
+ __exportStar(require("./object/index.js"), exports);
27
+ __exportStar(require("./tuple/index.js"), exports);
28
+ // <<<<<<<<<<<<<<<< Index end
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;AAEH,+BAA+B;AAC/B,qDAAkC;AAClC,mDAAgC;AAChC,4CAAyB;AACzB,oDAAiC;AACjC,mDAAgC;AAChC,+BAA+B","sourcesContent":["/**\n * [Full API documentation is available on JSR](https://jsr.io/@leawind/lay-sing/doc)\n *\n * @module\n */\n\n// Index start >>>>>>>>>>>>>>>>\nexport * from './compare/index.js'\nexport * from './logic/index.js'\nexport * from './misc.js'\nexport * from './object/index.js'\nexport * from './tuple/index.js'\n// <<<<<<<<<<<<<<<< Index end\n"]}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * **⚠️Important:** parameter `T` and `U` are not distributive. When they are union type, it treats them as a single entity.
3
+ *
4
+ * @template T - The type to test (not distributed over unions)
5
+ * @template U - The constraint type to test against
6
+ *
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * import { expect } from '@leawind/lay-sing'
11
+ *
12
+ * expect<AssertExtends<string, number>>().to.be.never
13
+ * expect<AssertExtends<1 | 2, 1>>().to.be.never
14
+ * expect<AssertExtends<1, 1 | 2>>().to.be<1>().pass
15
+ * ```
16
+ */
17
+ export type AssertExtends<T, U> = [T] extends [U] ? T : never;
18
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/utils/logic/assert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.js","sourceRoot":"","sources":["../../../src/utils/logic/assert.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * **⚠️Important:** parameter `T` and `U` are not distributive. When they are union type, it treats them as a single entity.\n *\n * @template T - The type to test (not distributed over unions)\n * @template U - The constraint type to test against\n *\n * @example\n *\n * ```ts\n * import { expect } from '@leawind/lay-sing'\n *\n * expect<AssertExtends<string, number>>().to.be.never\n * expect<AssertExtends<1 | 2, 1>>().to.be.never\n * expect<AssertExtends<1, 1 | 2>>().to.be<1>().pass\n * ```\n */\nexport type AssertExtends<T, U> = [T] extends [U] ? T : never\n"]}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Conditional type - returns `Yes` if condition `Condition` is true, otherwise returns `No`
3
+ *
4
+ * @template Condition - The boolean condition to check
5
+ * @template Yes - The type to return if condition is true
6
+ * @template No - The type to return if condition is false (defaults to `never`)
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * type Result = If<true, 'yes', 'no'> // 'yes'
11
+ * type Result2 = If<false, 'yes', 'no'> // 'no'
12
+ * type BoolResult = If<boolean, 'yes', 'no'> // boolean
13
+ * ```
14
+ */
15
+ export type If<Condition extends boolean, Yes, No = never> = Condition extends true ? Yes : No;
16
+ /**
17
+ * Conditional type - returns `Yes` if condition `Condition` is false, otherwise returns `No`
18
+ *
19
+ * @template Condition - The boolean condition to check
20
+ * @template Yes - The type to return if condition is false
21
+ * @template No - The type to return if condition is true (defaults to `never`)
22
+ *
23
+ * ### Result
24
+ *
25
+ * - `never`: if `Condition` is `never`
26
+ * - `Yes`: if `Condition` is `false`
27
+ * - `No`: if `Condition` is `true`
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * type Result = IfFalse<false, 'yes', 'no'> // 'yes'
32
+ * type Result2 = IfFalse<true, 'yes', 'no'> // 'no'
33
+ * type BoolResult = IfFalse<boolean, 'yes', 'no'> // boolean
34
+ * ```
35
+ */
36
+ export type IfFalse<Condition extends boolean, Yes, No = never> = Condition extends false ? Yes : No;
37
+ //# sourceMappingURL=if.d.ts.map