type-plus 7.3.1 → 7.5.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 (376) hide show
  1. package/README.md +146 -183
  2. package/cjs/any/any_type.d.ts +8 -8
  3. package/cjs/any/any_type.d.ts.map +1 -1
  4. package/cjs/array/array.at.d.ts +3 -1
  5. package/cjs/array/array.at.d.ts.map +1 -1
  6. package/cjs/array/array.entries.d.ts +4 -3
  7. package/cjs/array/array.entries.d.ts.map +1 -1
  8. package/cjs/array/array.find_last.d.ts +3 -1
  9. package/cjs/array/array.find_last.d.ts.map +1 -1
  10. package/cjs/array/array.some.d.ts +1 -1
  11. package/cjs/array/array.some.d.ts.map +1 -1
  12. package/cjs/array/array_plus.common_prop_keys.d.ts +27 -0
  13. package/cjs/array/array_plus.common_prop_keys.d.ts.map +1 -0
  14. package/cjs/array/array_plus.common_prop_keys.js +3 -0
  15. package/cjs/array/array_plus.common_prop_keys.js.map +1 -0
  16. package/cjs/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
  17. package/cjs/array/array_plus.concat.d.ts.map +1 -0
  18. package/cjs/array/array_plus.concat.js +3 -0
  19. package/cjs/array/array_plus.concat.js.map +1 -0
  20. package/cjs/array/array_plus.d.ts +7 -3
  21. package/cjs/array/array_plus.d.ts.map +1 -1
  22. package/cjs/array/array_plus.drop_match.d.ts +4 -0
  23. package/cjs/array/array_plus.drop_match.d.ts.map +1 -0
  24. package/cjs/array/array_plus.drop_match.js +3 -0
  25. package/cjs/array/array_plus.drop_match.js.map +1 -0
  26. package/cjs/array/array_plus.element_match.d.ts +44 -0
  27. package/cjs/array/array_plus.element_match.d.ts.map +1 -0
  28. package/cjs/array/array_plus.element_match.js +3 -0
  29. package/cjs/array/array_plus.element_match.js.map +1 -0
  30. package/cjs/array/array_plus.filter.d.ts +2 -0
  31. package/cjs/array/array_plus.filter.d.ts.map +1 -0
  32. package/cjs/array/array_plus.filter.js +3 -0
  33. package/cjs/array/array_plus.filter.js.map +1 -0
  34. package/cjs/array/array_plus.find.d.ts +57 -0
  35. package/cjs/array/array_plus.find.d.ts.map +1 -0
  36. package/cjs/array/array_plus.find.js +3 -0
  37. package/cjs/array/array_plus.find.js.map +1 -0
  38. package/cjs/array/array_plus.pad_start.d.ts +5 -0
  39. package/cjs/array/array_plus.pad_start.d.ts.map +1 -0
  40. package/cjs/array/array_plus.pad_start.js +3 -0
  41. package/cjs/array/array_plus.pad_start.js.map +1 -0
  42. package/cjs/array/array_type.d.ts +30 -12
  43. package/cjs/array/array_type.d.ts.map +1 -1
  44. package/cjs/array/filter.d.ts +24 -4
  45. package/cjs/array/filter.d.ts.map +1 -1
  46. package/cjs/array/find_first.d.ts +62 -0
  47. package/cjs/array/find_first.d.ts.map +1 -0
  48. package/cjs/array/{array.find.js → find_first.js} +1 -1
  49. package/cjs/array/find_first.js.map +1 -0
  50. package/cjs/array/head.d.ts +30 -1
  51. package/cjs/array/head.d.ts.map +1 -1
  52. package/cjs/array/intersect_of_props.d.ts +5 -3
  53. package/cjs/array/intersect_of_props.d.ts.map +1 -1
  54. package/cjs/array/last.d.ts +27 -2
  55. package/cjs/array/last.d.ts.map +1 -1
  56. package/cjs/array/literal_array.d.ts +5 -0
  57. package/cjs/array/literal_array.d.ts.map +1 -1
  58. package/cjs/array/literal_array.js +5 -0
  59. package/cjs/array/literal_array.js.map +1 -1
  60. package/cjs/array/pad_start.d.ts +5 -5
  61. package/cjs/array/pad_start.d.ts.map +1 -1
  62. package/cjs/array/reduce_while.d.ts +6 -0
  63. package/cjs/array/reduce_while.d.ts.map +1 -1
  64. package/cjs/array/reduce_while.js +6 -0
  65. package/cjs/array/reduce_while.js.map +1 -1
  66. package/cjs/array/reverse.d.ts +5 -0
  67. package/cjs/array/reverse.d.ts.map +1 -1
  68. package/cjs/array/union_of_props.d.ts +1 -1
  69. package/cjs/array/union_of_props.d.ts.map +1 -1
  70. package/cjs/assertion/assert_type.d.ts +4 -1
  71. package/cjs/assertion/assert_type.d.ts.map +1 -1
  72. package/cjs/assertion/assert_type.js.map +1 -1
  73. package/cjs/functional/compose.d.ts +2 -1
  74. package/cjs/functional/compose.d.ts.map +1 -1
  75. package/cjs/functional/compose.js.map +1 -1
  76. package/cjs/functional/context.d.ts.map +1 -1
  77. package/cjs/index.d.ts +22 -3
  78. package/cjs/index.d.ts.map +1 -1
  79. package/cjs/index.js +9 -3
  80. package/cjs/index.js.map +1 -1
  81. package/cjs/math/numeric_struct.d.ts +1 -1
  82. package/cjs/math/numeric_struct.d.ts.map +1 -1
  83. package/cjs/mix_types/any_or_never_type.d.ts +1 -1
  84. package/cjs/never/never_type.d.ts +11 -0
  85. package/cjs/never/never_type.d.ts.map +1 -1
  86. package/cjs/nodejs/isNodeError.d.ts.map +1 -1
  87. package/cjs/nominal/brand.d.ts.map +1 -1
  88. package/cjs/nominal/flavor.d.ts.map +1 -1
  89. package/cjs/object/index.d.ts +0 -1
  90. package/cjs/object/index.d.ts.map +1 -1
  91. package/cjs/object/index.js.map +1 -1
  92. package/cjs/testing/test_type.d.ts +277 -233
  93. package/cjs/testing/test_type.d.ts.map +1 -1
  94. package/cjs/testing/test_type.js.map +1 -1
  95. package/cjs/tuple/common_prop_keys.d.ts +34 -0
  96. package/cjs/tuple/common_prop_keys.d.ts.map +1 -0
  97. package/cjs/tuple/common_prop_keys.js.map +1 -0
  98. package/cjs/tuple/create_tuple.d.ts.map +1 -1
  99. package/cjs/tuple/drop.d.ts +91 -0
  100. package/cjs/tuple/drop.d.ts.map +1 -0
  101. package/cjs/{array → tuple}/drop.js +3 -1
  102. package/cjs/tuple/drop.js.map +1 -0
  103. package/{esm/array → cjs/tuple}/tail.d.ts +1 -1
  104. package/cjs/{array → tuple}/tail.d.ts.map +1 -1
  105. package/cjs/{array → tuple}/tail.js.map +1 -1
  106. package/cjs/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
  107. package/cjs/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
  108. package/cjs/tuple/tuple_plus.common_prop_keys.js +3 -0
  109. package/cjs/tuple/tuple_plus.common_prop_keys.js.map +1 -0
  110. package/cjs/tuple/tuple_plus.d.ts +5 -1
  111. package/cjs/tuple/tuple_plus.d.ts.map +1 -1
  112. package/cjs/tuple/tuple_plus.drop_match.d.ts +6 -0
  113. package/cjs/tuple/tuple_plus.drop_match.d.ts.map +1 -0
  114. package/cjs/tuple/tuple_plus.drop_match.js +3 -0
  115. package/cjs/tuple/tuple_plus.drop_match.js.map +1 -0
  116. package/cjs/tuple/tuple_plus.filter.d.ts +13 -0
  117. package/cjs/tuple/tuple_plus.filter.d.ts.map +1 -0
  118. package/cjs/tuple/tuple_plus.filter.js +3 -0
  119. package/cjs/tuple/tuple_plus.filter.js.map +1 -0
  120. package/cjs/tuple/tuple_plus.find.d.ts +64 -0
  121. package/cjs/tuple/tuple_plus.find.d.ts.map +1 -0
  122. package/cjs/tuple/tuple_plus.find.js +3 -0
  123. package/cjs/tuple/tuple_plus.find.js.map +1 -0
  124. package/cjs/tuple/tuple_plus.js +0 -15
  125. package/cjs/tuple/tuple_plus.js.map +1 -1
  126. package/cjs/tuple/tuple_plus.pad_start.d.ts +11 -5
  127. package/cjs/tuple/tuple_plus.pad_start.d.ts.map +1 -1
  128. package/cjs/tuple/tuple_type.d.ts +41 -23
  129. package/cjs/tuple/tuple_type.d.ts.map +1 -1
  130. package/cjs/union/union.d.ts +33 -0
  131. package/cjs/union/union.d.ts.map +1 -0
  132. package/cjs/{array/array.concat.js → union/union.js} +1 -1
  133. package/cjs/union/union.js.map +1 -0
  134. package/cjs/unknown/unknown_type.d.ts +12 -0
  135. package/cjs/unknown/unknown_type.d.ts.map +1 -1
  136. package/cjs/utils/options.d.ts +10 -0
  137. package/cjs/utils/options.d.ts.map +1 -0
  138. package/cjs/utils/options.js +3 -0
  139. package/cjs/utils/options.js.map +1 -0
  140. package/esm/any/any_type.d.ts +8 -8
  141. package/esm/any/any_type.d.ts.map +1 -1
  142. package/esm/array/array.at.d.ts +3 -1
  143. package/esm/array/array.at.d.ts.map +1 -1
  144. package/esm/array/array.entries.d.ts +4 -3
  145. package/esm/array/array.entries.d.ts.map +1 -1
  146. package/esm/array/array.find_last.d.ts +3 -1
  147. package/esm/array/array.find_last.d.ts.map +1 -1
  148. package/esm/array/array.some.d.ts +1 -1
  149. package/esm/array/array.some.d.ts.map +1 -1
  150. package/esm/array/array_plus.common_prop_keys.d.ts +27 -0
  151. package/esm/array/array_plus.common_prop_keys.d.ts.map +1 -0
  152. package/esm/array/array_plus.common_prop_keys.js +2 -0
  153. package/esm/array/array_plus.common_prop_keys.js.map +1 -0
  154. package/esm/array/{array.concat.d.ts → array_plus.concat.d.ts} +4 -1
  155. package/esm/array/array_plus.concat.d.ts.map +1 -0
  156. package/esm/array/array_plus.concat.js +2 -0
  157. package/esm/array/array_plus.concat.js.map +1 -0
  158. package/esm/array/array_plus.d.ts +7 -3
  159. package/esm/array/array_plus.d.ts.map +1 -1
  160. package/esm/array/array_plus.drop_match.d.ts +4 -0
  161. package/esm/array/array_plus.drop_match.d.ts.map +1 -0
  162. package/esm/array/array_plus.drop_match.js +2 -0
  163. package/esm/array/array_plus.drop_match.js.map +1 -0
  164. package/esm/array/array_plus.element_match.d.ts +44 -0
  165. package/esm/array/array_plus.element_match.d.ts.map +1 -0
  166. package/esm/array/array_plus.element_match.js +2 -0
  167. package/esm/array/array_plus.element_match.js.map +1 -0
  168. package/esm/array/array_plus.filter.d.ts +2 -0
  169. package/esm/array/array_plus.filter.d.ts.map +1 -0
  170. package/esm/array/array_plus.filter.js +2 -0
  171. package/esm/array/array_plus.filter.js.map +1 -0
  172. package/esm/array/array_plus.find.d.ts +57 -0
  173. package/esm/array/array_plus.find.d.ts.map +1 -0
  174. package/esm/array/array_plus.find.js +2 -0
  175. package/esm/array/array_plus.find.js.map +1 -0
  176. package/esm/array/array_plus.pad_start.d.ts +5 -0
  177. package/esm/array/array_plus.pad_start.d.ts.map +1 -0
  178. package/esm/array/array_plus.pad_start.js +2 -0
  179. package/esm/array/array_plus.pad_start.js.map +1 -0
  180. package/esm/array/array_type.d.ts +30 -12
  181. package/esm/array/array_type.d.ts.map +1 -1
  182. package/esm/array/filter.d.ts +24 -4
  183. package/esm/array/filter.d.ts.map +1 -1
  184. package/esm/array/find_first.d.ts +62 -0
  185. package/esm/array/find_first.d.ts.map +1 -0
  186. package/esm/array/find_first.js +2 -0
  187. package/esm/array/find_first.js.map +1 -0
  188. package/esm/array/head.d.ts +30 -1
  189. package/esm/array/head.d.ts.map +1 -1
  190. package/esm/array/intersect_of_props.d.ts +5 -3
  191. package/esm/array/intersect_of_props.d.ts.map +1 -1
  192. package/esm/array/last.d.ts +27 -2
  193. package/esm/array/last.d.ts.map +1 -1
  194. package/esm/array/literal_array.d.ts +5 -0
  195. package/esm/array/literal_array.d.ts.map +1 -1
  196. package/esm/array/literal_array.js +5 -0
  197. package/esm/array/literal_array.js.map +1 -1
  198. package/esm/array/pad_start.d.ts +5 -5
  199. package/esm/array/pad_start.d.ts.map +1 -1
  200. package/esm/array/reduce_while.d.ts +6 -0
  201. package/esm/array/reduce_while.d.ts.map +1 -1
  202. package/esm/array/reduce_while.js +6 -0
  203. package/esm/array/reduce_while.js.map +1 -1
  204. package/esm/array/reverse.d.ts +5 -0
  205. package/esm/array/reverse.d.ts.map +1 -1
  206. package/esm/array/union_of_props.d.ts +1 -1
  207. package/esm/array/union_of_props.d.ts.map +1 -1
  208. package/esm/assertion/assert_type.d.ts +4 -1
  209. package/esm/assertion/assert_type.d.ts.map +1 -1
  210. package/esm/assertion/assert_type.js.map +1 -1
  211. package/esm/functional/compose.d.ts +2 -1
  212. package/esm/functional/compose.d.ts.map +1 -1
  213. package/esm/functional/compose.js.map +1 -1
  214. package/esm/functional/context.d.ts.map +1 -1
  215. package/esm/index.d.ts +22 -3
  216. package/esm/index.d.ts.map +1 -1
  217. package/esm/index.js +4 -2
  218. package/esm/index.js.map +1 -1
  219. package/esm/math/numeric_struct.d.ts +1 -1
  220. package/esm/math/numeric_struct.d.ts.map +1 -1
  221. package/esm/mix_types/any_or_never_type.d.ts +1 -1
  222. package/esm/never/never_type.d.ts +11 -0
  223. package/esm/never/never_type.d.ts.map +1 -1
  224. package/esm/nodejs/isNodeError.d.ts.map +1 -1
  225. package/esm/nominal/brand.d.ts.map +1 -1
  226. package/esm/nominal/flavor.d.ts.map +1 -1
  227. package/esm/object/index.d.ts +0 -1
  228. package/esm/object/index.d.ts.map +1 -1
  229. package/esm/object/index.js.map +1 -1
  230. package/esm/testing/test_type.d.ts +277 -233
  231. package/esm/testing/test_type.d.ts.map +1 -1
  232. package/esm/testing/test_type.js.map +1 -1
  233. package/esm/tuple/common_prop_keys.d.ts +34 -0
  234. package/esm/tuple/common_prop_keys.d.ts.map +1 -0
  235. package/esm/tuple/common_prop_keys.js.map +1 -0
  236. package/esm/tuple/create_tuple.d.ts.map +1 -1
  237. package/esm/tuple/drop.d.ts +91 -0
  238. package/esm/tuple/drop.d.ts.map +1 -0
  239. package/esm/tuple/drop.js +9 -0
  240. package/esm/tuple/drop.js.map +1 -0
  241. package/{cjs/array → esm/tuple}/tail.d.ts +1 -1
  242. package/esm/{array → tuple}/tail.d.ts.map +1 -1
  243. package/esm/{array → tuple}/tail.js.map +1 -1
  244. package/esm/tuple/tuple_plus.common_prop_keys.d.ts +28 -0
  245. package/esm/tuple/tuple_plus.common_prop_keys.d.ts.map +1 -0
  246. package/esm/tuple/tuple_plus.common_prop_keys.js +2 -0
  247. package/esm/tuple/tuple_plus.common_prop_keys.js.map +1 -0
  248. package/esm/tuple/tuple_plus.d.ts +5 -1
  249. package/esm/tuple/tuple_plus.d.ts.map +1 -1
  250. package/esm/tuple/tuple_plus.drop_match.d.ts +6 -0
  251. package/esm/tuple/tuple_plus.drop_match.d.ts.map +1 -0
  252. package/esm/tuple/tuple_plus.drop_match.js +2 -0
  253. package/esm/tuple/tuple_plus.drop_match.js.map +1 -0
  254. package/esm/tuple/tuple_plus.filter.d.ts +13 -0
  255. package/esm/tuple/tuple_plus.filter.d.ts.map +1 -0
  256. package/esm/tuple/tuple_plus.filter.js +2 -0
  257. package/esm/tuple/tuple_plus.filter.js.map +1 -0
  258. package/esm/tuple/tuple_plus.find.d.ts +64 -0
  259. package/esm/tuple/tuple_plus.find.d.ts.map +1 -0
  260. package/esm/tuple/tuple_plus.find.js +2 -0
  261. package/esm/tuple/tuple_plus.find.js.map +1 -0
  262. package/esm/tuple/tuple_plus.js +1 -1
  263. package/esm/tuple/tuple_plus.js.map +1 -1
  264. package/esm/tuple/tuple_plus.pad_start.d.ts +11 -5
  265. package/esm/tuple/tuple_plus.pad_start.d.ts.map +1 -1
  266. package/esm/tuple/tuple_type.d.ts +41 -23
  267. package/esm/tuple/tuple_type.d.ts.map +1 -1
  268. package/esm/union/union.d.ts +33 -0
  269. package/esm/union/union.d.ts.map +1 -0
  270. package/esm/union/union.js +2 -0
  271. package/esm/union/union.js.map +1 -0
  272. package/esm/unknown/unknown_type.d.ts +12 -0
  273. package/esm/unknown/unknown_type.d.ts.map +1 -1
  274. package/esm/utils/options.d.ts +10 -0
  275. package/esm/utils/options.d.ts.map +1 -0
  276. package/esm/utils/options.js +2 -0
  277. package/esm/utils/options.js.map +1 -0
  278. package/package.json +12 -9
  279. package/ts/any/any_type.ts +8 -9
  280. package/ts/any/readme.md +71 -4
  281. package/ts/array/array.at.ts +3 -1
  282. package/ts/array/array.entries.ts +4 -2
  283. package/ts/array/array.find_last.ts +3 -1
  284. package/ts/array/array.some.ts +1 -1
  285. package/ts/array/array_plus.common_prop_keys.ts +35 -0
  286. package/ts/array/{array.concat.ts → array_plus.concat.ts} +3 -0
  287. package/ts/array/array_plus.drop_match.ts +16 -0
  288. package/ts/array/array_plus.element_match.ts +61 -0
  289. package/ts/array/array_plus.filter.ts +5 -0
  290. package/ts/array/array_plus.find.ts +71 -0
  291. package/ts/array/array_plus.pad_start.ts +13 -0
  292. package/ts/array/array_plus.ts +7 -3
  293. package/ts/array/array_type.ts +30 -12
  294. package/ts/array/filter.ts +27 -22
  295. package/ts/array/find_first.ts +71 -0
  296. package/ts/array/head.ts +40 -1
  297. package/ts/array/intersect_of_props.ts +7 -3
  298. package/ts/array/last.ts +36 -2
  299. package/ts/array/literal_array.ts +5 -0
  300. package/ts/array/pad_start.ts +6 -10
  301. package/ts/array/readme.md +297 -32
  302. package/ts/array/reduce_while.ts +6 -0
  303. package/ts/array/reverse.ts +5 -0
  304. package/ts/array/union_of_props.ts +1 -1
  305. package/ts/assertion/assert_type.ts +4 -1
  306. package/ts/assertion/readme.md +4 -3
  307. package/ts/functional/compose.ts +2 -1
  308. package/ts/functional/context.ts +1 -1
  309. package/ts/index.ts +22 -3
  310. package/ts/math/numeric_struct.ts +9 -9
  311. package/ts/mix_types/any_or_never_type.ts +1 -1
  312. package/ts/mix_types/readme.md +7 -1
  313. package/ts/never/never_type.ts +13 -0
  314. package/ts/nodejs/isNodeError.ts +13 -13
  315. package/ts/nominal/brand.ts +1 -1
  316. package/ts/nominal/flavor.ts +1 -1
  317. package/ts/object/index.ts +0 -1
  318. package/ts/testing/readme.md +30 -0
  319. package/ts/testing/test_type.ts +279 -234
  320. package/ts/tuple/common_prop_keys.ts +41 -0
  321. package/ts/tuple/create_tuple.ts +9 -9
  322. package/ts/tuple/drop.ts +125 -0
  323. package/ts/tuple/readme.md +263 -9
  324. package/ts/{array → tuple}/tail.ts +1 -1
  325. package/ts/tuple/tuple_plus.common_prop_keys.ts +47 -0
  326. package/ts/tuple/tuple_plus.drop_match.ts +20 -0
  327. package/ts/tuple/tuple_plus.filter.ts +29 -0
  328. package/ts/tuple/tuple_plus.find.ts +88 -0
  329. package/ts/tuple/tuple_plus.pad_start.ts +37 -21
  330. package/ts/tuple/tuple_plus.ts +5 -1
  331. package/ts/tuple/tuple_type.ts +67 -25
  332. package/ts/union/readme.md +81 -0
  333. package/ts/union/union.ts +37 -0
  334. package/ts/unknown/unknown_type.ts +13 -0
  335. package/ts/utils/options.ts +10 -0
  336. package/cjs/array/array.concat.d.ts.map +0 -1
  337. package/cjs/array/array.concat.js.map +0 -1
  338. package/cjs/array/array.find.d.ts +0 -21
  339. package/cjs/array/array.find.d.ts.map +0 -1
  340. package/cjs/array/array.find.js.map +0 -1
  341. package/cjs/array/common_prop_keys.d.ts +0 -11
  342. package/cjs/array/common_prop_keys.d.ts.map +0 -1
  343. package/cjs/array/common_prop_keys.js.map +0 -1
  344. package/cjs/array/drop.d.ts +0 -19
  345. package/cjs/array/drop.d.ts.map +0 -1
  346. package/cjs/array/drop.js.map +0 -1
  347. package/cjs/array/index.d.ts +0 -17
  348. package/cjs/array/index.d.ts.map +0 -1
  349. package/cjs/array/index.js +0 -33
  350. package/cjs/array/index.js.map +0 -1
  351. package/esm/array/array.concat.d.ts.map +0 -1
  352. package/esm/array/array.concat.js +0 -2
  353. package/esm/array/array.concat.js.map +0 -1
  354. package/esm/array/array.find.d.ts +0 -21
  355. package/esm/array/array.find.d.ts.map +0 -1
  356. package/esm/array/array.find.js +0 -2
  357. package/esm/array/array.find.js.map +0 -1
  358. package/esm/array/common_prop_keys.d.ts +0 -11
  359. package/esm/array/common_prop_keys.d.ts.map +0 -1
  360. package/esm/array/common_prop_keys.js.map +0 -1
  361. package/esm/array/drop.d.ts +0 -19
  362. package/esm/array/drop.d.ts.map +0 -1
  363. package/esm/array/drop.js +0 -7
  364. package/esm/array/drop.js.map +0 -1
  365. package/esm/array/index.d.ts +0 -17
  366. package/esm/array/index.d.ts.map +0 -1
  367. package/esm/array/index.js +0 -17
  368. package/esm/array/index.js.map +0 -1
  369. package/ts/array/array.find.ts +0 -32
  370. package/ts/array/common_prop_keys.ts +0 -18
  371. package/ts/array/drop.ts +0 -71
  372. package/ts/array/index.ts +0 -16
  373. /package/cjs/{array → tuple}/common_prop_keys.js +0 -0
  374. /package/cjs/{array → tuple}/tail.js +0 -0
  375. /package/esm/{array → tuple}/common_prop_keys.js +0 -0
  376. /package/esm/{array → tuple}/tail.js +0 -0
package/ts/array/head.ts CHANGED
@@ -1 +1,40 @@
1
- export type Head<T extends any[]> = T['length'] extends 0 ? never : T[0]
1
+ import type { NeverType } from '../never/never_type.js'
2
+
3
+ /**
4
+ * 🦴 *utilities*
5
+ * 🔢 *customizable*
6
+ *
7
+ * Gets the first entry in the tuple or the type of array `T`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * type R = Head<[1, 2, 3]> // 1
12
+ * type R = Head<string[]> // string
13
+ *
14
+ * type R = Head<[]> // never
15
+ * ```
16
+ *
17
+ * @typeParam Options['caseNever'] Return type when `T` is `never`.
18
+ * Default to `never`.
19
+ *
20
+ * @typeParam Options['caseEmptyTuple'] Return type when `T` is `[]`.
21
+ * Default to `never`.
22
+ */
23
+ export type Head<
24
+ T extends unknown[],
25
+ Options extends Head.Options = Head.DefaultOptions
26
+ > = NeverType<
27
+ T,
28
+ Options['caseNever'],
29
+ T['length'] extends 0 ? Options['caseEmptyTuple'] : T[0]
30
+ >
31
+
32
+ export namespace Head {
33
+ export interface Options extends NeverType.Options {
34
+ caseEmptyTuple?: unknown
35
+ }
36
+
37
+ export interface DefaultOptions extends NeverType.DefaultOptions {
38
+ caseEmptyTuple: never
39
+ }
40
+ }
@@ -1,10 +1,14 @@
1
1
  import type { KeyTypes } from '../object/index.js'
2
- import type { Tail } from './tail.js'
2
+ import type { Tail } from '../tuple/tail.js'
3
3
 
4
4
  /**
5
- * Gets the intersect of properties of the elements in `A`
5
+ * 🦴 *utilities*
6
+ *
7
+ * Gets the intersect of properties of the elements in `A`.
6
8
  */
7
- export type IntersectOfProps<A extends Record<any, unknown>[], P extends KeyTypes> = A['length'] extends 0
9
+ export type IntersectOfProps<A extends Record<any, unknown>[], P extends KeyTypes> = number extends A['length']
10
+ ? A[0][P]
11
+ : A['length'] extends 0
8
12
  ? never
9
13
  : A['length'] extends 1
10
14
  ? A[0][P]
package/ts/array/last.ts CHANGED
@@ -1,4 +1,38 @@
1
+ import type { NeverType } from '../never/never_type.js'
2
+
1
3
  /**
2
- * Get the last type of an array or tuple.
4
+ * 🦴 *utilities*
5
+ *
6
+ * Gets the last entry in the tuple or the type of array `T`.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * type R = Last<[1, 2, 3]> // 3
11
+ * type R = Last<string[]> // string
12
+ *
13
+ * type R = Last<[]> // never
14
+ * ```
15
+ *
16
+ * @typeParam Options['caseNever'] Return type when `T` is `never`.
17
+ * Default to `never`.
18
+ *
19
+ * @typeParam Options['caseEmptyTuple'] Return type when `T` is `[]`.
20
+ * Default to `never`.
3
21
  */
4
- export type Last<T extends any[]> = T extends [...any[], infer R] ? R : T[0]
22
+ export type Last<
23
+ T extends unknown[],
24
+ Options extends Last.Options = Last.DefaultOptions
25
+ > = NeverType<T,
26
+ Options['caseNever'],
27
+ T['length'] extends 0 ? Options['caseEmptyTuple'] : T extends [...unknown[], infer R] ? R : T[0]
28
+ >
29
+
30
+ export namespace Last {
31
+ export interface Options extends NeverType.Options {
32
+ caseEmptyTuple?: unknown
33
+ }
34
+
35
+ export interface DefaultOptions extends NeverType.DefaultOptions {
36
+ caseEmptyTuple: never
37
+ }
38
+ }
@@ -1,5 +1,10 @@
1
1
  import type { KeyTypes } from '../object/index.js'
2
2
 
3
+ /**
4
+ * 🦴 *utilities*
5
+ *
6
+ * return an array whose items are restricted to the provided literals.
7
+ */
3
8
  export function literalArray<T extends KeyTypes>(...entries: T[]): T[] {
4
9
  return entries
5
10
  }
@@ -1,11 +1,11 @@
1
- import type { CanAssign } from '../index.js'
2
- import type { CreateTuple } from '../tuple/create_tuple.js'
3
- import type { PadStart as TuplePadStart } from '../tuple/tuple_plus.pad_start.js'
4
- import type { UnionOfValues } from './union_of_values.js'
1
+ import type { PadStart as PadStartTuple } from '../tuple/tuple_plus.pad_start.js'
2
+ import type { PadStart as PadStartArray } from './array_plus.pad_start.js'
5
3
 
6
4
  /**
7
5
  * Pads the start of an array or tuple with `PadWith`.
8
6
  *
7
+ * ⚗️ *transform*
8
+ *
9
9
  * @example
10
10
  * ```ts
11
11
  * // Padding array
@@ -30,12 +30,8 @@ export type PadStart<
30
30
  MaxLength extends number,
31
31
  PadWith = unknown
32
32
  > = number extends A['length']
33
- ? MaxLength extends 0
34
- ? A
35
- : CanAssign<PadWith, UnionOfValues<A>> extends true
36
- ? A
37
- : PadStart<[...CreateTuple<MaxLength, PadWith>, ...A], MaxLength, PadWith>
38
- : TuplePadStart<A, MaxLength, PadWith>
33
+ ? PadStartArray<A, MaxLength, PadWith>
34
+ : PadStartTuple<A, MaxLength, PadWith>
39
35
 
40
36
  /**
41
37
  * @deprecated use PadStart instead
@@ -1,13 +1,26 @@
1
1
  # Array
2
2
 
3
- `Array<T>` or `T[]` is a type that represents an array of `T`.
3
+ In TypeScript, the type of an JavaScript array can be an [array](#array) or a [tuple](../tuple/readme.md).
4
+
5
+ `Array<T>` or `T[]` is a type that represents an array of `T`
6
+
7
+ There is no length limitation to an `Array`,
8
+ and each element has the same type `T`.
4
9
 
5
10
  ## Type Checking
6
11
 
7
12
  The `ArrayType<T>` and friends are used to check if a type is exactly `Array<T>` or not.
8
13
 
9
14
  They are strict type checks, meaning they match only the type `Array<T>`,
10
- and not [tuple], union, or intersection types.
15
+ and not [tuple], [union], or intersection types.
16
+
17
+ ### [ArrayType](./array_type.ts#18)
18
+
19
+ `ArrayType<T, Then = T, Else = never>`
20
+
21
+ 🌪️ *filter*
22
+
23
+ Filter `T` to ensure it is an array, excluding tuple.
11
24
 
12
25
  ```ts
13
26
  import type { ArrayType } from 'type-plus'
@@ -19,25 +32,64 @@ type R = ArrayType<number[] | 1> // never
19
32
  type R = ArrayType<number[] & { a: 1 }> // never
20
33
  ```
21
34
 
22
- - [`ArrayType<T, Then = T, Else = never>`](array_type.ts#L15): check if `T` is an array and not a tuple.
23
- - [`IsArray<T, Then = true, Else = false`](array_type.ts#L33): is `T` an array and not a tuple.
24
- - [`NotArrayType<T, Then = T, Else = never>`](array_type.ts#L47): check if `T` is not an array (can be a tuple).
25
- - [`IsNotArray<T, Then = true, Else = false>`](array_type.ts#L61): is `T` not an array (can be a tuple).
35
+ ### [IsArray](./array_type.ts#37)
26
36
 
27
- ## ArrayPlus
37
+ `IsArray<T, Then = true, Else = false>`
28
38
 
29
- `ArrayPlus` contains all types and type utilities related to array.
30
- Whenever possible, these types and type utilities also work with *tuples*,
31
- as *tuples* is a subset of array.
39
+ 🎭 *validate*
32
40
 
33
- For *tuple* specific types and type utilities,
34
- please check [`TuplePlus`](../tuple/readme.md#TuplePlus).
41
+ Validate that `T` is an array, excluding tuple.
35
42
 
36
- ### [`ArrayPlus.At`](./array.at.ts#L18)
43
+ ```ts
44
+ import type { IsArray } from 'type-plus'
45
+
46
+ type R = IsArray<number[]> // true
47
+
48
+ type R = IsArray<number> // false
49
+ type R = IsArray<[1]> // false
50
+ ```
51
+
52
+ ### [NotArrayType](./array_type.ts#54)
53
+
54
+ `NotArrayType<T, Then = T, Else = never>`
55
+
56
+ 🌪️ *filter*
57
+
58
+ Filter `T` to ensure it is not an array, excluding tuple.
59
+
60
+ ```ts
61
+ import type { NotArrayType } from 'type-plus'
62
+
63
+ type R = NotArrayType<number[]> // never
37
64
 
38
- > `ArrayPlus.At<A, N, Fail = never>`
65
+ type R = NotArrayType<number> // number
66
+ type R = NotArrayType<[1]> // [1]
67
+ ```
68
+
69
+ ### [IsNotArrayType](./array_type.ts#71)
70
+
71
+ `IsNotArrayType<T, Then = true, Else = false>`
72
+
73
+ 🎭 *validate*
39
74
 
40
- Gets the type of the array or tuple `A` at index `N`.
75
+ Validate that `T` is not an array, excluding tuple.
76
+
77
+ ```ts
78
+ import type { IsNotArrayType } from 'type-plus'
79
+
80
+ type R = IsNotArrayType<number[]> // false
81
+
82
+ type R = IsNotArrayType<number> // true
83
+ type R = IsNotArrayType<[1]> // true
84
+ ```
85
+
86
+ ## [At](./array.at.ts#l20)
87
+
88
+ `At<A, N, Fail = never>`
89
+
90
+ 🦴 *utilities*
91
+
92
+ Gets the type of the array or tuple at positive or negative index `N`.
41
93
 
42
94
  For array, it will return the union of the type of the array value and `undefined`,
43
95
  as there is no way to guarantee the array has value at `N`.
@@ -45,7 +97,7 @@ as there is no way to guarantee the array has value at `N`.
45
97
  ```ts
46
98
  type A = Array<string | number>
47
99
 
48
- ArrayPlus.At<A, 0> // string | number | undefined
100
+ type R = ArrayPlus.At<A, 0> // string | number | undefined
49
101
  ```
50
102
 
51
103
  For tuple, it will return the type of the tuple value at index `N`.
@@ -53,17 +105,20 @@ For tuple, it will return the type of the tuple value at index `N`.
53
105
  ```ts
54
106
  type T = [number, string, 1, 2, 3]
55
107
 
56
- ArrayPlus.At<T, 0> // number
57
- ArrayPlus.At<T, -1> // 3
108
+ type R = ArrayPlus.At<T, 0> // number
109
+ type R = ArrayPlus.At<T, -1> // 3
58
110
  ```
59
111
 
60
112
  If the `N` is out of bound,
61
113
  or `N` is not a valid index,
62
114
  `ArrayPlus.At` will return the `Fail` case, which defaults to `never`.
63
115
 
64
- ### [`ArrayPlus.Concat`](./array.concat.ts#L12)
116
+ ## [`Concat`](./array.concat.ts#L12)
117
+
118
+ `Concat<A, B>`
65
119
 
66
- > `ArrayPlus.Concat<A, B>`
120
+ 🦴 *utilities*
121
+ 💀 *deprecated* Will be available only as `ArrayPlus.Concat` in the next version
67
122
 
68
123
  Concats two arrays or tuples.
69
124
 
@@ -72,6 +127,202 @@ It is added for completeness.
72
127
 
73
128
  You are encouraged to use `[...A, ...B]` directly.
74
129
 
130
+ ## [`FindFirst`](./find_first.ts#l52)
131
+
132
+ `FindFirst<A, Criteria, Options = { widen, caseEmptyTuple, caseNever, caseNoMatch, caseWiden, caseUnionMiss }>`
133
+
134
+ 🦴 *utilities*
135
+ 🔢 *customizable*
136
+
137
+ Find the first type in the array or tuple `A` that matches `Criteria`.
138
+
139
+ ```ts
140
+ import type { FindFirst } from 'type-plus'
141
+
142
+ type R = FindFirst<[true, 1, 'x', 3], string> // 'x'
143
+ type R = FindFirst<[true, 1, 'x', 3], number> // 1
144
+ type R = FindFirst<[string, number, 1], 1> // widen: 1 | undefined
145
+ type R = FindFirst<[true, number | string], string> // unionNotMatch: string
146
+ type R = FindFirst<Array<string>, string> // string
147
+ type R = FindFirst<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
148
+ type R = FindFirst<Array<string | number>, number | string> // string | number
149
+ type R = FindFirst<Array<number>, 1> // widen: 1 | undefined
150
+ type R = FindFirst<Array<string | number>, number> // unionNotMatch: number
151
+
152
+ type R = FindFirst<[true, 1, 'x'], 2> // never
153
+ type R = FindFirst<string[], number> // never
154
+
155
+ // customization
156
+ type R = FindFirst<[number], 1, { widen: false }> // never
157
+ type R = FindFirst<[number], 1, { caseWiden: never }> // never
158
+ type R = FindFirst<[], 1, { caseEmptyTuple: 2 }> // 2
159
+ type R = FindFirst<never, 1, { caseNever: 2 }> // 2
160
+ type R = FindFirst<[string], number, { caseNotMatch: 2 }> // 2
161
+ type R = FindFirst<[string | number], number, { caseUnionNotMatch: undefined }> // number | undefined
162
+ ```
163
+
164
+ ## [`FindLast`](./array.find_last.ts)
165
+
166
+ ## [`Some`](./array.some.ts)
167
+
168
+ ## [`Filter`](./filter.ts#l17)
169
+
170
+ `Filter<A, Criteria>`
171
+
172
+ ⚗️ *transform*
173
+
174
+ Filter the array or tuple `A`, keeping entries satisfying `Criteria`.
175
+
176
+ ```ts
177
+ import type { Filter } from 'type-plus'
178
+
179
+ type R = Filter<[1, 2, '3'], number> // [1, 2]
180
+ type R = Filter<Array<string | undefined>, string> // string[]
181
+ ```
182
+
183
+ ## [`KeepMatch`](./filter.ts)
184
+
185
+ `KeepMatch<A, Criteria>`
186
+
187
+ ⚗️ *transform*
188
+ 👽 *alias* of [`Filter`](#filter)
189
+
190
+ Keeps entries satisfying `Criteria` in array or tuple `A`.
191
+
192
+ ```ts
193
+ import type { KeepMatch } from 'type-plus'
194
+
195
+ type R = KeepMatch<[1, 2, '3'], number> // [1, 2]
196
+ type R = KeepMatch<Array<string | undefined>, string> // string[]
197
+ ```
198
+
199
+ ## [`Head`](./head.ts#l23)
200
+
201
+ `Head<T, Options = { caseNever, caseEmptyTuple }>`
202
+
203
+ 🦴 *utilities*
204
+ 🔢 *customizable*
205
+
206
+ Gets the first entry in the tuple or the type of array `T`.
207
+
208
+ ```ts
209
+ import type { Head } from 'type-plus'
210
+
211
+ type R = Head<[1, 2, 3]> // 1
212
+ type R = Head<string[]> // string
213
+ type R = Head<never> // caseNever: never
214
+ type R = Head<[]> // caseEmptyTuple: never
215
+
216
+ // customization
217
+ type R = Head<never, { caseNever: 1 }> // 1
218
+ type R = Head<[], { caseEmptyTuple: undefined }> // undefined
219
+ ```
220
+
221
+ ## [`IntersectOfProps`](./intersect_of_props.ts)
222
+
223
+ ## [`MapToProp`](./intersect_of_props.ts)
224
+
225
+ ## [`Last`](./last.ts#l23)
226
+
227
+ `Last<T, Options = { caseNever, caseEmptyTuple }>`
228
+
229
+ 🦴 *utilities*
230
+ 🔢 *customizable*
231
+
232
+ Gets the last entry in the tuple or the type of array `T`.
233
+
234
+ ```ts
235
+ import type { Last } from 'type-plus'
236
+
237
+ type R = Last<[1, 2, 3]> // 3
238
+ type R = Last<string[]> // string
239
+ type R = Last<never> // caseNever: never
240
+ type R = Last<[]> // caseEmptyTuple: never
241
+
242
+ // customization
243
+ type R = Last<never, { caseNever: 1 }> // 1
244
+ type R = Last<[], { caseEmptyTuple: undefined }> // undefined
245
+ ```
246
+
247
+ ## [`literalArray`](./literal_array.ts)
248
+
249
+ ## [`PadStart`](./pad_start.ts)
250
+
251
+ ## [`reduceWhile`](./reduce_while.ts)
252
+
253
+ ## [`Reverse`](./reverse.ts)
254
+
255
+ ## [`PropUnion`](./union_of_props.ts)
256
+
257
+ ## [`UnionOfProps`](./union_of_props.ts)
258
+
259
+ ## [`UnionOfValues`](./union_of_values.ts)
260
+
261
+ ## ArrayPlus
262
+
263
+ `ArrayPlus` contains all types and type utilities related to array.
264
+ Whenever possible, these types and type utilities also work with *tuples*,
265
+ as *tuples* is a subset of array.
266
+
267
+ For *tuple* specific types and type utilities,
268
+ please check [`TuplePlus`](../tuple/readme.md#TuplePlus).
269
+
270
+ ### [`ArrayPlus.At`](./array.at.ts#L18)
271
+
272
+ `ArrayPlus.At<A, N, Fail = never>`
273
+
274
+ Alias of [At](#at).
275
+
276
+ ## [ArrayPlus.CommonPropKeys](./array_plus.common_prop_keys.ts#l21)
277
+
278
+ `ArrayPlus.CommonPropKeys<T extends Record[], Options = { caseNever }>`
279
+
280
+ ⚗️ *transform*
281
+ 🔢 *customizable*
282
+
283
+ Gets the common property keys of the elements in array `A`.
284
+
285
+ ```ts
286
+ import { type ArrayPlus } from 'type-plus'
287
+
288
+ type R = ArrayPlus.CommonPropKeys<Array<{ a: 1 }>> // 'a'
289
+ type R = ArrayPlus.CommonPropKeys<Array<{ a: 1, b: 1 } | { a: 1, c: 1 }>> // 'a'
290
+
291
+ // customization
292
+ type R = ArrayPlus.CommonPropKeys<never, { caseNever: 1 }> // 1
293
+ ```
294
+
295
+ ### [`ArrayPlus.Concat`](./array.concat.ts#l12)
296
+
297
+ `ArrayPlus.Concat<A, B>`
298
+
299
+ Alias of [Concat](#concat).
300
+
301
+ ### [`ArrayPlus.ElementMatch`](./array_plus.element_match.ts#l30)
302
+
303
+ `ArrayPlus.ElementMatch<T, Criteria, Options = { widen, caseNotMatch, caseWiden, caseUnionNotMatch }>`
304
+
305
+ 🌪️ *filter*
306
+ 🔢 *customizable*
307
+
308
+ Filter the element `T` in an array or tuple to match `Criteria`.
309
+
310
+ ```ts
311
+ import type { ArrayPlus } from 'type-plus'
312
+
313
+ type R = ArrayPlus.ElementMatch<number, number> // number
314
+ type R = ArrayPlus.ElementMatch<1, number> // 1
315
+ type R = ArrayPlus.ElementMatch<number, string> // notMatch: never
316
+ type R = ArrayPlus.ElementMatch<number, 1> // widen: 1
317
+ type R = ArrayPlus.ElementMatch<number | string, number> // unionNotMatch: number
318
+
319
+ // customization
320
+ type R = ArrayPlus.ElementMatch<number, string, { caseNotMatch: 1 }> // 1
321
+ type R = ArrayPlus.ElementMatch<number, 1, { widen: false }> // never
322
+ type R = ArrayPlus.ElementMatch<number, 1, { caseWiden: never }> // never
323
+ type R = ArrayPlus.ElementMatch<number | string, number, { caseUnionNotMatch: undefined }> // number | undefined
324
+ ```
325
+
75
326
  ### [`ArrayPlus.Entries`](./array.entries.ts#L14)
76
327
 
77
328
  > `ArrayPlus.Entries<A>`
@@ -82,24 +333,37 @@ Note that this is not the same as `Array.entries(A)`,
82
333
  which returns an iterable interator.
83
334
 
84
335
  ```ts
85
- ArrayPlus.Entries<Array<string | number>> // Array<[number, string | number]>
86
- ArrayPlus.Entries<[1, 2, 3]> // [[0, 1], [1, 2], [2, 3]]
336
+ type R = ArrayPlus.Entries<Array<string | number>> // Array<[number, string | number]>
337
+ type R = ArrayPlus.Entries<[1, 2, 3]> // [[0, 1], [1, 2], [2, 3]]
87
338
  ```
88
339
 
89
- ### [`ArrayPlus.Find`](./array.find.ts#L17)
340
+ ### [`ArrayPlus.Find`](./array_plus.find.ts#l49)
90
341
 
91
- > `ArrayPlus.Find<A, Criteria>
342
+ `ArrayPlus.Find<A, Criteria, Options { widen, caseNever, caseNotMatch, caseTuple, caseWiden, caseUnionNotMatch }>`
92
343
 
93
- Returns the first type in the array or tuple that matches the `Criteria`.
344
+ 🦴 *utilities*
345
+ 🔢 *customizable*
94
346
 
95
- If the `Criteria` is not met, it will return `never'.
96
-
97
- For `Array<T>`, it will return `T | undefined` if `T` satisfies `Criteria`.
347
+ Finds the type in array `A` that matches `Criteria`.
98
348
 
99
349
  ```ts
100
- ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
101
-
102
- ArrayPlus.Find<[true, 1, 'x', 3], string> // 'x'
350
+ import type { ArrayPlus } from 'type-plus'
351
+
352
+ type R = ArrayPlus.Find<Array<string>, string> // string
353
+ type R = ArrayPlus.Find<Array<1 | 2 | 'x'>, number> // 1 | 2 | undefined
354
+ type R = ArrayPlus.Find<Array<string | number>, number | string> // string | number
355
+ type R = ArrayPlus.Find<number[], 1> // widen: 1 | undefined
356
+ type R = ArrayPlus.Find<Array<string | number>, number> // unionNotMatch: number
357
+
358
+ type R = ArrayPlus.Find<string[], number> // never
359
+
360
+ // customization
361
+ type R = ArrayPlus.Find<number[], 1, { widen: false }> // never
362
+ type R = ArrayPlus.Find<number[], 1, { caseWiden: never }> // never
363
+ type R = ArrayPlus.Find<never, 1, { caseNever: 2 }> // 2
364
+ type R = ArrayPlus.Find<string[], number, { caseNotMatch: 2 }> // 2
365
+ type R = ArrayPlus.Find<[], 1, { caseTuple: 2 }> // 2
366
+ type R = ArrayPlus.Find<Array<string | number>, number, { caseUnionNotMatch: undefined }> // number | undefined
103
367
  ```
104
368
 
105
369
  ### [`ArrayPlus.FindLast`](./array.find_last.ts#L17)
@@ -174,7 +438,7 @@ or with reduced capability.
174
438
  They are exposed under the `ArrayPlus` namespace,
175
439
  while some common ones are exposed at top-level.
176
440
 
177
- Here are the list of array methods and their corresponding type-level functions, if availableL
441
+ Here are the list of array methods and their corresponding type-level functions, if available.
178
442
 
179
443
  - ✅ `at`: [`ArrayPlus.At`](#arrayplusat)
180
444
  - ✅ `concat`: [`Concat` | `ArrayPlus.Concat`](#arrayplusconcat) (`[...A, ...B]`)
@@ -210,3 +474,4 @@ Here are the list of array methods and their corresponding type-level functions,
210
474
 
211
475
  [handbook]: https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#arrays
212
476
  [tuple]: ../tuple/readme.md
477
+ [union]: ../union/readme.md
@@ -1,3 +1,9 @@
1
+ /**
2
+ * 🦴 *utilities*
3
+ *
4
+ * `reduce()` with predicate for early termination.
5
+ * A simple version of the same function in the `ramda` package.
6
+ */
1
7
  export function reduceWhile<T, R>(
2
8
  predicate: (acc: R, currentValue: T) => boolean,
3
9
  callbackfn: (previousValue: R, currentValue: T, currentIndex: number, array: T[]) => R,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * ⚗️ *transform*
3
+ *
4
+ * reverses the order of `A`.
5
+ */
1
6
  export type Reverse<A extends unknown[]> = number extends A['length']
2
7
  ? A
3
8
  : A['length'] extends 0
@@ -1,5 +1,5 @@
1
1
  import type { KeyTypes } from '../object/index.js'
2
- import type { Tail } from './tail.js'
2
+ import type { Tail } from '../tuple/tail.js'
3
3
 
4
4
  /**
5
5
  * Gets the union of properties of the elements in `A`
@@ -3,7 +3,10 @@ import { isConstructor, type AnyConstructor } from '../class/index.js'
3
3
  import { type AnyFunction } from '../function/any_function.js'
4
4
 
5
5
  /**
6
- * assert the subject satisfies the specified type T
6
+ * 💥 *immediate*
7
+ * 🚦 *assertion*
8
+ *
9
+ * Assert the subject satisfies the specified type T
7
10
  * @type T the type to check against.
8
11
  */
9
12
  export function assertType<T>(subject: T): asserts subject is T
@@ -9,11 +9,12 @@ They throw an error if the condition is not met, and return nothing otherwise.
9
9
  These assertion functions are typically used in runtime,
10
10
  so that that type of the value can be narrowed down.
11
11
 
12
- ## assertType
12
+ ## [assertType](./assert_type.ts#l10)
13
13
 
14
- `assertType<T>(subject)`:
14
+ `assertType<T>(subject)`
15
15
 
16
- ✔️ `immediate`
16
+ 💥 *immediate*
17
+ 🚦 *assertion*
17
18
 
18
19
  It ensures `subject` satisfies `T`.
19
20
  It is similar to `const x: T = subject` without introducing an unused variable.
@@ -1,4 +1,5 @@
1
- import type { Head, Last } from '../array/index.js'
1
+ import type { Head } from '../array/head.js'
2
+ import type { Last } from '../array/last.js'
2
3
  import type { AnyFunction } from '../function/any_function.js'
3
4
 
4
5
  /**
@@ -27,7 +27,7 @@ export type ContextBuilder<Init extends ContextBaseShape, Ctx extends ContextBas
27
27
  */
28
28
  extend<Additional extends ContextBaseShape = ContextBaseShape>(
29
29
  extender: ContextExtender<Ctx, Additional>
30
- ): ContextBuilder<Init, LeftJoin<Ctx, Additional>>
30
+ ): ContextBuilder<Init, LeftJoin<Ctx, Additional>>,
31
31
  /**
32
32
  * Build and return the context.
33
33
  */