bupkis 0.18.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/dist/assertion/assertion-async.cjs +268 -0
  4. package/dist/assertion/assertion-async.cjs.map +1 -0
  5. package/dist/assertion/assertion-async.d.cts +40 -0
  6. package/dist/assertion/assertion-async.d.cts.map +1 -0
  7. package/dist/assertion/assertion-async.d.ts +40 -0
  8. package/dist/assertion/assertion-async.d.ts.map +1 -0
  9. package/dist/assertion/assertion-async.js +259 -0
  10. package/dist/assertion/assertion-async.js.map +1 -0
  11. package/dist/assertion/assertion-standard-schema-async.cjs +132 -0
  12. package/dist/assertion/assertion-standard-schema-async.cjs.map +1 -0
  13. package/dist/assertion/assertion-standard-schema-async.d.cts +52 -0
  14. package/dist/assertion/assertion-standard-schema-async.d.cts.map +1 -0
  15. package/dist/assertion/assertion-standard-schema-async.d.ts +52 -0
  16. package/dist/assertion/assertion-standard-schema-async.d.ts.map +1 -0
  17. package/dist/assertion/assertion-standard-schema-async.js +128 -0
  18. package/dist/assertion/assertion-standard-schema-async.js.map +1 -0
  19. package/dist/assertion/assertion-standard-schema-sync.cjs +141 -0
  20. package/dist/assertion/assertion-standard-schema-sync.cjs.map +1 -0
  21. package/dist/assertion/assertion-standard-schema-sync.d.cts +52 -0
  22. package/dist/assertion/assertion-standard-schema-sync.d.cts.map +1 -0
  23. package/dist/assertion/assertion-standard-schema-sync.d.ts +52 -0
  24. package/dist/assertion/assertion-standard-schema-sync.d.ts.map +1 -0
  25. package/dist/assertion/assertion-standard-schema-sync.js +137 -0
  26. package/dist/assertion/assertion-standard-schema-sync.js.map +1 -0
  27. package/dist/assertion/assertion-sync.cjs +281 -0
  28. package/dist/assertion/assertion-sync.cjs.map +1 -0
  29. package/dist/assertion/assertion-sync.d.cts +60 -0
  30. package/dist/assertion/assertion-sync.d.cts.map +1 -0
  31. package/dist/assertion/assertion-sync.d.ts +60 -0
  32. package/dist/assertion/assertion-sync.d.ts.map +1 -0
  33. package/dist/assertion/assertion-sync.js +275 -0
  34. package/dist/assertion/assertion-sync.js.map +1 -0
  35. package/dist/assertion/assertion-types.cjs +20 -0
  36. package/dist/assertion/assertion-types.cjs.map +1 -0
  37. package/dist/assertion/assertion-types.d.cts +1086 -0
  38. package/dist/assertion/assertion-types.d.cts.map +1 -0
  39. package/dist/assertion/assertion-types.d.ts +1086 -0
  40. package/dist/assertion/assertion-types.d.ts.map +1 -0
  41. package/dist/assertion/assertion-types.js +19 -0
  42. package/dist/assertion/assertion-types.js.map +1 -0
  43. package/dist/assertion/assertion.cjs +382 -0
  44. package/dist/assertion/assertion.cjs.map +1 -0
  45. package/dist/assertion/assertion.d.cts +109 -0
  46. package/dist/assertion/assertion.d.cts.map +1 -0
  47. package/dist/assertion/assertion.d.ts +109 -0
  48. package/dist/assertion/assertion.d.ts.map +1 -0
  49. package/dist/assertion/assertion.js +375 -0
  50. package/dist/assertion/assertion.js.map +1 -0
  51. package/dist/assertion/create.cjs +148 -0
  52. package/dist/assertion/create.cjs.map +1 -0
  53. package/dist/assertion/create.d.cts +85 -0
  54. package/dist/assertion/create.d.cts.map +1 -0
  55. package/dist/assertion/create.d.ts +85 -0
  56. package/dist/assertion/create.d.ts.map +1 -0
  57. package/dist/assertion/create.js +143 -0
  58. package/dist/assertion/create.js.map +1 -0
  59. package/dist/assertion/format-assertion-failure.cjs +63 -0
  60. package/dist/assertion/format-assertion-failure.cjs.map +1 -0
  61. package/dist/assertion/format-assertion-failure.d.cts +21 -0
  62. package/dist/assertion/format-assertion-failure.d.cts.map +1 -0
  63. package/dist/assertion/format-assertion-failure.d.ts +21 -0
  64. package/dist/assertion/format-assertion-failure.d.ts.map +1 -0
  65. package/dist/assertion/format-assertion-failure.js +59 -0
  66. package/dist/assertion/format-assertion-failure.js.map +1 -0
  67. package/dist/assertion/impl/assertion-util.cjs +68 -0
  68. package/dist/assertion/impl/assertion-util.cjs.map +1 -0
  69. package/dist/assertion/impl/assertion-util.d.cts +36 -0
  70. package/dist/assertion/impl/assertion-util.d.cts.map +1 -0
  71. package/dist/assertion/impl/assertion-util.d.ts +36 -0
  72. package/dist/assertion/impl/assertion-util.d.ts.map +1 -0
  73. package/dist/assertion/impl/assertion-util.js +62 -0
  74. package/dist/assertion/impl/assertion-util.js.map +1 -0
  75. package/dist/assertion/impl/async-iterable.cjs +627 -0
  76. package/dist/assertion/impl/async-iterable.cjs.map +1 -0
  77. package/dist/assertion/impl/async-iterable.d.cts +406 -0
  78. package/dist/assertion/impl/async-iterable.d.cts.map +1 -0
  79. package/dist/assertion/impl/async-iterable.d.ts +406 -0
  80. package/dist/assertion/impl/async-iterable.d.ts.map +1 -0
  81. package/dist/assertion/impl/async-iterable.js +624 -0
  82. package/dist/assertion/impl/async-iterable.js.map +1 -0
  83. package/dist/assertion/impl/async-parametric.cjs +412 -0
  84. package/dist/assertion/impl/async-parametric.cjs.map +1 -0
  85. package/dist/assertion/impl/async-parametric.d.cts +278 -0
  86. package/dist/assertion/impl/async-parametric.d.cts.map +1 -0
  87. package/dist/assertion/impl/async-parametric.d.ts +278 -0
  88. package/dist/assertion/impl/async-parametric.d.ts.map +1 -0
  89. package/dist/assertion/impl/async-parametric.js +409 -0
  90. package/dist/assertion/impl/async-parametric.js.map +1 -0
  91. package/dist/assertion/impl/async.cjs +56 -0
  92. package/dist/assertion/impl/async.cjs.map +1 -0
  93. package/dist/assertion/impl/async.d.cts +179 -0
  94. package/dist/assertion/impl/async.d.cts.map +1 -0
  95. package/dist/assertion/impl/async.d.ts +179 -0
  96. package/dist/assertion/impl/async.d.ts.map +1 -0
  97. package/dist/assertion/impl/async.js +39 -0
  98. package/dist/assertion/impl/async.js.map +1 -0
  99. package/dist/assertion/impl/index.cjs +37 -0
  100. package/dist/assertion/impl/index.cjs.map +1 -0
  101. package/dist/assertion/impl/index.d.cts +21 -0
  102. package/dist/assertion/impl/index.d.cts.map +1 -0
  103. package/dist/assertion/impl/index.d.ts +21 -0
  104. package/dist/assertion/impl/index.d.ts.map +1 -0
  105. package/dist/assertion/impl/index.js +21 -0
  106. package/dist/assertion/impl/index.js.map +1 -0
  107. package/dist/assertion/impl/iteration-util.cjs +297 -0
  108. package/dist/assertion/impl/iteration-util.cjs.map +1 -0
  109. package/dist/assertion/impl/iteration-util.d.cts +12 -0
  110. package/dist/assertion/impl/iteration-util.d.cts.map +1 -0
  111. package/dist/assertion/impl/iteration-util.d.ts +12 -0
  112. package/dist/assertion/impl/iteration-util.d.ts.map +1 -0
  113. package/dist/assertion/impl/iteration-util.js +282 -0
  114. package/dist/assertion/impl/iteration-util.js.map +1 -0
  115. package/dist/assertion/impl/snapshot.cjs +276 -0
  116. package/dist/assertion/impl/snapshot.cjs.map +1 -0
  117. package/dist/assertion/impl/snapshot.d.cts +278 -0
  118. package/dist/assertion/impl/snapshot.d.cts.map +1 -0
  119. package/dist/assertion/impl/snapshot.d.ts +278 -0
  120. package/dist/assertion/impl/snapshot.d.ts.map +1 -0
  121. package/dist/assertion/impl/snapshot.js +273 -0
  122. package/dist/assertion/impl/snapshot.js.map +1 -0
  123. package/dist/assertion/impl/sync-basic.cjs +553 -0
  124. package/dist/assertion/impl/sync-basic.cjs.map +1 -0
  125. package/dist/assertion/impl/sync-basic.d.cts +528 -0
  126. package/dist/assertion/impl/sync-basic.d.cts.map +1 -0
  127. package/dist/assertion/impl/sync-basic.d.ts +528 -0
  128. package/dist/assertion/impl/sync-basic.d.ts.map +1 -0
  129. package/dist/assertion/impl/sync-basic.js +550 -0
  130. package/dist/assertion/impl/sync-basic.js.map +1 -0
  131. package/dist/assertion/impl/sync-collection.cjs +1424 -0
  132. package/dist/assertion/impl/sync-collection.cjs.map +1 -0
  133. package/dist/assertion/impl/sync-collection.d.cts +922 -0
  134. package/dist/assertion/impl/sync-collection.d.cts.map +1 -0
  135. package/dist/assertion/impl/sync-collection.d.ts +922 -0
  136. package/dist/assertion/impl/sync-collection.d.ts.map +1 -0
  137. package/dist/assertion/impl/sync-collection.js +1418 -0
  138. package/dist/assertion/impl/sync-collection.js.map +1 -0
  139. package/dist/assertion/impl/sync-date.cjs +341 -0
  140. package/dist/assertion/impl/sync-date.cjs.map +1 -0
  141. package/dist/assertion/impl/sync-date.d.cts +209 -0
  142. package/dist/assertion/impl/sync-date.d.cts.map +1 -0
  143. package/dist/assertion/impl/sync-date.d.ts +209 -0
  144. package/dist/assertion/impl/sync-date.d.ts.map +1 -0
  145. package/dist/assertion/impl/sync-date.js +338 -0
  146. package/dist/assertion/impl/sync-date.js.map +1 -0
  147. package/dist/assertion/impl/sync-esoteric.cjs +214 -0
  148. package/dist/assertion/impl/sync-esoteric.cjs.map +1 -0
  149. package/dist/assertion/impl/sync-esoteric.d.cts +191 -0
  150. package/dist/assertion/impl/sync-esoteric.d.cts.map +1 -0
  151. package/dist/assertion/impl/sync-esoteric.d.ts +191 -0
  152. package/dist/assertion/impl/sync-esoteric.d.ts.map +1 -0
  153. package/dist/assertion/impl/sync-esoteric.js +211 -0
  154. package/dist/assertion/impl/sync-esoteric.js.map +1 -0
  155. package/dist/assertion/impl/sync-iterable.cjs +512 -0
  156. package/dist/assertion/impl/sync-iterable.cjs.map +1 -0
  157. package/dist/assertion/impl/sync-iterable.d.cts +334 -0
  158. package/dist/assertion/impl/sync-iterable.d.cts.map +1 -0
  159. package/dist/assertion/impl/sync-iterable.d.ts +334 -0
  160. package/dist/assertion/impl/sync-iterable.d.ts.map +1 -0
  161. package/dist/assertion/impl/sync-iterable.js +509 -0
  162. package/dist/assertion/impl/sync-iterable.js.map +1 -0
  163. package/dist/assertion/impl/sync-parametric.cjs +805 -0
  164. package/dist/assertion/impl/sync-parametric.cjs.map +1 -0
  165. package/dist/assertion/impl/sync-parametric.d.cts +560 -0
  166. package/dist/assertion/impl/sync-parametric.d.cts.map +1 -0
  167. package/dist/assertion/impl/sync-parametric.d.ts +560 -0
  168. package/dist/assertion/impl/sync-parametric.d.ts.map +1 -0
  169. package/dist/assertion/impl/sync-parametric.js +802 -0
  170. package/dist/assertion/impl/sync-parametric.js.map +1 -0
  171. package/dist/assertion/impl/sync.cjs +229 -0
  172. package/dist/assertion/impl/sync.cjs.map +1 -0
  173. package/dist/assertion/impl/sync.d.cts +536 -0
  174. package/dist/assertion/impl/sync.d.cts.map +1 -0
  175. package/dist/assertion/impl/sync.d.ts +536 -0
  176. package/dist/assertion/impl/sync.d.ts.map +1 -0
  177. package/dist/assertion/impl/sync.js +212 -0
  178. package/dist/assertion/impl/sync.js.map +1 -0
  179. package/dist/assertion/index.cjs +38 -0
  180. package/dist/assertion/index.cjs.map +1 -0
  181. package/dist/assertion/index.d.cts +18 -0
  182. package/dist/assertion/index.d.cts.map +1 -0
  183. package/dist/assertion/index.d.ts +18 -0
  184. package/dist/assertion/index.d.ts.map +1 -0
  185. package/dist/assertion/index.js +17 -0
  186. package/dist/assertion/index.js.map +1 -0
  187. package/dist/assertion/slotify.cjs +165 -0
  188. package/dist/assertion/slotify.cjs.map +1 -0
  189. package/dist/assertion/slotify.d.cts +11 -0
  190. package/dist/assertion/slotify.d.cts.map +1 -0
  191. package/dist/assertion/slotify.d.ts +11 -0
  192. package/dist/assertion/slotify.d.ts.map +1 -0
  193. package/dist/assertion/slotify.js +161 -0
  194. package/dist/assertion/slotify.js.map +1 -0
  195. package/dist/bootstrap.cjs +43 -0
  196. package/dist/bootstrap.cjs.map +1 -0
  197. package/dist/bootstrap.d.cts +27 -0
  198. package/dist/bootstrap.d.cts.map +1 -0
  199. package/dist/bootstrap.d.ts +27 -0
  200. package/dist/bootstrap.d.ts.map +1 -0
  201. package/dist/bootstrap.js +40 -0
  202. package/dist/bootstrap.js.map +1 -0
  203. package/dist/constant.cjs +82 -0
  204. package/dist/constant.cjs.map +1 -0
  205. package/dist/constant.d.cts +69 -0
  206. package/dist/constant.d.cts.map +1 -0
  207. package/dist/constant.d.ts +69 -0
  208. package/dist/constant.d.ts.map +1 -0
  209. package/dist/constant.js +79 -0
  210. package/dist/constant.js.map +1 -0
  211. package/dist/diff.cjs +340 -0
  212. package/dist/diff.cjs.map +1 -0
  213. package/dist/diff.d.cts +51 -0
  214. package/dist/diff.d.cts.map +1 -0
  215. package/dist/diff.d.ts +51 -0
  216. package/dist/diff.d.ts.map +1 -0
  217. package/dist/diff.js +334 -0
  218. package/dist/diff.js.map +1 -0
  219. package/dist/error.cjs +194 -0
  220. package/dist/error.cjs.map +1 -0
  221. package/dist/error.d.cts +212 -0
  222. package/dist/error.d.cts.map +1 -0
  223. package/dist/error.d.ts +212 -0
  224. package/dist/error.d.ts.map +1 -0
  225. package/dist/error.js +181 -0
  226. package/dist/error.js.map +1 -0
  227. package/dist/expect.cjs +587 -0
  228. package/dist/expect.cjs.map +1 -0
  229. package/dist/expect.d.cts +138 -0
  230. package/dist/expect.d.cts.map +1 -0
  231. package/dist/expect.d.ts +138 -0
  232. package/dist/expect.d.ts.map +1 -0
  233. package/dist/expect.js +582 -0
  234. package/dist/expect.js.map +1 -0
  235. package/dist/guards.cjs +291 -0
  236. package/dist/guards.cjs.map +1 -0
  237. package/dist/guards.d.cts +225 -0
  238. package/dist/guards.d.cts.map +1 -0
  239. package/dist/guards.d.ts +225 -0
  240. package/dist/guards.d.ts.map +1 -0
  241. package/dist/guards.js +273 -0
  242. package/dist/guards.js.map +1 -0
  243. package/dist/index.cjs +111 -0
  244. package/dist/index.cjs.map +1 -0
  245. package/dist/index.d.cts +460 -0
  246. package/dist/index.d.cts.map +1 -0
  247. package/dist/index.d.ts +460 -0
  248. package/dist/index.d.ts.map +1 -0
  249. package/dist/index.js +71 -0
  250. package/dist/index.js.map +1 -0
  251. package/dist/internal-schema.cjs +234 -0
  252. package/dist/internal-schema.cjs.map +1 -0
  253. package/dist/internal-schema.d.cts +8 -0
  254. package/dist/internal-schema.d.cts.map +1 -0
  255. package/dist/internal-schema.d.ts +8 -0
  256. package/dist/internal-schema.d.ts.map +1 -0
  257. package/dist/internal-schema.js +229 -0
  258. package/dist/internal-schema.js.map +1 -0
  259. package/dist/metadata.cjs +57 -0
  260. package/dist/metadata.cjs.map +1 -0
  261. package/dist/metadata.d.cts +27 -0
  262. package/dist/metadata.d.cts.map +1 -0
  263. package/dist/metadata.d.ts +27 -0
  264. package/dist/metadata.d.ts.map +1 -0
  265. package/dist/metadata.js +54 -0
  266. package/dist/metadata.js.map +1 -0
  267. package/dist/schema.cjs +1522 -0
  268. package/dist/schema.cjs.map +1 -0
  269. package/dist/schema.d.cts +1196 -0
  270. package/dist/schema.d.cts.map +1 -0
  271. package/dist/schema.d.ts +1196 -0
  272. package/dist/schema.d.ts.map +1 -0
  273. package/dist/schema.js +1516 -0
  274. package/dist/schema.js.map +1 -0
  275. package/dist/snapshot/adapter.cjs +29 -0
  276. package/dist/snapshot/adapter.cjs.map +1 -0
  277. package/dist/snapshot/adapter.d.cts +258 -0
  278. package/dist/snapshot/adapter.d.cts.map +1 -0
  279. package/dist/snapshot/adapter.d.ts +258 -0
  280. package/dist/snapshot/adapter.d.ts.map +1 -0
  281. package/dist/snapshot/adapter.js +25 -0
  282. package/dist/snapshot/adapter.js.map +1 -0
  283. package/dist/snapshot/adapters/fallback.cjs +452 -0
  284. package/dist/snapshot/adapters/fallback.cjs.map +1 -0
  285. package/dist/snapshot/adapters/fallback.d.cts +185 -0
  286. package/dist/snapshot/adapters/fallback.d.cts.map +1 -0
  287. package/dist/snapshot/adapters/fallback.d.ts +185 -0
  288. package/dist/snapshot/adapters/fallback.d.ts.map +1 -0
  289. package/dist/snapshot/adapters/fallback.js +445 -0
  290. package/dist/snapshot/adapters/fallback.js.map +1 -0
  291. package/dist/snapshot/adapters/node-test.cjs +297 -0
  292. package/dist/snapshot/adapters/node-test.cjs.map +1 -0
  293. package/dist/snapshot/adapters/node-test.d.cts +131 -0
  294. package/dist/snapshot/adapters/node-test.d.cts.map +1 -0
  295. package/dist/snapshot/adapters/node-test.d.ts +131 -0
  296. package/dist/snapshot/adapters/node-test.d.ts.map +1 -0
  297. package/dist/snapshot/adapters/node-test.js +293 -0
  298. package/dist/snapshot/adapters/node-test.js.map +1 -0
  299. package/dist/snapshot/index.cjs +61 -0
  300. package/dist/snapshot/index.cjs.map +1 -0
  301. package/dist/snapshot/index.d.cts +40 -0
  302. package/dist/snapshot/index.d.cts.map +1 -0
  303. package/dist/snapshot/index.d.ts +40 -0
  304. package/dist/snapshot/index.d.ts.map +1 -0
  305. package/dist/snapshot/index.js +44 -0
  306. package/dist/snapshot/index.js.map +1 -0
  307. package/dist/snapshot/node-version.cjs +49 -0
  308. package/dist/snapshot/node-version.cjs.map +1 -0
  309. package/dist/snapshot/node-version.d.cts +34 -0
  310. package/dist/snapshot/node-version.d.cts.map +1 -0
  311. package/dist/snapshot/node-version.d.ts +34 -0
  312. package/dist/snapshot/node-version.d.ts.map +1 -0
  313. package/dist/snapshot/node-version.js +44 -0
  314. package/dist/snapshot/node-version.js.map +1 -0
  315. package/dist/snapshot/select-adapter.cjs +170 -0
  316. package/dist/snapshot/select-adapter.cjs.map +1 -0
  317. package/dist/snapshot/select-adapter.d.cts +128 -0
  318. package/dist/snapshot/select-adapter.d.cts.map +1 -0
  319. package/dist/snapshot/select-adapter.d.ts +128 -0
  320. package/dist/snapshot/select-adapter.d.ts.map +1 -0
  321. package/dist/snapshot/select-adapter.js +164 -0
  322. package/dist/snapshot/select-adapter.js.map +1 -0
  323. package/dist/snapshot/serializer.cjs +245 -0
  324. package/dist/snapshot/serializer.cjs.map +1 -0
  325. package/dist/snapshot/serializer.d.cts +126 -0
  326. package/dist/snapshot/serializer.d.cts.map +1 -0
  327. package/dist/snapshot/serializer.d.ts +126 -0
  328. package/dist/snapshot/serializer.d.ts.map +1 -0
  329. package/dist/snapshot/serializer.js +237 -0
  330. package/dist/snapshot/serializer.js.map +1 -0
  331. package/dist/standard-schema.cjs +13 -0
  332. package/dist/standard-schema.cjs.map +1 -0
  333. package/dist/standard-schema.d.cts +192 -0
  334. package/dist/standard-schema.d.cts.map +1 -0
  335. package/dist/standard-schema.d.ts +192 -0
  336. package/dist/standard-schema.d.ts.map +1 -0
  337. package/dist/standard-schema.js +12 -0
  338. package/dist/standard-schema.js.map +1 -0
  339. package/dist/types.cjs +22 -0
  340. package/dist/types.cjs.map +1 -0
  341. package/dist/types.d.cts +756 -0
  342. package/dist/types.d.cts.map +1 -0
  343. package/dist/types.d.ts +756 -0
  344. package/dist/types.d.ts.map +1 -0
  345. package/dist/types.js +21 -0
  346. package/dist/types.js.map +1 -0
  347. package/dist/use.cjs +240 -0
  348. package/dist/use.cjs.map +1 -0
  349. package/dist/use.d.cts +8 -0
  350. package/dist/use.d.cts.map +1 -0
  351. package/dist/use.d.ts +8 -0
  352. package/dist/use.d.ts.map +1 -0
  353. package/dist/use.js +236 -0
  354. package/dist/use.js.map +1 -0
  355. package/dist/util.cjs +255 -0
  356. package/dist/util.cjs.map +1 -0
  357. package/dist/util.d.cts +141 -0
  358. package/dist/util.d.cts.map +1 -0
  359. package/dist/util.d.ts +141 -0
  360. package/dist/util.d.ts.map +1 -0
  361. package/dist/util.js +234 -0
  362. package/dist/util.js.map +1 -0
  363. package/dist/value-to-schema.cjs +537 -0
  364. package/dist/value-to-schema.cjs.map +1 -0
  365. package/dist/value-to-schema.d.cts +144 -0
  366. package/dist/value-to-schema.d.cts.map +1 -0
  367. package/dist/value-to-schema.d.ts +144 -0
  368. package/dist/value-to-schema.d.ts.map +1 -0
  369. package/dist/value-to-schema.js +533 -0
  370. package/dist/value-to-schema.js.map +1 -0
  371. package/package.json +24 -21
  372. package/src/assertion/assertion-sync.ts +1 -1
  373. package/src/assertion/assertion-types.ts +4 -8
  374. package/src/assertion/assertion.ts +12 -7
  375. package/src/assertion/format-assertion-failure.ts +2 -0
  376. package/src/assertion/impl/assertion-util.ts +1 -2
  377. package/src/assertion/impl/iteration-util.ts +3 -5
  378. package/src/assertion/impl/sync-collection.ts +633 -7
  379. package/src/assertion/impl/sync.ts +27 -0
  380. package/src/error.ts +13 -22
  381. package/src/expect.ts +1 -1
  382. package/src/guards.ts +8 -14
  383. package/src/internal-schema.ts +4 -8
  384. package/src/metadata.ts +1 -2
  385. package/src/snapshot/adapter.ts +2 -3
  386. package/src/snapshot/adapters/fallback.ts +2 -3
  387. package/src/snapshot/adapters/node-test.ts +14 -20
  388. package/src/snapshot/select-adapter.ts +3 -3
  389. package/src/snapshot/serializer.ts +2 -3
  390. package/src/types.ts +2 -162
@@ -0,0 +1,756 @@
1
+ /**
2
+ * Types used throughout <span class="bupkis">BUPKIS</span>.
3
+ *
4
+ * May be useful for those building on top of <span
5
+ * class="bupkis">BUPKIS</span>.
6
+ *
7
+ * @example
8
+ *
9
+ * ```ts
10
+ * // namespace
11
+ * import { types } from 'bupkis';
12
+ * // subpath import
13
+ * import type * as alsoTypes from 'bupkis/types';
14
+ * ```
15
+ *
16
+ * @groupDescription Utility Types
17
+ * Types used throughout <span class="bupkis">BUPKIS</span>.
18
+ * @packageDocumentation
19
+ */
20
+ import type { ArrayValues, TupleToUnion, Constructor as TypeFestConstructor, UnionToIntersection } from 'type-fest';
21
+ import type { z } from 'zod';
22
+ import type { AnyAssertion, AnyAsyncAssertion, AnyAsyncAssertions, AnySyncAssertion, AnySyncAssertions, AssertionPart, AssertionParts, AssertionSlot, BuiltinAsyncAssertions, BuiltinSyncAssertions, CreateAssertionFn, CreateAsyncAssertionFn, NoNeverTuple, PhraseLiteral, PhraseLiteralChoice, PhraseLiteralChoiceSlot, PhraseLiteralSlot } from "./assertion/assertion-types.cjs";
23
+ import type { StandardSchemaV1 } from "./standard-schema.cjs";
24
+ /**
25
+ * Creates a negated version of a tuple of
26
+ * {@link AssertionPart | AssertionParts}.
27
+ *
28
+ * For {@link PhraseLiteral | PhraseLiterals}, creates a
29
+ * {@link Negation | "not" variant}. For
30
+ * {@link PhraseLiteralChoice | PhraseLiteralChoices}, creates negated versions
31
+ * of each `Phrase` in the array.
32
+ *
33
+ * Does not affect Zod schemas.
34
+ *
35
+ * @template Parts Parts containing `PhraseLiterals` or `PhraseLiteralChoices`
36
+ * to negate.
37
+ */
38
+ export type AddNegation<Parts extends readonly AssertionPart[]> = Parts extends readonly [
39
+ infer First extends AssertionPart,
40
+ ...infer Rest extends readonly AssertionPart[]
41
+ ] ? First extends PhraseLiteralChoice ? readonly [
42
+ {
43
+ [K in keyof First]: First[K] extends PhraseLiteral ? Negation<First[K]> : never;
44
+ },
45
+ ...AddNegation<Rest>
46
+ ] : First extends PhraseLiteral ? readonly [Negation<First>, ...AddNegation<Rest>] : readonly [First, ...AddNegation<Rest>] : readonly [];
47
+ /**
48
+ * Base set of properties included in both {@link Expect} and {@link ExpectAsync}.
49
+ *
50
+ * @preventExpand
51
+ * @group Expect-Related
52
+ */
53
+ export interface BaseExpect {
54
+ /**
55
+ * Creates a new synchronous assertion.
56
+ */
57
+ createAssertion: CreateAssertionFn;
58
+ /**
59
+ * Creates a new asynchronous assertion.
60
+ */
61
+ createAsyncAssertion: CreateAsyncAssertionFn;
62
+ /**
63
+ * Fails immediately with optional `reason`.
64
+ *
65
+ * @param reason Reason for failure
66
+ * @throws {AssertionError}
67
+ */
68
+ fail: FailFn;
69
+ }
70
+ export type * from "./assertion/assertion-types.cjs";
71
+ export type { StandardSchemaV1 };
72
+ /**
73
+ * The main API as returned by a {@link UseFn}.
74
+ *
75
+ * @template BaseSyncAssertions Base set of synchronous
76
+ * {@link Assertion | Assertions}; will be the builtin sync assertions, at
77
+ * minimum)
78
+ * @template BaseAsyncAssertions Base set of asynchronous
79
+ * {@link Assertion | Assertions}; will be the builtin async assertions, at
80
+ * minimum)
81
+ * @template ExtendedSyncAssertions Synchronous assertions extracted from
82
+ * `MixedAssertions`
83
+ * @template ExtendedAsyncAssertions Asynchronous assertions extracted from
84
+ * `MixedAssertions`
85
+ * @group Core API
86
+ */
87
+ export interface Bupkis<BaseSyncAssertions extends AnySyncAssertions, BaseAsyncAssertions extends AnyAsyncAssertions, ExtendedSyncAssertions extends readonly AnySyncAssertion[] = readonly [], ExtendedAsyncAssertions extends readonly AnyAsyncAssertion[] = readonly []> {
88
+ /**
89
+ * A new {@link Expect} function which handles {@link ExtendedSyncAssertions}
90
+ * and {@link BaseSyncAssertions}
91
+ */
92
+ expect: Expect<Concat<BaseSyncAssertions, ExtendedSyncAssertions>, Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>>;
93
+ /**
94
+ * A new {@link ExpectAsync} function which handles
95
+ * {@link ExtendedAsyncAssertions} and {@link BaseAsyncAssertions}
96
+ */
97
+ expectAsync: ExpectAsync<Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>, Concat<BaseSyncAssertions, ExtendedSyncAssertions>>;
98
+ /**
99
+ * For composing arrays of assertions, one after another.
100
+ *
101
+ * The _only_ chainable API in <span class="bupkis">Bupkis</span>.
102
+ *
103
+ * @since 0.1.0
104
+ * @example
105
+ *
106
+ * ```ts
107
+ * const { expect } = use([...someAssertions]).use([...otherAssertions]);
108
+ * ```
109
+ */
110
+ use: UseFn<Concat<BaseSyncAssertions, ExtendedSyncAssertions>, Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>>;
111
+ }
112
+ /**
113
+ * Helper type to concatenate two tuples
114
+ *
115
+ * @group Utility Types
116
+ */
117
+ export type Concat<TupleA extends readonly unknown[], TupleB extends readonly unknown[]> = readonly [...TupleA, ...TupleB];
118
+ /**
119
+ * A constructor based on {@link TypeFestConstructor type-fest's Constructor}
120
+ * with a default instance type argument.
121
+ *
122
+ * @group Utility Types
123
+ */
124
+ export type Constructor<Instance = any, Args extends unknown[] = any[]> = TypeFestConstructor<Instance, Args>;
125
+ export type DefFromZodType<T extends z.core.$ZodType | z.ZodType> = T extends z.ZodType ? T['def'] : T extends z.core.$ZodType ? T['_zod']['def'] : never;
126
+ /**
127
+ * The main synchronous assertion function.
128
+ *
129
+ * Contains properties in {@link ExpectSyncProps}.
130
+ *
131
+ * @template SyncAssertions All synchronous assertions available
132
+ * @template AsyncAssertions All asynchronous assertions available; for use in
133
+ * {@link ExpectSyncProps.use} only.
134
+ * @expandType ExpectSyncProps
135
+ * @group Core API
136
+ * @see {@link expect}
137
+ */
138
+ export type Expect<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions, AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = ExpectFunction<SyncAssertions> & ExpectSyncProps<SyncAssertions, AsyncAssertions>;
139
+ /**
140
+ * The main asynchronous assertion function.
141
+ *
142
+ * Contains properties in {@link ExpectAsyncProps}.
143
+ *
144
+ * @template AsyncAssertions All asynchronous assertions available
145
+ * @template SyncAssertions All synchronous assertions available; for use in
146
+ * {@link ExpectAsyncProps.use} only.
147
+ * @expandType ExpectAsyncProps
148
+ * @group Core API
149
+ * @see {@link expectAsync}
150
+ */
151
+ export type ExpectAsync<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions, SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = ExpectAsyncFunction<AsyncAssertions> & ExpectAsyncProps<AsyncAssertions, SyncAssertions>;
152
+ /**
153
+ * The callable function type for asynchronous assertions.
154
+ *
155
+ * This type represents the actual function signature of an async expect
156
+ * function, created by mapping all available assertions to their respective
157
+ * function signatures and combining them using intersection types. Each
158
+ * assertion contributes its own overload to the final function type.
159
+ *
160
+ * The function signatures are derived from the {@link AssertionParts} of each
161
+ * assertion, with parameters that match the expected slots for natural language
162
+ * assertion calls.
163
+ *
164
+ * @example
165
+ *
166
+ * ```typescript
167
+ * // Example function type derived from async assertions
168
+ * const expectAsync: ExpectAsyncFunction<MyAsyncAssertions> = ...;
169
+ * await expectAsync(promise, 'to resolve');
170
+ * await expectAsync(promise, 'to resolve with value satisfying', expectedValue);
171
+ * ```
172
+ *
173
+ * @template AsyncAssertions - Array of async assertion objects that define
174
+ * available assertion logic
175
+ * @see {@link ExpectFunction} for the synchronous equivalent
176
+ * @see {@link SlotsFromParts} for how assertion parts are converted to function parameters
177
+ */
178
+ export type ExpectAsyncFunction<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = UnionToIntersection<TupleToUnion<{
179
+ [K in keyof AsyncAssertions]: (...args: MutableOrReadonly<SlotsFromParts<AsyncAssertions[K]['parts']>>) => Promise<void>;
180
+ }>>;
181
+ /**
182
+ * Properties available on asynchronous expect functions.
183
+ *
184
+ * This interface defines the additional properties and methods that are
185
+ * attached to async expect functions, extending the base expect functionality
186
+ * with async-specific features. These properties provide access to the
187
+ * underlying assertions and enable function composition through the
188
+ * {@link UseFn | `use`} method.
189
+ *
190
+ * @example
191
+ *
192
+ * ```typescript
193
+ * const expectAsync: ExpectAsync<MyAsyncAssertions> =
194
+ * createExpectAsyncFunction(assertions);
195
+ *
196
+ * // Access the underlying assertions
197
+ * console.log(expectAsync.assertions.length);
198
+ *
199
+ * // Compose with additional assertions
200
+ * const { expectAsync: enhanced } = expectAsync.use(moreAssertions);
201
+ * ```
202
+ *
203
+ * @template AsyncAssertions - Array of async assertion objects available to
204
+ * this expect function
205
+ * @template SyncAssertions - Array of sync assertion objects available for
206
+ * composition via {@link UseFn | `use`}
207
+ * @group Expect-Related
208
+ */
209
+ export interface ExpectAsyncProps<AsyncAssertions extends AnyAsyncAssertions, SyncAssertions extends AnySyncAssertions> extends BaseExpect {
210
+ /**
211
+ * Tuple of all assertions available in this `expect()`.
212
+ *
213
+ * @preventExpand
214
+ */
215
+ assertions: AsyncAssertions;
216
+ /**
217
+ * {@inheritDoc ExpectItAsync}
218
+ */
219
+ it: ExpectItAsync<AsyncAssertions>;
220
+ /**
221
+ * {@inheritDoc UseFn}
222
+ */
223
+ use: UseFn<SyncAssertions, AsyncAssertions>;
224
+ }
225
+ /**
226
+ * The function part of {@link Expect}.
227
+ *
228
+ * This is an intersection of all function signatures derived from the available
229
+ * synchronous assertions.
230
+ */
231
+ export type ExpectFunction<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = UnionToIntersection<TupleToUnion<{
232
+ [K in keyof SyncAssertions]: (...args: MutableOrReadonly<SlotsFromParts<SyncAssertions[K]['parts']>>) => void;
233
+ }>>;
234
+ /**
235
+ * Creates embeddable assertion functions that can be used with `'to satisfy'`.
236
+ *
237
+ * This type generates a union of all possible `expect.it` function signatures
238
+ * based on the available synchronous assertions. Each assertion contributes its
239
+ * own function signature to create embeddable executors that can be used within
240
+ * object patterns for complex validation scenarios.
241
+ *
242
+ * The resulting functions are designed to be used exclusively within `'to
243
+ * satisfy'` assertion contexts, where they provide type-safe pattern matching
244
+ * for nested object structures. Direct execution of these functions outside of
245
+ * their intended context is not supported.
246
+ *
247
+ * @example
248
+ *
249
+ * ```typescript
250
+ * // Create embeddable assertion functions
251
+ * const isString = expect.it('to be a string');
252
+ * const isPositive = expect.it('to be greater than', 0);
253
+ *
254
+ * // Use within 'to satisfy' patterns
255
+ * expect(user, 'to satisfy', {
256
+ * name: isString,
257
+ * age: isPositive,
258
+ * email: /\S+@\S+/,
259
+ * });
260
+ * ```
261
+ *
262
+ * @template SyncAssertions - Array of synchronous assertion objects that define
263
+ * the available assertion logic for embeddable functions
264
+ * @group Core API
265
+ * @see {@link ExpectItFunction} for individual function signature generation
266
+ * @see {@link ExpectItExecutor} for the executor function interface
267
+ */
268
+ export type ExpectIt<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = UnionToIntersection<TupleToUnion<{
269
+ [K in keyof SyncAssertions]: SyncAssertions[K] extends AnySyncAssertion ? SyncAssertions[K]['parts'] extends AssertionParts ? ExpectItFunction<SyncAssertions[K]['parts']> : never : never;
270
+ }>>;
271
+ /**
272
+ * Factory type for creating async embeddable assertion executors.
273
+ *
274
+ * This type generates a union of all possible `expectAsync.it` function
275
+ * signatures based on the available asynchronous assertions. Each assertion
276
+ * contributes its own function signature to create embeddable async executors
277
+ * that can be used within async object patterns for complex validation
278
+ * scenarios.
279
+ *
280
+ * The resulting functions are designed to be used exclusively within async `'to
281
+ * satisfy'` assertion contexts, where they provide type-safe pattern matching
282
+ * for nested object structures with `Promise`-based validation.
283
+ *
284
+ * @example
285
+ *
286
+ * ```typescript
287
+ * // Create embeddable async assertion functions
288
+ * const isAsyncString = expectAsync.it('to be a string');
289
+ * const resolvesFast = expectAsync.it('to resolve quickly');
290
+ *
291
+ * // Use within async 'to satisfy' patterns
292
+ * await expectAsync(asyncUser, 'to satisfy', {
293
+ * name: isAsyncString,
294
+ * loadPromise: resolvesFast,
295
+ * });
296
+ * ```
297
+ *
298
+ * @template AsyncAssertions - Array of asynchronous assertion objects that
299
+ * define the available assertion logic for the embeddable async functions
300
+ * @group Core API
301
+ * @see {@link ExpectItFunctionAsync} for individual function signature generation
302
+ * @see {@link ExpectItExecutorAsync} for the executor function interface
303
+ * @see {@link ExpectIt} for the synchronous equivalent
304
+ */
305
+ export type ExpectItAsync<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = UnionToIntersection<TupleToUnion<{
306
+ [K in keyof AsyncAssertions]: AsyncAssertions[K] extends AnyAsyncAssertion ? AsyncAssertions[K]['parts'] extends AssertionParts ? ExpectItFunctionAsync<AsyncAssertions[K]['parts']> : never : never;
307
+ }>>;
308
+ /**
309
+ * Interface for executor functions created by `expect.it()`.
310
+ *
311
+ * `ExpectItExecutor` functions are the result of calling `expect.it()` with
312
+ * assertion parameters. They encapsulate the assertion logic and can be
313
+ * executed later within `'to satisfy'` pattern matching contexts. These
314
+ * functions are marked with an internal symbol to distinguish them from regular
315
+ * functions during pattern validation.
316
+ *
317
+ * The executor accepts a subject value and performs the embedded assertion
318
+ * logic against it. The subject type is constrained by the Zod schema that
319
+ * represents the first part of the assertion definition, ensuring type safety
320
+ * during pattern matching.
321
+ *
322
+ * @example
323
+ *
324
+ * ```typescript
325
+ * const isStringExecutor = expect.it('to be a string');
326
+ * // isStringExecutor is an ExpectItExecutor<z.ZodString>
327
+ *
328
+ * // Used within satisfy patterns
329
+ * expect({ name: 'Alice' }, 'to satisfy', {
330
+ * name: isStringExecutor, // Validates that name is a string
331
+ * });
332
+ * ```
333
+ *
334
+ * @template Subject - The Zod schema type that constrains the subject parameter
335
+ * @group Expect-Related
336
+ * @see {@link ExpectItFunction} for the factory function that creates executors
337
+ */
338
+ export interface ExpectItExecutor<Subject extends z.ZodType> {
339
+ (subject: z.infer<Subject>): void;
340
+ }
341
+ /**
342
+ * Function signature for creating `ExpectItExecutor` instances.
343
+ *
344
+ * This type represents the factory function that creates embeddable assertion
345
+ * executors from assertion parts. It takes the assertion parameters (excluding
346
+ * the subject) and returns an executor function that can be embedded within
347
+ * `'to satisfy'` patterns.
348
+ *
349
+ * The function signature is derived from assertion parts by removing the first
350
+ * part (which becomes the subject type for the executor) and using the
351
+ * remaining parts as parameters. This allows for natural language assertion
352
+ * creation that mirrors the main `expect()` function but produces reusable
353
+ * executor functions.
354
+ *
355
+ * The resulting executor is constrained to only work with subjects that match
356
+ * the first assertion part, providing compile-time type safety for pattern
357
+ * matching scenarios.
358
+ *
359
+ * @example
360
+ *
361
+ * ```typescript
362
+ * // For assertion parts: [z.string(), 'to match', z.instanceof(RegExp)]
363
+ * // Results in function: (pattern: RegExp) => ExpectItExecutor<z.ZodString>
364
+ * const matchesPattern = expect.it('to match', /^[A-Z]/);
365
+ *
366
+ * expect({ code: 'ABC123' }, 'to satisfy', {
367
+ * code: matchesPattern, // Validates that code matches the pattern
368
+ * });
369
+ * ```
370
+ *
371
+ * @template Parts - Tuple of assertion parts that define the function signature
372
+ * and executor constraints
373
+ * @see {@link ExpectItExecutor} for the returned executor interface
374
+ * @see {@link TupleTail} for parameter extraction from assertion parts
375
+ * @see {@link SlotsFromParts} for type slot generation
376
+ */
377
+ /**
378
+ * Interface for asynchronous executor functions created by `expectAsync.it()`.
379
+ *
380
+ * `ExpectItExecutorAsync` functions are the async equivalent of
381
+ * {@link ExpectItExecutor}, designed for asynchronous assertion contexts. They
382
+ * return `Promise`s and are marked with the same internal symbol for
383
+ * identification. These executors can be embedded within `'to satisfy'`
384
+ * patterns for async validation scenarios.
385
+ *
386
+ * @example
387
+ *
388
+ * ```typescript
389
+ * const isAsyncStringExecutor = expectAsync.it('to be a string');
390
+ * // isAsyncStringExecutor is an ExpectItExecutorAsync<z.ZodString>
391
+ *
392
+ * // Used within async satisfy patterns
393
+ * await expectAsync({ name: 'Alice' }, 'to satisfy', {
394
+ * name: isAsyncStringExecutor, // Async validation that name is a string
395
+ * });
396
+ * ```
397
+ *
398
+ * @template Subject - The Zod schema type that constrains the subject parameter
399
+ * @group Expect-Related
400
+ * @see {@link ExpectItFunctionAsync} for the factory function that creates async executors
401
+ * @see {@link ExpectItExecutor} for the synchronous equivalent
402
+ */
403
+ export interface ExpectItExecutorAsync<Subject extends z.ZodType> {
404
+ (subject: z.infer<Subject>): Promise<void>;
405
+ }
406
+ /**
407
+ * The function part of {@link ExpectIt}.
408
+ */
409
+ export type ExpectItFunction<Parts extends AssertionParts> = (...args: MutableOrReadonly<TupleTail<SlotsFromParts<Parts>>>) => Parts[0] extends z.ZodType ? ExpectItExecutor<Parts[0]> : never;
410
+ /**
411
+ * Function signature for creating async `ExpectItExecutorAsync` instances.
412
+ *
413
+ * This type represents the factory function that creates embeddable async
414
+ * assertion executors from assertion parts. It takes the assertion parameters
415
+ * (excluding the subject) and returns an async executor function that can be
416
+ * embedded within async `'to satisfy'` patterns.
417
+ *
418
+ * The function signature is derived from assertion parts by removing the first
419
+ * part (which becomes the subject type for the executor) and using the
420
+ * remaining parts as parameters. This allows for natural language assertion
421
+ * creation that mirrors the main `expectAsync()` function but produces reusable
422
+ * async executor functions.
423
+ *
424
+ * @example
425
+ *
426
+ * ```typescript
427
+ * // For assertion parts: [z.string(), 'to match', z.instanceof(RegExp)]
428
+ * // Results in function: (pattern: RegExp) => ExpectItExecutorAsync<z.ZodString>
429
+ * const matchesPatternAsync = expectAsync.it('to match', /^[A-Z]/);
430
+ *
431
+ * await expectAsync({ code: 'ABC123' }, 'to satisfy', {
432
+ * code: matchesPatternAsync, // Async validation that code matches the pattern
433
+ * });
434
+ * ```
435
+ *
436
+ * @template Parts - Tuple of assertion parts that define the function signature
437
+ * and executor constraints
438
+ * @see {@link ExpectItExecutorAsync} for the returned async executor interface
439
+ * @see {@link ExpectItFunction} for the synchronous equivalent
440
+ * @see {@link TupleTail} for parameter extraction from assertion parts
441
+ * @see {@link SlotsFromParts} for type slot generation
442
+ */
443
+ export type ExpectItFunctionAsync<Parts extends AssertionParts> = (...args: MutableOrReadonly<TupleTail<SlotsFromParts<Parts>>>) => Parts[0] extends z.ZodType ? ExpectItExecutorAsync<Parts[0]> : never;
444
+ /**
445
+ * Properties of {@link expect}.
446
+ *
447
+ * @group Expect-Related
448
+ */
449
+ export interface ExpectSyncProps<SyncAssertions extends AnySyncAssertions, AsyncAssertions extends AnyAsyncAssertions> extends BaseExpect {
450
+ /**
451
+ * Tuple of all assertions available in this `expect()`.
452
+ *
453
+ * @preventExpand
454
+ */
455
+ assertions: SyncAssertions;
456
+ it: ExpectIt<SyncAssertions>;
457
+ /**
458
+ * Function to add more assertions to this `expect()`, returning a new
459
+ * `expect()` and `expectAsync()` pair with the combined assertions.
460
+ */
461
+ use: UseFn<SyncAssertions, AsyncAssertions>;
462
+ }
463
+ /**
464
+ * A function which immediately throws an {@link AssertionError}.
465
+ *
466
+ * Member of {@link BaseExpect}.
467
+ *
468
+ * @param reason Optional reason for failure
469
+ * @group Core API
470
+ * @see {@link fail}
471
+ */
472
+ export type FailFn = (reason?: string) => never;
473
+ /**
474
+ * Given a mixed array of assertions, filters out only the async assertions.
475
+ */
476
+ /**
477
+ * Given a mixed array of assertions, filters out only the async assertions.
478
+ *
479
+ * This utility type recursively examines each assertion in the input array and
480
+ * constructs a new tuple containing only the asynchronous assertions. It uses
481
+ * conditional types to test whether each assertion extends
482
+ * {@link AnyAsyncAssertion} and includes it in the result if so.
483
+ *
484
+ * Used primarily by {@link UseFn} to separate async assertions from mixed
485
+ * assertion arrays when composing expect functions.
486
+ *
487
+ * @example
488
+ *
489
+ * ```typescript
490
+ * type Mixed = [
491
+ * SyncAssertion1,
492
+ * AsyncAssertion1,
493
+ * SyncAssertion2,
494
+ * AsyncAssertion2,
495
+ * ];
496
+ * type AsyncOnly = FilterAsyncAssertions<Mixed>; // [AsyncAssertion1, AsyncAssertion2]
497
+ * ```
498
+ *
499
+ * @template MixedAssertions - Array that may contain both sync and async
500
+ * assertions
501
+ * @see {@link FilterSyncAssertions} for extracting synchronous assertions
502
+ * @see {@link UseFn} for the primary use case of this type
503
+ */
504
+ export type FilterAsyncAssertions<MixedAssertions extends readonly AnyAssertion[]> = MixedAssertions extends readonly [
505
+ infer MixedAssertion extends AnyAssertion,
506
+ ...infer Rest extends readonly AnyAssertion[]
507
+ ] ? MixedAssertion extends AnyAsyncAssertion ? readonly [MixedAssertion, ...FilterAsyncAssertions<Rest>] : FilterAsyncAssertions<Rest> : readonly [];
508
+ /**
509
+ * Given a mixed array of assertions, extracts only the synchronous assertions.
510
+ */
511
+ export type FilterSyncAssertions<MixedAssertions extends readonly AnyAssertion[]> = MixedAssertions extends readonly [
512
+ infer MixedAssertion extends AnyAssertion,
513
+ ...infer Rest extends readonly AnyAssertion[]
514
+ ] ? MixedAssertion extends AnySyncAssertion ? readonly [MixedAssertion, ...FilterSyncAssertions<Rest>] : FilterSyncAssertions<Rest> : readonly [];
515
+ /**
516
+ * Options for test data generation.
517
+ */
518
+ export interface GeneratorOptions {
519
+ /** Whether to include edge cases (NaN, Infinity, etc.) */
520
+ includeEdgeCases?: boolean;
521
+ /** Maximum array size */
522
+ maxArrayLength?: number;
523
+ /** Maximum nesting depth for recursive structures */
524
+ maxDepth?: number;
525
+ /** Maximum object property count */
526
+ maxObjectProperties?: number;
527
+ /** Optional seed for reproducible generation */
528
+ seedValue?: number;
529
+ }
530
+ /**
531
+ * Represents a dot-notation or bracket-notation keypath for accessing nested
532
+ * object properties.
533
+ *
534
+ * @group Utility Types
535
+ */
536
+ export type Keypath<S extends string = string> = S extends `${infer K}.${infer Rest}` ? K extends string ? Rest extends string ? `${K}.${Keypath<Rest>}` : never : never : S extends `${infer K}[${infer Index}]${infer Rest}` ? K extends string ? Index extends `"${string}"` | `${number}` | `'${string}'` ? Rest extends '' ? `${K}[${Index}]` : Rest extends `.${infer RestPath}` ? `${K}[${Index}].${Keypath<RestPath>}` : Rest extends `[${infer NextIndex}]${infer RestPath}` ? `${K}[${Index}][${NextIndex}]${RestPath extends '' ? '' : Keypath<RestPath>}` : never : never : never : S;
537
+ /**
538
+ * Maps `AssertionParts` to the corresponding argument types for `expect` and
539
+ * `expectAsync` functions.
540
+ *
541
+ * This utility type transforms assertion parts into the actual parameter types
542
+ * that users provide when calling expect functions. It handles both phrase
543
+ * literals and Zod schemas, creating appropriate `TypeScript` types for each
544
+ * slot.
545
+ *
546
+ * For phrase literals, it creates union types that include both the original
547
+ * phrase and its negated version (with `"not "` prefix). For Zod schemas, it
548
+ * extracts the inferred type. This enables natural language assertions with
549
+ * optional negation support.
550
+ *
551
+ * @remarks
552
+ * This type works recursively through the parts tuple, transforming each part
553
+ * according to its type. The resulting tuple maintains the same structure as
554
+ * the input but with user-facing `TypeScript` types instead of internal
555
+ * assertion part types.
556
+ * @example
557
+ *
558
+ * ```typescript
559
+ * // Given parts: ['to be a', z.string()]
560
+ * // Results in: ['to be a' | 'not to be a', string]
561
+ * type Slots = MapExpectSlots<['to be a', z.string()]>;
562
+ * // Usage: expect(value, 'to be a', 'hello') or expect(value, 'not to be a', 'hello')
563
+ * ```
564
+ *
565
+ * @template Parts - Tuple of assertion parts to be converted to function
566
+ * parameter types
567
+ * @see {@link SlotsFromParts} for the complete slot transformation including subject injection
568
+ * @see {@link Negation} for how phrase negation is implemented
569
+ */
570
+ export type MapExpectSlots<Parts extends readonly AssertionPart[]> = Parts extends readonly [
571
+ infer First extends AssertionPart,
572
+ ...infer Rest extends readonly AssertionPart[]
573
+ ] ? readonly [
574
+ AssertionSlot<First> extends PhraseLiteralSlot<infer StringLiteral> ? Negation<StringLiteral> | StringLiteral : AssertionSlot<First> extends PhraseLiteralChoiceSlot<infer StringLiterals> ? ArrayValues<StringLiterals> | Negation<ArrayValues<StringLiterals>> : AssertionSlot<First> extends z.ZodType ? z.infer<AssertionSlot<First>> : never,
575
+ ...MapExpectSlots<Rest>
576
+ ] : readonly [];
577
+ /**
578
+ * Makes tuple types accept both mutable and readonly variants.
579
+ *
580
+ * This utility type creates a union of both mutable and readonly versions of a
581
+ * tuple type, providing flexibility for function parameters that should accept
582
+ * either variant. This is particularly useful for assertion function parameters
583
+ * where users may pass either `const` arrays (readonly) or regular arrays.
584
+ *
585
+ * The type handles both array types and specific tuple types, creating
586
+ * appropriate unions for each case to maintain type safety while maximizing
587
+ * usability.
588
+ *
589
+ * @example
590
+ *
591
+ * ```typescript
592
+ * type FlexibleArgs = MutableOrReadonly<readonly [string, number]>;
593
+ * // Results in: [string, number] | readonly [string, number]
594
+ *
595
+ * function acceptArgs(args: FlexibleArgs) { ... }
596
+ * acceptArgs(['hello', 42]); // ✓ mutable array
597
+ * acceptArgs(['hello', 42] as const); // ✓ readonly array
598
+ * ```
599
+ *
600
+ * @template Tuple - The readonly tuple type to make flexible
601
+ * @group Utility Types
602
+ * @see {@link ExpectFunction} and {@link ExpectAsyncFunction} which use this for parameter flexibility
603
+ */
604
+ export type MutableOrReadonly<Tuple extends readonly unknown[]> = Tuple extends readonly (infer Item)[] ? Item[] | readonly Item[] : Tuple extends readonly [infer First, ...infer Rest] ? [First, ...Rest] | readonly [First, ...Rest] : Tuple;
605
+ /**
606
+ * Creates a negated version of a phrase literal by prefixing `"not "`.
607
+ *
608
+ * This utility type transforms assertion phrases into their negated
609
+ * equivalents, enabling the natural language negation feature in <span
610
+ * class="bupkis">BUPKIS</span> assertions. When users provide phrases like
611
+ * `"not to be a string"`, this type helps the system understand and process the
612
+ * negation.
613
+ *
614
+ * The negation is applied at the type level during assertion matching and
615
+ * affects how the assertion logic is executed - negated assertions expect the
616
+ * opposite result.
617
+ *
618
+ * @example
619
+ *
620
+ * ```typescript
621
+ * type Negated = Negation<'to be a string'>; // "not to be a string"
622
+ * type AlsoNegated = Negation<'to equal'>; // "not to equal"
623
+ *
624
+ * // Usage in assertions:
625
+ * expect(42, 'not to be a string'); // Uses negated assertion logic
626
+ * ```
627
+ *
628
+ * @template S - The string literal phrase to be negated
629
+ * @see {@link AddNegation} for applying negation to entire `AssertionParts` tuples
630
+ * @see {@link MapExpectSlots} for how negation is incorporated into function signatures
631
+ */
632
+ export type Negation<S extends string> = `not ${S}`;
633
+ /**
634
+ * Converts `AssertionParts` to complete function parameter types for expect
635
+ * functions.
636
+ *
637
+ * This utility type prepares assertion parts for use as function parameters by
638
+ * applying several transformations:
639
+ *
640
+ * 1. Injects an `unknown` type for the subject parameter if the first part is a
641
+ * phrase literal
642
+ * 2. Maps the remaining parts to their corresponding `TypeScript` types via
643
+ * {@link MapExpectSlots}
644
+ * 3. Filters out `never` types to ensure a clean tuple structure
645
+ *
646
+ * The subject injection is a key feature - when assertions start with phrases
647
+ * like `"to be a string"`, users still need to provide the subject being tested
648
+ * as the first argument to expect functions.
649
+ *
650
+ * @remarks
651
+ * This type is essential for bridging the gap between assertion definitions and
652
+ * user-facing function signatures. The subject injection ensures that all
653
+ * assertions have a consistent calling pattern regardless of whether they
654
+ * explicitly define a subject parameter.
655
+ * @example
656
+ *
657
+ * ```typescript
658
+ * // Assertion parts: ['to equal', z.string()]
659
+ * // Results in: [unknown, 'to equal' | 'not to equal', string]
660
+ * type Slots = SlotsFromParts<['to equal', z.string()]>;
661
+ *
662
+ * // Usage: expect(subject, 'to equal', 'expected')
663
+ * // expect(subject, 'not to equal', 'unexpected')
664
+ * ```
665
+ *
666
+ * @template Parts - Tuple of assertion parts that define the assertion
667
+ * structure
668
+ * @group Expect-Related
669
+ * @see {@link MapExpectSlots} for the core slot mapping logic
670
+ * @see {@link NoNeverTuple} for never-type filtering
671
+ */
672
+ export type SlotsFromParts<Parts extends AssertionParts> = NoNeverTuple<Parts extends readonly [infer First extends AssertionPart, ...infer _] ? First extends PhraseLiteral | PhraseLiteralChoice ? [unknown, ...MapExpectSlots<Parts>] : MapExpectSlots<Parts> : never>;
673
+ /**
674
+ * Gets the tail (all elements except the first) of a tuple type.
675
+ *
676
+ * Unlike ArrayTail from type-fest, this preserves the tuple structure as a
677
+ * readonly tuple rather than converting to an array type.
678
+ *
679
+ * @example
680
+ *
681
+ * ```typescript
682
+ * type Example = TupleTail<readonly [string, number, boolean]>; // readonly [number, boolean]
683
+ * type Single = TupleTail<readonly [string]>; // readonly []
684
+ * type Empty = TupleTail<readonly []>; // readonly []
685
+ * ```
686
+ *
687
+ * @template T - The tuple type to get the tail of
688
+ * @group Utility Types
689
+ */
690
+ export type TupleTail<T extends readonly unknown[]> = T extends readonly [
691
+ unknown,
692
+ ...infer Rest
693
+ ] ? Rest : readonly [];
694
+ /**
695
+ * The type of a `use()` function.
696
+ *
697
+ * @group Core API
698
+ */
699
+ export interface UseFn<BaseSyncAssertions extends AnySyncAssertions, BaseAsyncAssertions extends AnyAsyncAssertions> {
700
+ /**
701
+ * @template MixedAssertions Mixed set of assertions to add; may include both
702
+ * sync and async assertions
703
+ * @template ExtendedSyncAssertions Synchronous assertions extracted from
704
+ * `MixedAssertions`
705
+ * @template ExtendedAsyncAssertions Asynchronous assertions extracted from
706
+ * `MixedAssertions`
707
+ * @param assertions Array of assertion classes to add
708
+ * @returns New {@link expect} and {@link expectAsync} functions with the
709
+ * combined assertions
710
+ */
711
+ <MixedAssertions extends readonly AnyAssertion[], ExtendedSyncAssertions extends FilterSyncAssertions<MixedAssertions>, ExtendedAsyncAssertions extends FilterAsyncAssertions<MixedAssertions>>(assertions: MixedAssertions): Bupkis<BaseSyncAssertions, BaseAsyncAssertions, ExtendedSyncAssertions, ExtendedAsyncAssertions>;
712
+ }
713
+ /**
714
+ * Maps Zod `def.type` strings to their corresponding `ZodType` classes.
715
+ *
716
+ * This allows for type-safe discrimination of `ZodType`s based on their
717
+ * internal `def.type` property in Zod v4.
718
+ *
719
+ * @group Utility Types
720
+ */
721
+ export interface ZodTypeMap {
722
+ any: z.ZodAny;
723
+ array: z.ZodArray;
724
+ bigint: z.ZodBigInt;
725
+ boolean: z.ZodBoolean;
726
+ catch: z.ZodCatch;
727
+ custom: z.ZodCustom;
728
+ date: z.ZodDate;
729
+ default: z.ZodDefault;
730
+ enum: z.ZodEnum;
731
+ function: z.ZodFunction;
732
+ intersection: z.ZodIntersection;
733
+ lazy: z.ZodLazy;
734
+ literal: z.ZodLiteral;
735
+ map: z.ZodMap;
736
+ never: z.ZodNever;
737
+ nonoptional: z.ZodNonOptional;
738
+ null: z.ZodNull;
739
+ nullable: z.ZodNullable;
740
+ number: z.ZodNumber;
741
+ object: z.ZodObject;
742
+ optional: z.ZodOptional;
743
+ pipe: z.ZodPipe;
744
+ promise: z.ZodPromise;
745
+ readonly: z.ZodReadonly;
746
+ record: z.ZodRecord;
747
+ set: z.ZodSet;
748
+ string: z.ZodString;
749
+ symbol: z.ZodSymbol;
750
+ tuple: z.ZodTuple;
751
+ undefined: z.ZodUndefined;
752
+ union: z.ZodUnion;
753
+ unknown: z.ZodUnknown;
754
+ void: z.ZodVoid;
755
+ }
756
+ //# sourceMappingURL=types.d.ts.map