@voidzero-dev/vite-plus-test 0.0.0-0bfcc90f.20260209-0731

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 (318) hide show
  1. package/LICENSE.md +691 -0
  2. package/browser/context.d.ts +4 -0
  3. package/browser/context.js +20 -0
  4. package/config.d.ts +3 -0
  5. package/coverage.d.ts +1 -0
  6. package/dist/@vitest/browser/client/.vite/manifest.json +24 -0
  7. package/dist/@vitest/browser/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  8. package/dist/@vitest/browser/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  9. package/dist/@vitest/browser/client/__vitest__/bg.png +0 -0
  10. package/dist/@vitest/browser/client/__vitest__/favicon.ico +0 -0
  11. package/dist/@vitest/browser/client/__vitest__/favicon.svg +5 -0
  12. package/dist/@vitest/browser/client/__vitest__/index.html +32 -0
  13. package/dist/@vitest/browser/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  14. package/dist/@vitest/browser/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  15. package/dist/@vitest/browser/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  16. package/dist/@vitest/browser/client/error-catcher.js +82 -0
  17. package/dist/@vitest/browser/client/esm-client-injector.js +67 -0
  18. package/dist/@vitest/browser/client/favicon.svg +5 -0
  19. package/dist/@vitest/browser/client/orchestrator.html +35 -0
  20. package/dist/@vitest/browser/client/tester/tester.html +13 -0
  21. package/dist/@vitest/browser/client.js +456 -0
  22. package/dist/@vitest/browser/context.d.ts +792 -0
  23. package/dist/@vitest/browser/context.js +541 -0
  24. package/dist/@vitest/browser/expect-element.js +32 -0
  25. package/dist/@vitest/browser/index-D6m36C6U.js +11 -0
  26. package/dist/@vitest/browser/index.d.ts +73 -0
  27. package/dist/@vitest/browser/index.js +3513 -0
  28. package/dist/@vitest/browser/jest-dom.d.ts +724 -0
  29. package/dist/@vitest/browser/locators.d.ts +354 -0
  30. package/dist/@vitest/browser/locators.js +1 -0
  31. package/dist/@vitest/browser/matchers.d.ts +29 -0
  32. package/dist/@vitest/browser/shared/screenshotMatcher/types.d.ts +22 -0
  33. package/dist/@vitest/browser/state.js +280 -0
  34. package/dist/@vitest/browser/types.d.ts +69 -0
  35. package/dist/@vitest/browser-playwright/context.d.ts +1 -0
  36. package/dist/@vitest/browser-playwright/index.d.ts +106 -0
  37. package/dist/@vitest/browser-playwright/index.js +1111 -0
  38. package/dist/@vitest/browser-playwright/locators.js +114 -0
  39. package/dist/@vitest/browser-preview/context.d.ts +1 -0
  40. package/dist/@vitest/browser-preview/index.d.ts +19 -0
  41. package/dist/@vitest/browser-preview/index.js +148 -0
  42. package/dist/@vitest/browser-preview/locators.js +79 -0
  43. package/dist/@vitest/browser-webdriverio/context.d.ts +1 -0
  44. package/dist/@vitest/browser-webdriverio/index.d.ts +63 -0
  45. package/dist/@vitest/browser-webdriverio/index.js +600 -0
  46. package/dist/@vitest/browser-webdriverio/locators.js +163 -0
  47. package/dist/@vitest/expect/index.d.ts +807 -0
  48. package/dist/@vitest/expect/index.js +1875 -0
  49. package/dist/@vitest/mocker/auto-register.d.ts +2 -0
  50. package/dist/@vitest/mocker/auto-register.js +9 -0
  51. package/dist/@vitest/mocker/automock.d.ts +12 -0
  52. package/dist/@vitest/mocker/automock.js +1 -0
  53. package/dist/@vitest/mocker/browser.d.ts +53 -0
  54. package/dist/@vitest/mocker/browser.js +91 -0
  55. package/dist/@vitest/mocker/chunk-automock.js +354 -0
  56. package/dist/@vitest/mocker/chunk-interceptor-native.js +15 -0
  57. package/dist/@vitest/mocker/chunk-mocker.js +521 -0
  58. package/dist/@vitest/mocker/chunk-pathe.M-eThtNZ.js +174 -0
  59. package/dist/@vitest/mocker/chunk-registry.js +185 -0
  60. package/dist/@vitest/mocker/chunk-utils.js +16 -0
  61. package/dist/@vitest/mocker/index.d-C-sLYZi-.d.ts +25 -0
  62. package/dist/@vitest/mocker/index.d.ts +2 -0
  63. package/dist/@vitest/mocker/index.js +185 -0
  64. package/dist/@vitest/mocker/mocker.d-TnKRhz7N.d.ts +81 -0
  65. package/dist/@vitest/mocker/node.d.ts +800 -0
  66. package/dist/@vitest/mocker/node.js +966 -0
  67. package/dist/@vitest/mocker/redirect.d.ts +3 -0
  68. package/dist/@vitest/mocker/redirect.js +79 -0
  69. package/dist/@vitest/mocker/register.d.ts +9 -0
  70. package/dist/@vitest/mocker/register.js +41 -0
  71. package/dist/@vitest/mocker/types.d-B8CCKmHt.d.ts +107 -0
  72. package/dist/@vitest/pretty-format/index.d.ts +124 -0
  73. package/dist/@vitest/pretty-format/index.js +1022 -0
  74. package/dist/@vitest/runner/chunk-tasks.js +340 -0
  75. package/dist/@vitest/runner/index.d.ts +180 -0
  76. package/dist/@vitest/runner/index.js +2114 -0
  77. package/dist/@vitest/runner/tasks.d-C7UxawJ9.d.ts +834 -0
  78. package/dist/@vitest/runner/types.d.ts +183 -0
  79. package/dist/@vitest/runner/types.js +1 -0
  80. package/dist/@vitest/runner/utils.d.ts +45 -0
  81. package/dist/@vitest/runner/utils.js +5 -0
  82. package/dist/@vitest/snapshot/environment.d-DHdQ1Csl.d.ts +22 -0
  83. package/dist/@vitest/snapshot/environment.d.ts +16 -0
  84. package/dist/@vitest/snapshot/environment.js +40 -0
  85. package/dist/@vitest/snapshot/index.d.ts +130 -0
  86. package/dist/@vitest/snapshot/index.js +1437 -0
  87. package/dist/@vitest/snapshot/manager.d.ts +18 -0
  88. package/dist/@vitest/snapshot/manager.js +73 -0
  89. package/dist/@vitest/snapshot/rawSnapshot.d-lFsMJFUd.d.ts +61 -0
  90. package/dist/@vitest/spy/index.d.ts +384 -0
  91. package/dist/@vitest/spy/index.js +433 -0
  92. package/dist/@vitest/utils/chunk-_commonjsHelpers.js +5 -0
  93. package/dist/@vitest/utils/chunk-pathe.M-eThtNZ.js +156 -0
  94. package/dist/@vitest/utils/constants.d.ts +21 -0
  95. package/dist/@vitest/utils/constants.js +49 -0
  96. package/dist/@vitest/utils/diff.d.ts +93 -0
  97. package/dist/@vitest/utils/diff.js +2199 -0
  98. package/dist/@vitest/utils/display.d.ts +29 -0
  99. package/dist/@vitest/utils/display.js +742 -0
  100. package/dist/@vitest/utils/error.d.ts +7 -0
  101. package/dist/@vitest/utils/error.js +42 -0
  102. package/dist/@vitest/utils/helpers.d.ts +73 -0
  103. package/dist/@vitest/utils/helpers.js +295 -0
  104. package/dist/@vitest/utils/highlight.d.ts +9 -0
  105. package/dist/@vitest/utils/highlight.js +538 -0
  106. package/dist/@vitest/utils/index.d.ts +5 -0
  107. package/dist/@vitest/utils/index.js +1 -0
  108. package/dist/@vitest/utils/offset.d.ts +5 -0
  109. package/dist/@vitest/utils/offset.js +32 -0
  110. package/dist/@vitest/utils/resolver.d.ts +7 -0
  111. package/dist/@vitest/utils/resolver.js +71 -0
  112. package/dist/@vitest/utils/serialize.d.ts +3 -0
  113. package/dist/@vitest/utils/serialize.js +118 -0
  114. package/dist/@vitest/utils/source-map.d.ts +55 -0
  115. package/dist/@vitest/utils/source-map.js +478 -0
  116. package/dist/@vitest/utils/timers.d.ts +33 -0
  117. package/dist/@vitest/utils/timers.js +49 -0
  118. package/dist/@vitest/utils/types.d-BCElaP-c.d.ts +53 -0
  119. package/dist/@vitest/utils/types.d.ts +34 -0
  120. package/dist/@vitest/utils/types.js +1 -0
  121. package/dist/browser-compat.js +3 -0
  122. package/dist/browser.d.ts +46 -0
  123. package/dist/browser.js +20 -0
  124. package/dist/chunks/_commonjsHelpers.D26ty3Ew.js +6 -0
  125. package/dist/chunks/base.CJ0Y4ePK.js +165 -0
  126. package/dist/chunks/benchmark.B3N2zMcH.js +40 -0
  127. package/dist/chunks/benchmark.d.DAaHLpsq.d.ts +24 -0
  128. package/dist/chunks/browser.d.ChKACdzH.d.ts +59 -0
  129. package/dist/chunks/cac.DVeoLl0M.js +1409 -0
  130. package/dist/chunks/cli-api.B7PN_QUv.js +13672 -0
  131. package/dist/chunks/config.d.Cy95HiCx.d.ts +210 -0
  132. package/dist/chunks/console.Cf-YriPC.js +146 -0
  133. package/dist/chunks/constants.D_Q9UYh-.js +36 -0
  134. package/dist/chunks/coverage.AVPTjMgw.js +3292 -0
  135. package/dist/chunks/coverage.D_JHT54q.js +25 -0
  136. package/dist/chunks/coverage.d.BZtK59WP.d.ts +37 -0
  137. package/dist/chunks/creator.DAmOKTvJ.js +673 -0
  138. package/dist/chunks/date.Bq6ZW5rf.js +73 -0
  139. package/dist/chunks/defaults.BOqNVLsY.js +74 -0
  140. package/dist/chunks/env.D4Lgay0q.js +8 -0
  141. package/dist/chunks/environment.d.CrsxCzP1.d.ts +29 -0
  142. package/dist/chunks/evaluatedModules.Dg1zASAC.js +17 -0
  143. package/dist/chunks/evaluatedModules.d.BxJ5omdx.d.ts +7 -0
  144. package/dist/chunks/git.Bm2pzPAa.js +71 -0
  145. package/dist/chunks/global.d.B15mdLcR.d.ts +99 -0
  146. package/dist/chunks/globals.DOayXfHP.js +30 -0
  147. package/dist/chunks/index.6Qv1eEA6.js +109 -0
  148. package/dist/chunks/index.C5r1PdPD.js +231 -0
  149. package/dist/chunks/index.Chj8NDwU.js +206 -0
  150. package/dist/chunks/index.CyBMJtT7.js +727 -0
  151. package/dist/chunks/index.D3XRDfWc.js +213 -0
  152. package/dist/chunks/index.D4KonVSU.js +6343 -0
  153. package/dist/chunks/index.M8mOzt4Y.js +3839 -0
  154. package/dist/chunks/index.Z5E_ObnR.js +37 -0
  155. package/dist/chunks/init-forks._y3TW739.js +41 -0
  156. package/dist/chunks/init-threads.DBO2kn-p.js +18 -0
  157. package/dist/chunks/init.B6MLFIaN.js +334 -0
  158. package/dist/chunks/inspector.CvyFGlXm.js +53 -0
  159. package/dist/chunks/modules.BJuCwlRJ.js +36 -0
  160. package/dist/chunks/node.Ce0vMQM7.js +14 -0
  161. package/dist/chunks/plugin.d.CtqpEehP.d.ts +38 -0
  162. package/dist/chunks/reporters.d.CWXNI2jG.d.ts +3271 -0
  163. package/dist/chunks/rpc.BoxB0q7B.js +76 -0
  164. package/dist/chunks/rpc.d.RH3apGEf.d.ts +64 -0
  165. package/dist/chunks/setup-common.Cm-kSBVi.js +60 -0
  166. package/dist/chunks/startModuleRunner.DEj0jb3e.js +861 -0
  167. package/dist/chunks/suite.d.BJWk38HB.d.ts +10 -0
  168. package/dist/chunks/test.B8ej_ZHS.js +254 -0
  169. package/dist/chunks/traces.CCmnQaNT.js +217 -0
  170. package/dist/chunks/traces.d.402V_yFI.d.ts +18 -0
  171. package/dist/chunks/utils.DvEY5TfP.js +52 -0
  172. package/dist/chunks/vi.2VT5v0um.js +3919 -0
  173. package/dist/chunks/vm.D3epNOPZ.js +744 -0
  174. package/dist/chunks/worker.d.Dyxm8DEL.d.ts +255 -0
  175. package/dist/cli.js +28 -0
  176. package/dist/client/.vite/manifest.json +24 -0
  177. package/dist/client/__vitest__/assets/index-BUCFJtth.js +57 -0
  178. package/dist/client/__vitest__/assets/index-DlhE0rqZ.css +1 -0
  179. package/dist/client/__vitest__/bg.png +0 -0
  180. package/dist/client/__vitest__/favicon.ico +0 -0
  181. package/dist/client/__vitest__/favicon.svg +5 -0
  182. package/dist/client/__vitest__/index.html +32 -0
  183. package/dist/client/__vitest_browser__/orchestrator-S_3e_uzt.js +345 -0
  184. package/dist/client/__vitest_browser__/tester-k74mgIRa.js +2171 -0
  185. package/dist/client/__vitest_browser__/utils-uxqdqUz8.js +223 -0
  186. package/dist/client/error-catcher.js +82 -0
  187. package/dist/client/esm-client-injector.js +67 -0
  188. package/dist/client/favicon.svg +5 -0
  189. package/dist/client/orchestrator.html +35 -0
  190. package/dist/client/tester/tester.html +13 -0
  191. package/dist/client.js +456 -0
  192. package/dist/config.cjs +94 -0
  193. package/dist/config.d.ts +104 -0
  194. package/dist/config.js +15 -0
  195. package/dist/context.js +541 -0
  196. package/dist/coverage.d.ts +118 -0
  197. package/dist/coverage.js +23 -0
  198. package/dist/dummy.js +2 -0
  199. package/dist/environments.d.ts +22 -0
  200. package/dist/environments.js +3 -0
  201. package/dist/expect-element.js +27 -0
  202. package/dist/index-D6m36C6U.js +6 -0
  203. package/dist/index-node.js +7 -0
  204. package/dist/index.d.ts +510 -0
  205. package/dist/index.js +19 -0
  206. package/dist/locators.d.ts +354 -0
  207. package/dist/locators.js +1 -0
  208. package/dist/mocker.d.ts +1 -0
  209. package/dist/mocker.js +1 -0
  210. package/dist/module-evaluator.d.ts +124 -0
  211. package/dist/module-evaluator.js +343 -0
  212. package/dist/module-runner-stub.js +44 -0
  213. package/dist/module-runner.js +17 -0
  214. package/dist/node.d.ts +251 -0
  215. package/dist/node.js +98 -0
  216. package/dist/path.js +7 -0
  217. package/dist/plugins/browser-client.mjs +2 -0
  218. package/dist/plugins/browser-context.mjs +2 -0
  219. package/dist/plugins/browser-locators.mjs +2 -0
  220. package/dist/plugins/browser-playwright.mjs +2 -0
  221. package/dist/plugins/browser-preview.mjs +2 -0
  222. package/dist/plugins/browser-webdriverio.mjs +2 -0
  223. package/dist/plugins/browser.mjs +2 -0
  224. package/dist/plugins/expect.mjs +2 -0
  225. package/dist/plugins/mocker-automock.mjs +2 -0
  226. package/dist/plugins/mocker-browser.mjs +2 -0
  227. package/dist/plugins/mocker-node.mjs +2 -0
  228. package/dist/plugins/mocker-redirect.mjs +2 -0
  229. package/dist/plugins/mocker-register.mjs +2 -0
  230. package/dist/plugins/mocker.mjs +2 -0
  231. package/dist/plugins/pretty-format.mjs +2 -0
  232. package/dist/plugins/runner-types.mjs +2 -0
  233. package/dist/plugins/runner-utils.mjs +2 -0
  234. package/dist/plugins/runner.mjs +2 -0
  235. package/dist/plugins/snapshot-environment.mjs +2 -0
  236. package/dist/plugins/snapshot-manager.mjs +2 -0
  237. package/dist/plugins/snapshot.mjs +2 -0
  238. package/dist/plugins/spy.mjs +2 -0
  239. package/dist/plugins/utils-constants.mjs +2 -0
  240. package/dist/plugins/utils-diff.mjs +2 -0
  241. package/dist/plugins/utils-display.mjs +2 -0
  242. package/dist/plugins/utils-error.mjs +2 -0
  243. package/dist/plugins/utils-helpers.mjs +2 -0
  244. package/dist/plugins/utils-highlight.mjs +2 -0
  245. package/dist/plugins/utils-offset.mjs +2 -0
  246. package/dist/plugins/utils-resolver.mjs +2 -0
  247. package/dist/plugins/utils-serialize.mjs +2 -0
  248. package/dist/plugins/utils-source-map.mjs +2 -0
  249. package/dist/plugins/utils-timers.mjs +2 -0
  250. package/dist/plugins/utils.mjs +2 -0
  251. package/dist/reporters.d.ts +27 -0
  252. package/dist/reporters.js +24 -0
  253. package/dist/runners.d.ts +50 -0
  254. package/dist/runners.js +19 -0
  255. package/dist/shared/screenshotMatcher/types.d.ts +22 -0
  256. package/dist/snapshot.d.ts +9 -0
  257. package/dist/snapshot.js +4 -0
  258. package/dist/spy.js +1 -0
  259. package/dist/state.js +280 -0
  260. package/dist/suite.d.ts +5 -0
  261. package/dist/suite.js +6 -0
  262. package/dist/types.d.ts +69 -0
  263. package/dist/vendor/chai.d.mts +1 -0
  264. package/dist/vendor/chai.mjs +3577 -0
  265. package/dist/vendor/es-module-lexer.d.mts +193 -0
  266. package/dist/vendor/es-module-lexer.mjs +79 -0
  267. package/dist/vendor/estree-walker.d.mts +583 -0
  268. package/dist/vendor/estree-walker.mjs +339 -0
  269. package/dist/vendor/expect-type.d.mts +1574 -0
  270. package/dist/vendor/expect-type.mjs +214 -0
  271. package/dist/vendor/magic-string.d.mts +261 -0
  272. package/dist/vendor/magic-string.mjs +1700 -0
  273. package/dist/vendor/obug.d.mts +56 -0
  274. package/dist/vendor/obug.mjs +276 -0
  275. package/dist/vendor/pathe.d.mts +46 -0
  276. package/dist/vendor/pathe.mjs +496 -0
  277. package/dist/vendor/picomatch.d.mts +1 -0
  278. package/dist/vendor/picomatch.mjs +1855 -0
  279. package/dist/vendor/shared-3g9mwCWP.mjs +31 -0
  280. package/dist/vendor/std-env.d.mts +88 -0
  281. package/dist/vendor/std-env.mjs +159 -0
  282. package/dist/vendor/tinybench.d.mts +317 -0
  283. package/dist/vendor/tinybench.mjs +504 -0
  284. package/dist/vendor/tinyexec.d.mts +72 -0
  285. package/dist/vendor/tinyexec.mjs +637 -0
  286. package/dist/vendor/tinyglobby.d.mts +157 -0
  287. package/dist/vendor/tinyglobby.mjs +832 -0
  288. package/dist/vendor/tinyrainbow.d.mts +60 -0
  289. package/dist/vendor/tinyrainbow.mjs +93 -0
  290. package/dist/vendor/vitest_browser.mjs +2 -0
  291. package/dist/vendor/vitest_internal_browser.mjs +2 -0
  292. package/dist/vendor/vitest_runner.mjs +2 -0
  293. package/dist/vendor/vitest_runners.mjs +2 -0
  294. package/dist/worker.d.ts +32 -0
  295. package/dist/worker.js +48 -0
  296. package/dist/workers/forks.js +54 -0
  297. package/dist/workers/runVmTests.js +95 -0
  298. package/dist/workers/threads.js +55 -0
  299. package/dist/workers/vmForks.js +36 -0
  300. package/dist/workers/vmThreads.js +37 -0
  301. package/environments.d.ts +1 -0
  302. package/globals.d.ts +20 -0
  303. package/import-meta.d.ts +5 -0
  304. package/importMeta.d.ts +4 -0
  305. package/index.cjs +5 -0
  306. package/index.d.cts +1 -0
  307. package/jsdom.d.ts +6 -0
  308. package/mocker.d.ts +1 -0
  309. package/node.d.ts +1 -0
  310. package/optional-types.d.ts +7 -0
  311. package/package.json +335 -0
  312. package/reporters.d.ts +1 -0
  313. package/runners.d.ts +1 -0
  314. package/snapshot.d.ts +1 -0
  315. package/suite.d.ts +1 -0
  316. package/suppress-warnings.cjs +21 -0
  317. package/vitest.mjs +2 -0
  318. package/worker.d.ts +1 -0
@@ -0,0 +1,1574 @@
1
+ //#region ../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/utils.d.ts
2
+ /**
3
+ * Negates a boolean type.
4
+ */
5
+ type Not<T extends boolean> = T extends true ? false : true;
6
+ /**
7
+ * Returns `true` if at least one of the types in the
8
+ * {@linkcode Types} array is `true`, otherwise returns `false`.
9
+ */
10
+ type Or<Types extends boolean[]> = Types[number] extends false ? false : true;
11
+ /**
12
+ * Checks if all the boolean types in the {@linkcode Types} array are `true`.
13
+ */
14
+ type And<Types extends boolean[]> = Types[number] extends true ? true : false;
15
+ /**
16
+ * Represents an equality type that returns {@linkcode Right} if
17
+ * {@linkcode Left} is `true`,
18
+ * otherwise returns the negation of {@linkcode Right}.
19
+ */
20
+ type Eq<Left extends boolean, Right extends boolean> = Left extends true ? Right : Not<Right>;
21
+ /**
22
+ * Represents the exclusive OR operation on a tuple of boolean types.
23
+ * Returns `true` if exactly one of the boolean types is `true`,
24
+ * otherwise returns `false`.
25
+ */
26
+ type Xor<Types extends [boolean, boolean]> = Not<Eq<Types[0], Types[1]>>;
27
+ /**
28
+ * @internal
29
+ */
30
+ declare const secret: unique symbol;
31
+ /**
32
+ * @internal
33
+ */
34
+ type Secret = typeof secret;
35
+ /**
36
+ * Checks if the given type is `never`.
37
+ */
38
+ type IsNever<T> = [T] extends [never] ? true : false;
39
+ /**
40
+ * Checks if the given type is `any`.
41
+ */
42
+ type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;
43
+ /**
44
+ * Determines if the given type is `unknown`.
45
+ */
46
+ type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;
47
+ /**
48
+ * Determines if a type is either `never` or `any`.
49
+ */
50
+ type IsNeverOrAny<T> = Or<[IsNever<T>, IsAny<T>]>;
51
+ /**
52
+ * Subjective "useful" keys from a type. For objects it's just `keyof` but for
53
+ * tuples/arrays it's the number keys.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * UsefulKeys<{ a: 1; b: 2 }> // 'a' | 'b'
58
+ *
59
+ * UsefulKeys<['a', 'b']> // '0' | '1'
60
+ *
61
+ * UsefulKeys<string[]> // number
62
+ * ```
63
+ */
64
+ type UsefulKeys<T> = T extends any[] ? { [K in keyof T]: K }[number] : keyof T;
65
+ /**
66
+ * Extracts the keys from a type that are required (not optional).
67
+ */
68
+ type RequiredKeys<T> = Extract<{ [K in keyof T]-?: {} extends Pick<T, K> ? never : K }[keyof T], keyof T>;
69
+ /**
70
+ * Gets the keys of an object type that are optional.
71
+ */
72
+ type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
73
+ /**
74
+ * Extracts the keys from a type that are not `readonly`.
75
+ */
76
+ type ReadonlyKeys<T> = Extract<{ [K in keyof T]-?: ReadonlyEquivalent<{ [_K in K]: T[K] }, { -readonly [_K in K]: T[K] }> extends true ? never : K }[keyof T], keyof T>;
77
+ /**
78
+ * Determines if two types, are equivalent in a `readonly` manner.
79
+ *
80
+ * @internal
81
+ */
82
+ type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>;
83
+ /**
84
+ * Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because:
85
+ * 1. If either type is `never`, the result is `true` iff the other type is also `never`.
86
+ * 2. Types are wrapped in a 1-tuple so that union types are not distributed - instead we consider `string | number` to _not_ extend `number`. If we used `Left extends Right` directly you would get `Extends<string | number, number>` => `false | true` => `boolean`.
87
+ */
88
+ type Extends<Left, Right> = IsNever<Left> extends true ? IsNever<Right> : [Left] extends [Right] ? true : false;
89
+ /**
90
+ * Checks if the {@linkcode Left} type extends the {@linkcode Right} type,
91
+ * excluding `any` or `never`.
92
+ */
93
+ type ExtendsExcludingAnyOrNever<Left, Right> = IsAny<Left> extends true ? IsAny<Right> : Extends<Left, Right>;
94
+ /**
95
+ * Checks if two types are strictly equal using
96
+ * the TypeScript internal identical-to operator.
97
+ *
98
+ * @see {@link https://github.com/microsoft/TypeScript/issues/55188#issuecomment-1656328122 | much history}
99
+ */
100
+ type StrictEqualUsingTSInternalIdenticalToOperator<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends (<T>() => T extends (R & T) | T ? true : false) ? IsNever<L> extends IsNever<R> ? true : false : false;
101
+ /**
102
+ * Checks that {@linkcode Left} and {@linkcode Right} extend each other.
103
+ * Not quite the same as an equality check since `any` can make it resolve
104
+ * to `true`. So should only be used when {@linkcode Left} and
105
+ * {@linkcode Right} are known to avoid `any`.
106
+ */
107
+ type MutuallyExtends<Left, Right> = And<[Extends<Left, Right>, Extends<Right, Left>]>;
108
+ /**
109
+ * @internal
110
+ */
111
+ declare const mismatch: unique symbol;
112
+ /**
113
+ * @internal
114
+ */
115
+ type Mismatch = {
116
+ [mismatch]: 'mismatch';
117
+ };
118
+ /**
119
+ * A type which should match anything passed as a value but *doesn't*
120
+ * match {@linkcode Mismatch}. It helps TypeScript select the right overload
121
+ * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and
122
+ * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}.
123
+ *
124
+ * @internal
125
+ */
126
+ declare const avalue: unique symbol;
127
+ /**
128
+ * Represents a value that can be of various types.
129
+ */
130
+ type AValue = {
131
+ [avalue]?: undefined;
132
+ } | string | number | boolean | symbol | bigint | null | undefined | void;
133
+ /**
134
+ * Represents the type of mismatched arguments between
135
+ * the actual result and the expected result.
136
+ *
137
+ * If {@linkcode ActualResult} and {@linkcode ExpectedResult} are equivalent,
138
+ * the type resolves to an empty tuple `[]`, indicating no mismatch.
139
+ * If they are not equivalent, it resolves to a tuple containing the element
140
+ * {@linkcode Mismatch}, signifying a discrepancy between
141
+ * the expected and actual results.
142
+ */
143
+ type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch];
144
+ /**
145
+ * Represents the options for the {@linkcode ExpectTypeOf} function.
146
+ */
147
+ interface ExpectTypeOfOptions {
148
+ positive: boolean;
149
+ branded: boolean;
150
+ }
151
+ /**
152
+ * Convert a union to an intersection.
153
+ * `A | B | C` -\> `A & B & C`
154
+ */
155
+ type UnionToIntersection<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends ((mergedIntersection: infer Intersection) => void) ? Intersection : never;
156
+ /**
157
+ * Get the last element of a union.
158
+ * First, converts to a union of `() => T` functions,
159
+ * then uses {@linkcode UnionToIntersection} to get the last one.
160
+ */
161
+ type LastOf<Union> = UnionToIntersection<Union extends any ? () => Union : never> extends (() => infer R) ? R : never;
162
+ /**
163
+ * Intermediate type for {@linkcode UnionToTuple} which pushes the
164
+ * "last" union member to the end of a tuple, and recursively prepends
165
+ * the remainder of the union.
166
+ */
167
+ type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends true ? [] : [...TuplifyUnion<Exclude<Union, LastElement>>, LastElement];
168
+ /**
169
+ * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
170
+ */
171
+ type UnionToTuple<Union> = TuplifyUnion<Union>;
172
+ type IsTuple<T> = Or<[Extends<T, []>, Extends<T, [any, ...any[]]>]>;
173
+ type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>;
174
+ /**
175
+ * A recursive version of `Pick` that selects properties from the left type that are present in the right type.
176
+ * The "leaf" types from `Left` are used - only the keys of `Right` are considered.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const user = {email: 'a@b.com', name: 'John Doe', address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}}
181
+ *
182
+ * type Result = DeepPickMatchingProps<typeof user, {name: unknown; address: {city: unknown}}> // {name: string, address: {city: string}}
183
+ * ```
184
+ */
185
+ type DeepPickMatchingProps<Left, Right> = Left extends Record<string, unknown> ? Pick<{ [K in keyof Left]: K extends keyof Right ? DeepPickMatchingProps<Left[K], Right[K]> : never }, Extract<keyof Left, keyof Right>> : Left;
186
+ //#endregion
187
+ //#region ../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/overloads.d.ts
188
+ /**
189
+ * The simple(ish) way to get overload info from a function
190
+ * {@linkcode FunctionType}. Recent versions of TypeScript will match any
191
+ * function against a generic 10-overload type, filling in slots with
192
+ * duplicates of the function. So, we can just match against a single type
193
+ * and get all the overloads.
194
+ *
195
+ * For older versions of TypeScript, we'll need to painstakingly do
196
+ * ten separate matches.
197
+ */
198
+ type TSPost53OverloadsInfoUnion<FunctionType> = FunctionType extends {
199
+ (...args: infer A1): infer R1;
200
+ (...args: infer A2): infer R2;
201
+ (...args: infer A3): infer R3;
202
+ (...args: infer A4): infer R4;
203
+ (...args: infer A5): infer R5;
204
+ (...args: infer A6): infer R6;
205
+ (...args: infer A7): infer R7;
206
+ (...args: infer A8): infer R8;
207
+ (...args: infer A9): infer R9;
208
+ (...args: infer A10): infer R10;
209
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : never;
210
+ /**
211
+ * A function with `unknown` parameters and return type.
212
+ */
213
+ type UnknownFunction = (...args: unknown[]) => unknown;
214
+ /**
215
+ * `true` iff {@linkcode FunctionType} is
216
+ * equivalent to `(...args: unknown[]) => unknown`,
217
+ * which is what an overload variant looks like for a non-existent overload.
218
+ * This is useful because older versions of TypeScript end up with
219
+ * 9 "useless" overloads and one real one for parameterless/generic functions.
220
+ *
221
+ * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
222
+ */
223
+ type IsUselessOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownFunction>;
224
+ /**
225
+ * Old versions of TypeScript can sometimes seem to refuse to separate out
226
+ * union members unless you put them each in a pointless tuple and add an
227
+ * extra `infer X` expression. There may be a better way to work around this
228
+ * problem, but since it's not a problem in newer versions of TypeScript,
229
+ * it's not a priority right now.
230
+ */
231
+ type Tuplify<Union> = Union extends infer X ? [X] : never;
232
+ /**
233
+ * For older versions of TypeScript, we need two separate workarounds
234
+ * to get overload info. First, we need need to use
235
+ * {@linkcode DecreasingOverloadsInfoUnion} to get the overload info for
236
+ * functions with 1-10 overloads. Then, we need to filter out the
237
+ * "useless" overloads that are present in older versions of TypeScript,
238
+ * for parameterless functions. To do this we use
239
+ * {@linkcode IsUselessOverloadInfo} to remove useless overloads.
240
+ *
241
+ * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
242
+ */
243
+ type TSPre53OverloadsInfoUnion<FunctionType> = Tuplify<DecreasingOverloadsInfoUnion<FunctionType>> extends infer Tup ? Tup extends [infer Fn] ? IsUselessOverloadInfo<Fn> extends true ? never : Fn : never : never;
244
+ /**
245
+ * For versions of TypeScript below 5.3, we need to check for 10 overloads,
246
+ * then 9, then 8, etc., to get a union of the overload variants.
247
+ */
248
+ type DecreasingOverloadsInfoUnion<F> = F extends {
249
+ (...args: infer A1): infer R1;
250
+ (...args: infer A2): infer R2;
251
+ (...args: infer A3): infer R3;
252
+ (...args: infer A4): infer R4;
253
+ (...args: infer A5): infer R5;
254
+ (...args: infer A6): infer R6;
255
+ (...args: infer A7): infer R7;
256
+ (...args: infer A8): infer R8;
257
+ (...args: infer A9): infer R9;
258
+ (...args: infer A10): infer R10;
259
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : F extends {
260
+ (...args: infer A1): infer R1;
261
+ (...args: infer A2): infer R2;
262
+ (...args: infer A3): infer R3;
263
+ (...args: infer A4): infer R4;
264
+ (...args: infer A5): infer R5;
265
+ (...args: infer A6): infer R6;
266
+ (...args: infer A7): infer R7;
267
+ (...args: infer A8): infer R8;
268
+ (...args: infer A9): infer R9;
269
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) : F extends {
270
+ (...args: infer A1): infer R1;
271
+ (...args: infer A2): infer R2;
272
+ (...args: infer A3): infer R3;
273
+ (...args: infer A4): infer R4;
274
+ (...args: infer A5): infer R5;
275
+ (...args: infer A6): infer R6;
276
+ (...args: infer A7): infer R7;
277
+ (...args: infer A8): infer R8;
278
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) : F extends {
279
+ (...args: infer A1): infer R1;
280
+ (...args: infer A2): infer R2;
281
+ (...args: infer A3): infer R3;
282
+ (...args: infer A4): infer R4;
283
+ (...args: infer A5): infer R5;
284
+ (...args: infer A6): infer R6;
285
+ (...args: infer A7): infer R7;
286
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) : F extends {
287
+ (...args: infer A1): infer R1;
288
+ (...args: infer A2): infer R2;
289
+ (...args: infer A3): infer R3;
290
+ (...args: infer A4): infer R4;
291
+ (...args: infer A5): infer R5;
292
+ (...args: infer A6): infer R6;
293
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) : F extends {
294
+ (...args: infer A1): infer R1;
295
+ (...args: infer A2): infer R2;
296
+ (...args: infer A3): infer R3;
297
+ (...args: infer A4): infer R4;
298
+ (...args: infer A5): infer R5;
299
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) : F extends {
300
+ (...args: infer A1): infer R1;
301
+ (...args: infer A2): infer R2;
302
+ (...args: infer A3): infer R3;
303
+ (...args: infer A4): infer R4;
304
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) : F extends {
305
+ (...args: infer A1): infer R1;
306
+ (...args: infer A2): infer R2;
307
+ (...args: infer A3): infer R3;
308
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) : F extends {
309
+ (...args: infer A1): infer R1;
310
+ (...args: infer A2): infer R2;
311
+ } ? ((...p: A1) => R1) | ((...p: A2) => R2) : F extends ((...args: infer A1) => infer R1) ? ((...p: A1) => R1) : never;
312
+ /**
313
+ * Get a union of overload variants for a function {@linkcode FunctionType}.
314
+ * Does a check for whether we can do the one-shot
315
+ * 10-overload matcher (which works for ts\>5.3), and if not,
316
+ * falls back to the more complicated utility.
317
+ */
318
+ type OverloadsInfoUnion<FunctionType> = IsNever<TSPost53OverloadsInfoUnion<(a: 1) => 2>> extends true ? TSPre53OverloadsInfoUnion<FunctionType> : TSPost53OverloadsInfoUnion<FunctionType>;
319
+ /**
320
+ * Allows inferring any function using the `infer` keyword.
321
+ */
322
+ type InferFunctionType<FunctionType extends (...args: any) => any> = FunctionType;
323
+ /**
324
+ * A union type of the parameters allowed for any
325
+ * overload of function {@linkcode FunctionType}.
326
+ */
327
+ type OverloadParameters<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? Parameters<Fn> : never;
328
+ /**
329
+ * A union type of the return types for any overload of
330
+ * function {@linkcode FunctionType}.
331
+ */
332
+ type OverloadReturnTypes<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? ReturnType<Fn> : never;
333
+ /**
334
+ * Takes an overload variants {@linkcode Union},
335
+ * produced from {@linkcode OverloadsInfoUnion} and rejects
336
+ * the ones incompatible with parameters {@linkcode Args}.
337
+ */
338
+ type SelectOverloadsInfo<Union extends UnknownFunction, Args extends unknown[]> = Union extends InferFunctionType<infer Fn> ? (Args extends Parameters<Fn> ? Fn : never) : never;
339
+ /**
340
+ * Creates a new overload (an intersection type) from an existing one,
341
+ * which only includes variant(s) which can accept
342
+ * {@linkcode Args} as parameters.
343
+ */
344
+ type OverloadsNarrowedByParameters<FunctionType, Args extends OverloadParameters<FunctionType>> = UnionToIntersection<SelectOverloadsInfo<OverloadsInfoUnion<FunctionType>, Args>>;
345
+ /**
346
+ * The simple(ish) way to get overload info from a constructor
347
+ * {@linkcode ConstructorType}. Recent versions of TypeScript will match any
348
+ * constructor against a generic 10-overload type, filling in slots with
349
+ * duplicates of the constructor. So, we can just match against a single type
350
+ * and get all the overloads.
351
+ *
352
+ * For older versions of TypeScript,
353
+ * we'll need to painstakingly do ten separate matches.
354
+ */
355
+ type TSPost53ConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends {
356
+ new (...args: infer A1): infer R1;
357
+ new (...args: infer A2): infer R2;
358
+ new (...args: infer A3): infer R3;
359
+ new (...args: infer A4): infer R4;
360
+ new (...args: infer A5): infer R5;
361
+ new (...args: infer A6): infer R6;
362
+ new (...args: infer A7): infer R7;
363
+ new (...args: infer A8): infer R8;
364
+ new (...args: infer A9): infer R9;
365
+ new (...args: infer A10): infer R10;
366
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : never;
367
+ /**
368
+ * A constructor function with `unknown` parameters and return type.
369
+ */
370
+ type UnknownConstructor = new (...args: unknown[]) => unknown;
371
+ /**
372
+ * Same as {@linkcode IsUselessOverloadInfo}, but for constructors.
373
+ */
374
+ type IsUselessConstructorOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownConstructor>;
375
+ /**
376
+ * For older versions of TypeScript, we need two separate workarounds to
377
+ * get constructor overload info. First, we need need to use
378
+ * {@linkcode DecreasingConstructorOverloadsInfoUnion} to get the overload
379
+ * info for constructors with 1-10 overloads. Then, we need to filter out the
380
+ * "useless" overloads that are present in older versions of TypeScript,
381
+ * for parameterless constructors. To do this we use
382
+ * {@linkcode IsUselessConstructorOverloadInfo} to remove useless overloads.
383
+ *
384
+ * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
385
+ */
386
+ type TSPre53ConstructorOverloadsInfoUnion<ConstructorType> = Tuplify<DecreasingConstructorOverloadsInfoUnion<ConstructorType>> extends infer Tup ? Tup extends [infer Ctor] ? IsUselessConstructorOverloadInfo<Ctor> extends true ? never : Ctor : never : never;
387
+ /**
388
+ * For versions of TypeScript below 5.3, we need to check for 10 overloads,
389
+ * then 9, then 8, etc., to get a union of the overload variants.
390
+ */
391
+ type DecreasingConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends {
392
+ new (...args: infer A1): infer R1;
393
+ new (...args: infer A2): infer R2;
394
+ new (...args: infer A3): infer R3;
395
+ new (...args: infer A4): infer R4;
396
+ new (...args: infer A5): infer R5;
397
+ new (...args: infer A6): infer R6;
398
+ new (...args: infer A7): infer R7;
399
+ new (...args: infer A8): infer R8;
400
+ new (...args: infer A9): infer R9;
401
+ new (...args: infer A10): infer R10;
402
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : ConstructorType extends {
403
+ new (...args: infer A1): infer R1;
404
+ new (...args: infer A2): infer R2;
405
+ new (...args: infer A3): infer R3;
406
+ new (...args: infer A4): infer R4;
407
+ new (...args: infer A5): infer R5;
408
+ new (...args: infer A6): infer R6;
409
+ new (...args: infer A7): infer R7;
410
+ new (...args: infer A8): infer R8;
411
+ new (...args: infer A9): infer R9;
412
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) : ConstructorType extends {
413
+ new (...args: infer A1): infer R1;
414
+ new (...args: infer A2): infer R2;
415
+ new (...args: infer A3): infer R3;
416
+ new (...args: infer A4): infer R4;
417
+ new (...args: infer A5): infer R5;
418
+ new (...args: infer A6): infer R6;
419
+ new (...args: infer A7): infer R7;
420
+ new (...args: infer A8): infer R8;
421
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) : ConstructorType extends {
422
+ new (...args: infer A1): infer R1;
423
+ new (...args: infer A2): infer R2;
424
+ new (...args: infer A3): infer R3;
425
+ new (...args: infer A4): infer R4;
426
+ new (...args: infer A5): infer R5;
427
+ new (...args: infer A6): infer R6;
428
+ new (...args: infer A7): infer R7;
429
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) : ConstructorType extends {
430
+ new (...args: infer A1): infer R1;
431
+ new (...args: infer A2): infer R2;
432
+ new (...args: infer A3): infer R3;
433
+ new (...args: infer A4): infer R4;
434
+ new (...args: infer A5): infer R5;
435
+ new (...args: infer A6): infer R6;
436
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) : ConstructorType extends {
437
+ new (...args: infer A1): infer R1;
438
+ new (...args: infer A2): infer R2;
439
+ new (...args: infer A3): infer R3;
440
+ new (...args: infer A4): infer R4;
441
+ new (...args: infer A5): infer R5;
442
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) : ConstructorType extends {
443
+ new (...args: infer A1): infer R1;
444
+ new (...args: infer A2): infer R2;
445
+ new (...args: infer A3): infer R3;
446
+ new (...args: infer A4): infer R4;
447
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) : ConstructorType extends {
448
+ new (...args: infer A1): infer R1;
449
+ new (...args: infer A2): infer R2;
450
+ new (...args: infer A3): infer R3;
451
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) : ConstructorType extends {
452
+ new (...args: infer A1): infer R1;
453
+ new (...args: infer A2): infer R2;
454
+ } ? (new (...p: A1) => R1) | (new (...p: A2) => R2) : ConstructorType extends (new (...args: infer A1) => infer R1) ? (new (...p: A1) => R1) : never;
455
+ /**
456
+ * Get a union of overload variants for a constructor
457
+ * {@linkcode ConstructorType}. Does a check for whether we can do the
458
+ * one-shot 10-overload matcher (which works for ts\>5.3), and if not,
459
+ * falls back to the more complicated utility.
460
+ */
461
+ type ConstructorOverloadsUnion<ConstructorType> = IsNever<TSPost53ConstructorOverloadsInfoUnion<new (a: 1) => any>> extends true ? TSPre53ConstructorOverloadsInfoUnion<ConstructorType> : TSPost53ConstructorOverloadsInfoUnion<ConstructorType>;
462
+ /**
463
+ * Allows inferring any constructor using the `infer` keyword.
464
+ */
465
+ type InferConstructor<ConstructorType extends new (...args: any) => any> = ConstructorType;
466
+ /**
467
+ * A union type of the parameters allowed for any overload
468
+ * of constructor {@linkcode ConstructorType}.
469
+ */
470
+ type ConstructorOverloadParameters<ConstructorType> = ConstructorOverloadsUnion<ConstructorType> extends InferConstructor<infer Ctor> ? ConstructorParameters<Ctor> : never;
471
+ /**
472
+ * Calculates the number of overloads for a given function type.
473
+ */
474
+ type NumOverloads<FunctionType> = UnionToTuple<OverloadsInfoUnion<FunctionType>>['length'];
475
+ //#endregion
476
+ //#region ../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/branding.d.ts
477
+ /**
478
+ * Represents a deeply branded type.
479
+ *
480
+ * Recursively walk a type and replace it with a branded type related to the
481
+ * original. This is useful for equality-checking stricter than
482
+ * `A extends B ? B extends A ? true : false : false`, because it detects the
483
+ * difference between a few edge-case types that vanilla TypeScript
484
+ * doesn't by default:
485
+ * - `any` vs `unknown`
486
+ * - `{ readonly a: string }` vs `{ a: string }`
487
+ * - `{ a?: string }` vs `{ a: string | undefined }`
488
+ *
489
+ * __Note__: not very performant for complex types - this should only be used
490
+ * when you know you need it. If doing an equality check, it's almost always
491
+ * better to use {@linkcode StrictEqualUsingTSInternalIdenticalToOperator}.
492
+ */
493
+ type DeepBrand<T> = IsNever<T> extends true ? {
494
+ type: 'never';
495
+ } : IsAny<T> extends true ? {
496
+ type: 'any';
497
+ } : IsUnknown<T> extends true ? {
498
+ type: 'unknown';
499
+ } : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
500
+ type: 'primitive';
501
+ value: T;
502
+ } : T extends (new (...args: any[]) => any) ? {
503
+ type: 'constructor';
504
+ params: ConstructorOverloadParameters<T>;
505
+ instance: DeepBrand<InstanceType<Extract<T, new (...args: any) => any>>>;
506
+ } : T extends ((...args: infer P) => infer R) ? NumOverloads<T> extends 1 ? {
507
+ type: 'function';
508
+ params: DeepBrand<P>;
509
+ return: DeepBrand<R>;
510
+ this: DeepBrand<ThisParameterType<T>>;
511
+ props: DeepBrand<Omit<T, keyof Function>>;
512
+ } : UnionToTuple<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
513
+ type: 'overloads';
514
+ overloads: { [K in keyof OverloadsTuple]: DeepBrand<OverloadsTuple[K]> };
515
+ } : never : T extends any[] ? {
516
+ type: 'array';
517
+ items: { [K in keyof T]: T[K] };
518
+ } : {
519
+ type: 'object';
520
+ properties: { [K in keyof T]: DeepBrand<T[K]> };
521
+ readonly: ReadonlyKeys<T>;
522
+ required: RequiredKeys<T>;
523
+ optional: OptionalKeys<T>;
524
+ constructorParams: DeepBrand<ConstructorOverloadParameters<T>>;
525
+ };
526
+ /**
527
+ * Checks if two types are strictly equal using branding.
528
+ */
529
+ type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;
530
+ //#endregion
531
+ //#region ../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/messages.d.ts
532
+ /**
533
+ * Determines the printable type representation for a given type.
534
+ */
535
+ type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends ((...args: any[]) => any) ? 'function' : '...';
536
+ /**
537
+ * Helper for showing end-user a hint why their type assertion is failing.
538
+ * This swaps "leaf" types with a literal message about what the actual and
539
+ * expected types are. Needs to check for `Not<IsAny<Actual>>` because
540
+ * otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
541
+ */
542
+ type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : { [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never> } : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;
543
+ /**
544
+ * @internal
545
+ */
546
+ declare const inverted: unique symbol;
547
+ /**
548
+ * @internal
549
+ */
550
+ type Inverted<T> = {
551
+ [inverted]: T;
552
+ };
553
+ /**
554
+ * @internal
555
+ */
556
+ declare const expectNull: unique symbol;
557
+ type ExpectNull<T> = {
558
+ [expectNull]: T;
559
+ result: ExtendsExcludingAnyOrNever<T, null>;
560
+ };
561
+ /**
562
+ * @internal
563
+ */
564
+ declare const expectUndefined: unique symbol;
565
+ type ExpectUndefined<T> = {
566
+ [expectUndefined]: T;
567
+ result: ExtendsExcludingAnyOrNever<T, undefined>;
568
+ };
569
+ /**
570
+ * @internal
571
+ */
572
+ declare const expectNumber: unique symbol;
573
+ type ExpectNumber<T> = {
574
+ [expectNumber]: T;
575
+ result: ExtendsExcludingAnyOrNever<T, number>;
576
+ };
577
+ /**
578
+ * @internal
579
+ */
580
+ declare const expectString: unique symbol;
581
+ type ExpectString<T> = {
582
+ [expectString]: T;
583
+ result: ExtendsExcludingAnyOrNever<T, string>;
584
+ };
585
+ /**
586
+ * @internal
587
+ */
588
+ declare const expectBoolean: unique symbol;
589
+ type ExpectBoolean<T> = {
590
+ [expectBoolean]: T;
591
+ result: ExtendsExcludingAnyOrNever<T, boolean>;
592
+ };
593
+ /**
594
+ * @internal
595
+ */
596
+ declare const expectVoid: unique symbol;
597
+ type ExpectVoid<T> = {
598
+ [expectVoid]: T;
599
+ result: ExtendsExcludingAnyOrNever<T, void>;
600
+ };
601
+ /**
602
+ * @internal
603
+ */
604
+ declare const expectFunction: unique symbol;
605
+ type ExpectFunction<T> = {
606
+ [expectFunction]: T;
607
+ result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
608
+ };
609
+ /**
610
+ * @internal
611
+ */
612
+ declare const expectObject: unique symbol;
613
+ type ExpectObject<T> = {
614
+ [expectObject]: T;
615
+ result: ExtendsExcludingAnyOrNever<T, object>;
616
+ };
617
+ /**
618
+ * @internal
619
+ */
620
+ declare const expectArray: unique symbol;
621
+ type ExpectArray<T> = {
622
+ [expectArray]: T;
623
+ result: ExtendsExcludingAnyOrNever<T, any[]>;
624
+ };
625
+ /**
626
+ * @internal
627
+ */
628
+ declare const expectSymbol: unique symbol;
629
+ type ExpectSymbol<T> = {
630
+ [expectSymbol]: T;
631
+ result: ExtendsExcludingAnyOrNever<T, symbol>;
632
+ };
633
+ /**
634
+ * @internal
635
+ */
636
+ declare const expectAny: unique symbol;
637
+ type ExpectAny<T> = {
638
+ [expectAny]: T;
639
+ result: IsAny<T>;
640
+ };
641
+ /**
642
+ * @internal
643
+ */
644
+ declare const expectUnknown: unique symbol;
645
+ type ExpectUnknown<T> = {
646
+ [expectUnknown]: T;
647
+ result: IsUnknown<T>;
648
+ };
649
+ /**
650
+ * @internal
651
+ */
652
+ declare const expectNever: unique symbol;
653
+ type ExpectNever<T> = {
654
+ [expectNever]: T;
655
+ result: IsNever<T>;
656
+ };
657
+ /**
658
+ * @internal
659
+ */
660
+ declare const expectNullable: unique symbol;
661
+ type ExpectNullable<T> = {
662
+ [expectNullable]: T;
663
+ result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
664
+ };
665
+ /**
666
+ * @internal
667
+ */
668
+ declare const expectBigInt: unique symbol;
669
+ type ExpectBigInt<T> = {
670
+ [expectBigInt]: T;
671
+ result: ExtendsExcludingAnyOrNever<T, bigint>;
672
+ };
673
+ /**
674
+ * Checks if the result of an expecter matches the specified options, and
675
+ * resolves to a fairly readable error message if not.
676
+ */
677
+ type Scolder<Expecter extends {
678
+ result: boolean;
679
+ }, Options extends {
680
+ positive: boolean;
681
+ }> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;
682
+ //#endregion
683
+ //#region ../../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.d.ts
684
+ /**
685
+ * Represents the positive assertion methods available for type checking in the
686
+ * {@linkcode expectTypeOf()} utility.
687
+ */
688
+ interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
689
+ positive: true;
690
+ branded: false;
691
+ }> {
692
+ /**
693
+ * Similar to jest's `expect(...).toMatchObject(...)` but for types.
694
+ * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`.
695
+ *
696
+ * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}.
697
+ *
698
+ * @example
699
+ * ```ts
700
+ * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>()
701
+ *
702
+ * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>()
703
+ * ```
704
+ *
705
+ * @param MISMATCH - The mismatch arguments.
706
+ * @returns `true`.
707
+ */
708
+ toMatchObjectType: <Expected extends (IsUnion<Expected> extends true ? 'toMatchObject does not support union types' : Not<Extends<Expected, Record<string, unknown>>> extends true ? 'toMatchObject only supports object types' : StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected> extends true ? unknown : MismatchInfo<DeepPickMatchingProps<Actual, Expected>, Expected>)>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected>, true>) => true;
709
+ /**
710
+ * Check if your type extends the expected type
711
+ *
712
+ * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties.
713
+ * This is roughly equivalent to an `extends` constraint in a function type argument.
714
+ *
715
+ * @example
716
+ * ```ts
717
+ * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()
718
+ *
719
+ * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>()
720
+ * ```
721
+ *
722
+ * @param MISMATCH - The mismatch arguments.
723
+ * @returns `true`.
724
+ */
725
+ toExtend: <Expected extends (Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>) => true;
726
+ toEqualTypeOf: {
727
+ /**
728
+ * Uses TypeScript's internal technique to check for type "identicalness".
729
+ *
730
+ * It will check if the types are fully equal to each other.
731
+ * It will not fail if two objects have different values, but the same type.
732
+ * It will fail however if an object is missing a property.
733
+ *
734
+ * **_Unexpected failure_**? For a more permissive but less performant
735
+ * check that accommodates for equivalent intersection types,
736
+ * use {@linkcode branded | .branded.toEqualTypeOf()}.
737
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
738
+ *
739
+ * @example
740
+ * <caption>Using generic type argument syntax</caption>
741
+ * ```ts
742
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
743
+ *
744
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
745
+ * ```
746
+ *
747
+ * @example
748
+ * <caption>Using inferred type syntax by passing a value</caption>
749
+ * ```ts
750
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
751
+ *
752
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
753
+ * ```
754
+ *
755
+ * @param value - The value to compare against the expected type.
756
+ * @param MISMATCH - The mismatch arguments.
757
+ * @returns `true`.
758
+ */
759
+ <Expected extends (StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
760
+ ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
761
+ /**
762
+ * Uses TypeScript's internal technique to check for type "identicalness".
763
+ *
764
+ * It will check if the types are fully equal to each other.
765
+ * It will not fail if two objects have different values, but the same type.
766
+ * It will fail however if an object is missing a property.
767
+ *
768
+ * **_Unexpected failure_**? For a more permissive but less performant
769
+ * check that accommodates for equivalent intersection types,
770
+ * use {@linkcode branded | .branded.toEqualTypeOf()}.
771
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
772
+ *
773
+ * @example
774
+ * <caption>Using generic type argument syntax</caption>
775
+ * ```ts
776
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
777
+ *
778
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
779
+ * ```
780
+ *
781
+ * @example
782
+ * <caption>Using inferred type syntax by passing a value</caption>
783
+ * ```ts
784
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
785
+ *
786
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
787
+ * ```
788
+ *
789
+ * @param MISMATCH - The mismatch arguments.
790
+ * @returns `true`.
791
+ */
792
+ <Expected extends (StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
793
+ };
794
+ /**
795
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
796
+ *
797
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
798
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
799
+ */
800
+ toMatchTypeOf: {
801
+ /**
802
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
803
+ *
804
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
805
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
806
+ *
807
+ * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
808
+ * that allows for extra properties.
809
+ * This is roughly equivalent to an `extends` constraint
810
+ * in a function type argument.
811
+ *
812
+ * @example
813
+ * <caption>Using generic type argument syntax</caption>
814
+ * ```ts
815
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
816
+ * ```
817
+ *
818
+ * @example
819
+ * <caption>Using inferred type syntax by passing a value</caption>
820
+ * ```ts
821
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
822
+ * ```
823
+ *
824
+ * @param value - The value to compare against the expected type.
825
+ * @param MISMATCH - The mismatch arguments.
826
+ * @returns `true`.
827
+ */
828
+ <Expected extends (Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
829
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
830
+ /**
831
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
832
+ *
833
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
834
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
835
+ *
836
+ * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
837
+ * that allows for extra properties.
838
+ * This is roughly equivalent to an `extends` constraint
839
+ * in a function type argument.
840
+ *
841
+ * @example
842
+ * <caption>Using generic type argument syntax</caption>
843
+ * ```ts
844
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
845
+ * ```
846
+ *
847
+ * @example
848
+ * <caption>Using inferred type syntax by passing a value</caption>
849
+ * ```ts
850
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
851
+ * ```
852
+ *
853
+ * @param MISMATCH - The mismatch arguments.
854
+ * @returns `true`.
855
+ */
856
+ <Expected extends (Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
857
+ };
858
+ /**
859
+ * Checks whether an object has a given property.
860
+ *
861
+ * @example
862
+ * <caption>check that properties exist</caption>
863
+ * ```ts
864
+ * const obj = { a: 1, b: '' }
865
+ *
866
+ * expectTypeOf(obj).toHaveProperty('a')
867
+ *
868
+ * expectTypeOf(obj).not.toHaveProperty('c')
869
+ * ```
870
+ *
871
+ * @param key - The property key to check for.
872
+ * @param MISMATCH - The mismatch arguments.
873
+ * @returns `true`.
874
+ */
875
+ toHaveProperty: <KeyType extends keyof Actual>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf<Actual[KeyType]> : true;
876
+ /**
877
+ * Inverts the result of the following assertions.
878
+ *
879
+ * @example
880
+ * ```ts
881
+ * expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 })
882
+ * ```
883
+ */
884
+ not: NegativeExpectTypeOf<Actual>;
885
+ /**
886
+ * Intersection types can cause issues with
887
+ * {@linkcode toEqualTypeOf | .toEqualTypeOf()}:
888
+ * ```ts
889
+ * // ❌ The following line doesn't compile, even though the types are arguably the same.
890
+ * expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>()
891
+ * ```
892
+ * This helper works around this problem by using
893
+ * a more permissive but less performant check.
894
+ *
895
+ * __Note__: This comes at a performance cost, and can cause the compiler
896
+ * to 'give up' if used with excessively deep types, so use sparingly.
897
+ *
898
+ * @see {@link https://github.com/mmkal/expect-type/pull/21 | Reference}
899
+ */
900
+ branded: {
901
+ /**
902
+ * Uses TypeScript's internal technique to check for type "identicalness".
903
+ *
904
+ * It will check if the types are fully equal to each other.
905
+ * It will not fail if two objects have different values, but the same type.
906
+ * It will fail however if an object is missing a property.
907
+ *
908
+ * **_Unexpected failure_**? For a more permissive but less performant
909
+ * check that accommodates for equivalent intersection types,
910
+ * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
911
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
912
+ *
913
+ * @example
914
+ * <caption>Using generic type argument syntax</caption>
915
+ * ```ts
916
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
917
+ *
918
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
919
+ * ```
920
+ *
921
+ * @example
922
+ * <caption>Using inferred type syntax by passing a value</caption>
923
+ * ```ts
924
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
925
+ *
926
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
927
+ * ```
928
+ *
929
+ * @param MISMATCH - The mismatch arguments.
930
+ * @returns `true`.
931
+ */
932
+ toEqualTypeOf: <Expected extends (StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>)>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
933
+ };
934
+ }
935
+ /**
936
+ * Represents the negative expectation type for the {@linkcode Actual} type.
937
+ */
938
+ interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
939
+ positive: false;
940
+ }> {
941
+ /**
942
+ * Similar to jest's `expect(...).toMatchObject(...)` but for types.
943
+ * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`.
944
+ *
945
+ * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}.
946
+ *
947
+ * @example
948
+ * ```ts
949
+ * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>()
950
+ *
951
+ * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>()
952
+ * ```
953
+ *
954
+ * @param MISMATCH - The mismatch arguments.
955
+ * @returns `true`.
956
+ */
957
+ toMatchObjectType: <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Pick<Actual, keyof Actual & keyof Expected>, Expected>, false>) => true;
958
+ /**
959
+ * Check if your type extends the expected type
960
+ *
961
+ * A less strict version of {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties.
962
+ * This is roughly equivalent to an `extends` constraint in a function type argument.
963
+ *
964
+ * @example
965
+ * ```ts
966
+ * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()]
967
+ *
968
+ * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>()
969
+ * ```
970
+ *
971
+ * @param MISMATCH - The mismatch arguments.
972
+ * @returns `true`.
973
+ */
974
+ toExtend<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
975
+ toEqualTypeOf: {
976
+ /**
977
+ * Uses TypeScript's internal technique to check for type "identicalness".
978
+ *
979
+ * It will check if the types are fully equal to each other.
980
+ * It will not fail if two objects have different values, but the same type.
981
+ * It will fail however if an object is missing a property.
982
+ *
983
+ * **_Unexpected failure_**? For a more permissive but less performant
984
+ * check that accommodates for equivalent intersection types,
985
+ * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
986
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
987
+ *
988
+ * @example
989
+ * <caption>Using generic type argument syntax</caption>
990
+ * ```ts
991
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
992
+ *
993
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
994
+ * ```
995
+ *
996
+ * @example
997
+ * <caption>Using inferred type syntax by passing a value</caption>
998
+ * ```ts
999
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
1000
+ *
1001
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
1002
+ * ```
1003
+ *
1004
+ * @param value - The value to compare against the expected type.
1005
+ * @param MISMATCH - The mismatch arguments.
1006
+ * @returns `true`.
1007
+ */
1008
+ <Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
1009
+ /**
1010
+ * Uses TypeScript's internal technique to check for type "identicalness".
1011
+ *
1012
+ * It will check if the types are fully equal to each other.
1013
+ * It will not fail if two objects have different values, but the same type.
1014
+ * It will fail however if an object is missing a property.
1015
+ *
1016
+ * **_Unexpected failure_**? For a more permissive but less performant
1017
+ * check that accommodates for equivalent intersection types,
1018
+ * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
1019
+ * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
1020
+ *
1021
+ * @example
1022
+ * <caption>Using generic type argument syntax</caption>
1023
+ * ```ts
1024
+ * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
1025
+ *
1026
+ * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
1027
+ * ```
1028
+ *
1029
+ * @example
1030
+ * <caption>Using inferred type syntax by passing a value</caption>
1031
+ * ```ts
1032
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
1033
+ *
1034
+ * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
1035
+ * ```
1036
+ *
1037
+ * @param MISMATCH - The mismatch arguments.
1038
+ * @returns `true`.
1039
+ */
1040
+ <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
1041
+ };
1042
+ /**
1043
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
1044
+ *
1045
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
1046
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
1047
+ */
1048
+ toMatchTypeOf: {
1049
+ /**
1050
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
1051
+ *
1052
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
1053
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
1054
+ *
1055
+ * A less strict version of
1056
+ * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
1057
+ * that allows for extra properties.
1058
+ * This is roughly equivalent to an `extends` constraint
1059
+ * in a function type argument.
1060
+ *
1061
+ * @example
1062
+ * <caption>Using generic type argument syntax</caption>
1063
+ * ```ts
1064
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
1065
+ * ```
1066
+ *
1067
+ * @example
1068
+ * <caption>Using inferred type syntax by passing a value</caption>
1069
+ * ```ts
1070
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
1071
+ * ```
1072
+ *
1073
+ * @param value - The value to compare against the expected type.
1074
+ * @param MISMATCH - The mismatch arguments.
1075
+ * @returns `true`.
1076
+ */
1077
+ <Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
1078
+ ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
1079
+ /**
1080
+ * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead
1081
+ *
1082
+ * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys
1083
+ * - Use {@linkcode toExtend} to check if your type extends the expected type
1084
+ *
1085
+ * A less strict version of
1086
+ * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
1087
+ * that allows for extra properties.
1088
+ * This is roughly equivalent to an `extends` constraint
1089
+ * in a function type argument.
1090
+ *
1091
+ * @example
1092
+ * <caption>Using generic type argument syntax</caption>
1093
+ * ```ts
1094
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
1095
+ * ```
1096
+ *
1097
+ * @example
1098
+ * <caption>Using inferred type syntax by passing a value</caption>
1099
+ * ```ts
1100
+ * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
1101
+ * ```
1102
+ *
1103
+ * @param MISMATCH - The mismatch arguments.
1104
+ * @returns `true`.
1105
+ */
1106
+ <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
1107
+ };
1108
+ /**
1109
+ * Checks whether an object has a given property.
1110
+ *
1111
+ * @example
1112
+ * <caption>check that properties exist</caption>
1113
+ * ```ts
1114
+ * const obj = { a: 1, b: '' }
1115
+ *
1116
+ * expectTypeOf(obj).toHaveProperty('a')
1117
+ *
1118
+ * expectTypeOf(obj).not.toHaveProperty('c')
1119
+ * ```
1120
+ *
1121
+ * @param key - The property key to check for.
1122
+ * @param MISMATCH - The mismatch arguments.
1123
+ * @returns `true`.
1124
+ */
1125
+ toHaveProperty: <KeyType extends string | number | symbol>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, false>) => true;
1126
+ }
1127
+ /**
1128
+ * Represents a conditional type that selects either
1129
+ * {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based
1130
+ * on the value of the `positive` property in the {@linkcode Options} type.
1131
+ */
1132
+ type ExpectTypeOf<Actual, Options extends {
1133
+ positive: boolean;
1134
+ }> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;
1135
+ /**
1136
+ * Represents the base interface for the
1137
+ * {@linkcode expectTypeOf()} function.
1138
+ * Provides a set of assertion methods to perform type checks on a value.
1139
+ */
1140
+ interface BaseExpectTypeOf<Actual, Options extends {
1141
+ positive: boolean;
1142
+ }> {
1143
+ /**
1144
+ * Checks whether the type of the value is `any`.
1145
+ */
1146
+ toBeAny: Scolder<ExpectAny<Actual>, Options>;
1147
+ /**
1148
+ * Checks whether the type of the value is `unknown`.
1149
+ */
1150
+ toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
1151
+ /**
1152
+ * Checks whether the type of the value is `never`.
1153
+ */
1154
+ toBeNever: Scolder<ExpectNever<Actual>, Options>;
1155
+ /**
1156
+ * Checks whether the type of the value is `function`.
1157
+ */
1158
+ toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
1159
+ /**
1160
+ * Checks whether the type of the value is `object`.
1161
+ */
1162
+ toBeObject: Scolder<ExpectObject<Actual>, Options>;
1163
+ /**
1164
+ * Checks whether the type of the value is an {@linkcode Array}.
1165
+ */
1166
+ toBeArray: Scolder<ExpectArray<Actual>, Options>;
1167
+ /**
1168
+ * Checks whether the type of the value is `number`.
1169
+ */
1170
+ toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
1171
+ /**
1172
+ * Checks whether the type of the value is `string`.
1173
+ */
1174
+ toBeString: Scolder<ExpectString<Actual>, Options>;
1175
+ /**
1176
+ * Checks whether the type of the value is `boolean`.
1177
+ */
1178
+ toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
1179
+ /**
1180
+ * Checks whether the type of the value is `void`.
1181
+ */
1182
+ toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
1183
+ /**
1184
+ * Checks whether the type of the value is `symbol`.
1185
+ */
1186
+ toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
1187
+ /**
1188
+ * Checks whether the type of the value is `null`.
1189
+ */
1190
+ toBeNull: Scolder<ExpectNull<Actual>, Options>;
1191
+ /**
1192
+ * Checks whether the type of the value is `undefined`.
1193
+ */
1194
+ toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
1195
+ /**
1196
+ * Checks whether the type of the value is `null` or `undefined`.
1197
+ */
1198
+ toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
1199
+ /**
1200
+ * Transform that type of the value via a callback.
1201
+ *
1202
+ * @param fn - A callback that transforms the input value. Note that this function is not actually called - it's only used for type inference.
1203
+ * @returns A new type which can be used for further assertions.
1204
+ */
1205
+ map: <T>(fn: (value: Actual) => T) => ExpectTypeOf<T, Options>;
1206
+ /**
1207
+ * Checks whether the type of the value is **`bigint`**.
1208
+ *
1209
+ * @example
1210
+ * <caption>#### Distinguish between **`number`** and **`bigint`**</caption>
1211
+ *
1212
+ * ```ts
1213
+ * import { expectTypeOf } from 'expect-type'
1214
+ *
1215
+ * const aVeryBigInteger = 10n ** 100n
1216
+ *
1217
+ * expectTypeOf(aVeryBigInteger).not.toBeNumber()
1218
+ *
1219
+ * expectTypeOf(aVeryBigInteger).toBeBigInt()
1220
+ * ```
1221
+ *
1222
+ * @since 1.1.0
1223
+ */
1224
+ toBeBigInt: Scolder<ExpectBigInt<Actual>, Options>;
1225
+ /**
1226
+ * Checks whether a function is callable with the given parameters.
1227
+ *
1228
+ * __Note__: You cannot negate this assertion with
1229
+ * {@linkcode PositiveExpectTypeOf.not | .not}, you need to use
1230
+ * `ts-expect-error` instead.
1231
+ *
1232
+ * @example
1233
+ * ```ts
1234
+ * const f = (a: number) => [a, a]
1235
+ *
1236
+ * expectTypeOf(f).toBeCallableWith(1)
1237
+ * ```
1238
+ *
1239
+ * __Known Limitation__: This assertion will likely fail if you try to use it
1240
+ * with a generic function or an overload.
1241
+ * @see {@link https://github.com/mmkal/expect-type/issues/50 | This issue} for an example and a workaround.
1242
+ *
1243
+ * @param args - The arguments to check for callability.
1244
+ * @returns `true`.
1245
+ */
1246
+ toBeCallableWith: Options['positive'] extends true ? <Args extends OverloadParameters<Actual>>(...args: Args) => ExpectTypeOf<OverloadsNarrowedByParameters<Actual, Args>, Options> : never;
1247
+ /**
1248
+ * Checks whether a class is constructible with the given parameters.
1249
+ *
1250
+ * @example
1251
+ * ```ts
1252
+ * expectTypeOf(Date).toBeConstructibleWith('1970')
1253
+ *
1254
+ * expectTypeOf(Date).toBeConstructibleWith(0)
1255
+ *
1256
+ * expectTypeOf(Date).toBeConstructibleWith(new Date())
1257
+ *
1258
+ * expectTypeOf(Date).toBeConstructibleWith()
1259
+ * ```
1260
+ *
1261
+ * @param args - The arguments to check for constructibility.
1262
+ * @returns `true`.
1263
+ */
1264
+ toBeConstructibleWith: Options['positive'] extends true ? <Args extends ConstructorOverloadParameters<Actual>>(...args: Args) => true : never;
1265
+ /**
1266
+ * Equivalent to the {@linkcode Extract} utility type.
1267
+ * Helps narrow down complex union types.
1268
+ *
1269
+ * @example
1270
+ * ```ts
1271
+ * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
1272
+ *
1273
+ * interface CSSProperties {
1274
+ * margin?: string
1275
+ * padding?: string
1276
+ * }
1277
+ *
1278
+ * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
1279
+ * return {}
1280
+ * }
1281
+ *
1282
+ * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
1283
+ *
1284
+ * expectTypeOf(getResponsiveProp(cssProperties))
1285
+ * .extract<{ xs?: any }>() // extracts the last type from a union
1286
+ * .toEqualTypeOf<{
1287
+ * xs?: CSSProperties
1288
+ * sm?: CSSProperties
1289
+ * md?: CSSProperties
1290
+ * }>()
1291
+ *
1292
+ * expectTypeOf(getResponsiveProp(cssProperties))
1293
+ * .extract<unknown[]>() // extracts an array from a union
1294
+ * .toEqualTypeOf<CSSProperties[]>()
1295
+ * ```
1296
+ *
1297
+ * __Note__: If no type is found in the union, it will return `never`.
1298
+ *
1299
+ * @param v - The type to extract from the union.
1300
+ * @returns The type after extracting the type from the union.
1301
+ */
1302
+ extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
1303
+ /**
1304
+ * Equivalent to the {@linkcode Exclude} utility type.
1305
+ * Removes types from a union.
1306
+ *
1307
+ * @example
1308
+ * ```ts
1309
+ * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
1310
+ *
1311
+ * interface CSSProperties {
1312
+ * margin?: string
1313
+ * padding?: string
1314
+ * }
1315
+ *
1316
+ * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
1317
+ * return {}
1318
+ * }
1319
+ *
1320
+ * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
1321
+ *
1322
+ * expectTypeOf(getResponsiveProp(cssProperties))
1323
+ * .exclude<unknown[]>()
1324
+ * .exclude<{ xs?: unknown }>() // or just `.exclude<unknown[] | { xs?: unknown }>()`
1325
+ * .toEqualTypeOf<CSSProperties>()
1326
+ * ```
1327
+ */
1328
+ exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
1329
+ /**
1330
+ * Equivalent to the {@linkcode Pick} utility type.
1331
+ * Helps select a subset of properties from an object type.
1332
+ *
1333
+ * @example
1334
+ * ```ts
1335
+ * interface Person {
1336
+ * name: string
1337
+ * age: number
1338
+ * }
1339
+ *
1340
+ * expectTypeOf<Person>()
1341
+ * .pick<'name'>()
1342
+ * .toEqualTypeOf<{ name: string }>()
1343
+ * ```
1344
+ *
1345
+ * @param keyToPick - The property key to pick.
1346
+ * @returns The type after picking the property.
1347
+ */
1348
+ pick: <KeyToPick extends keyof Actual>(keyToPick?: KeyToPick) => ExpectTypeOf<Pick<Actual, KeyToPick>, Options>;
1349
+ /**
1350
+ * Equivalent to the {@linkcode Omit} utility type.
1351
+ * Helps remove a subset of properties from an object type.
1352
+ *
1353
+ * @example
1354
+ * ```ts
1355
+ * interface Person {
1356
+ * name: string
1357
+ * age: number
1358
+ * }
1359
+ *
1360
+ * expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{ age: number }>()
1361
+ * ```
1362
+ *
1363
+ * @param keyToOmit - The property key to omit.
1364
+ * @returns The type after omitting the property.
1365
+ */
1366
+ omit: <KeyToOmit extends keyof Actual | (PropertyKey & Record<never, never>)>(keyToOmit?: KeyToOmit) => ExpectTypeOf<Omit<Actual, KeyToOmit>, Options>;
1367
+ /**
1368
+ * Extracts a certain function argument with `.parameter(number)` call to
1369
+ * perform other assertions on it.
1370
+ *
1371
+ * @example
1372
+ * ```ts
1373
+ * function foo(a: number, b: string) {
1374
+ * return [a, b]
1375
+ * }
1376
+ *
1377
+ * expectTypeOf(foo).parameter(0).toBeNumber()
1378
+ *
1379
+ * expectTypeOf(foo).parameter(1).toBeString()
1380
+ * ```
1381
+ *
1382
+ * @param index - The index of the parameter to extract.
1383
+ * @returns The extracted parameter type.
1384
+ */
1385
+ parameter: <Index extends number>(index: Index) => ExpectTypeOf<OverloadParameters<Actual>[Index], Options>;
1386
+ /**
1387
+ * Equivalent to the {@linkcode Parameters} utility type.
1388
+ * Extracts function parameters to perform assertions on its value.
1389
+ * Parameters are returned as an array.
1390
+ *
1391
+ * @example
1392
+ * ```ts
1393
+ * function noParam() {}
1394
+ *
1395
+ * function hasParam(s: string) {}
1396
+ *
1397
+ * expectTypeOf(noParam).parameters.toEqualTypeOf<[]>()
1398
+ *
1399
+ * expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>()
1400
+ * ```
1401
+ */
1402
+ parameters: ExpectTypeOf<OverloadParameters<Actual>, Options>;
1403
+ /**
1404
+ * Equivalent to the {@linkcode ConstructorParameters} utility type.
1405
+ * Extracts constructor parameters as an array of values and
1406
+ * perform assertions on them with this method.
1407
+ *
1408
+ * For overloaded constructors it will return a union of all possible parameter-tuples.
1409
+ *
1410
+ * @example
1411
+ * ```ts
1412
+ * expectTypeOf(Date).constructorParameters.toEqualTypeOf<
1413
+ * [] | [string | number | Date]
1414
+ * >()
1415
+ * ```
1416
+ */
1417
+ constructorParameters: ExpectTypeOf<ConstructorOverloadParameters<Actual>, Options>;
1418
+ /**
1419
+ * Equivalent to the {@linkcode ThisParameterType} utility type.
1420
+ * Extracts the `this` parameter of a function to
1421
+ * perform assertions on its value.
1422
+ *
1423
+ * @example
1424
+ * ```ts
1425
+ * function greet(this: { name: string }, message: string) {
1426
+ * return `Hello ${this.name}, here's your message: ${message}`
1427
+ * }
1428
+ *
1429
+ * expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>()
1430
+ * ```
1431
+ */
1432
+ thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
1433
+ /**
1434
+ * Equivalent to the {@linkcode InstanceType} utility type.
1435
+ * Extracts the instance type of a class to perform assertions on.
1436
+ *
1437
+ * @example
1438
+ * ```ts
1439
+ * expectTypeOf(Date).instance.toHaveProperty('toISOString')
1440
+ * ```
1441
+ */
1442
+ instance: Actual extends (new (...args: any[]) => infer I) ? ExpectTypeOf<I, Options> : never;
1443
+ /**
1444
+ * Equivalent to the {@linkcode ReturnType} utility type.
1445
+ * Extracts the return type of a function.
1446
+ *
1447
+ * @example
1448
+ * ```ts
1449
+ * expectTypeOf(() => {}).returns.toBeVoid()
1450
+ *
1451
+ * expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2])
1452
+ * ```
1453
+ */
1454
+ returns: Actual extends Function ? ExpectTypeOf<OverloadReturnTypes<Actual>, Options> : never;
1455
+ /**
1456
+ * Extracts resolved value of a Promise,
1457
+ * so you can perform other assertions on it.
1458
+ *
1459
+ * @example
1460
+ * ```ts
1461
+ * async function asyncFunc() {
1462
+ * return 123
1463
+ * }
1464
+ *
1465
+ * expectTypeOf(asyncFunc).returns.resolves.toBeNumber()
1466
+ *
1467
+ * expectTypeOf(Promise.resolve('string')).resolves.toBeString()
1468
+ * ```
1469
+ *
1470
+ * Type Equivalent:
1471
+ * ```ts
1472
+ * type Resolves<PromiseType> = PromiseType extends PromiseLike<infer ResolvedType>
1473
+ * ? ResolvedType
1474
+ * : never
1475
+ * ```
1476
+ */
1477
+ resolves: Actual extends PromiseLike<infer ResolvedType> ? ExpectTypeOf<ResolvedType, Options> : never;
1478
+ /**
1479
+ * Extracts array item type to perform assertions on.
1480
+ *
1481
+ * @example
1482
+ * ```ts
1483
+ * expectTypeOf([1, 2, 3]).items.toEqualTypeOf<number>()
1484
+ *
1485
+ * expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf<string>()
1486
+ * ```
1487
+ *
1488
+ * __Type Equivalent__:
1489
+ * ```ts
1490
+ * type Items<ArrayType> = ArrayType extends ArrayLike<infer ItemType>
1491
+ * ? ItemType
1492
+ * : never
1493
+ * ```
1494
+ */
1495
+ items: Actual extends ArrayLike<infer ItemType> ? ExpectTypeOf<ItemType, Options> : never;
1496
+ /**
1497
+ * Extracts the type guarded by a function to perform assertions on.
1498
+ *
1499
+ * @example
1500
+ * ```ts
1501
+ * function isString(v: any): v is string {
1502
+ * return typeof v === 'string'
1503
+ * }
1504
+ *
1505
+ * expectTypeOf(isString).guards.toBeString()
1506
+ * ```
1507
+ */
1508
+ guards: Actual extends ((v: any, ...args: any[]) => v is infer T) ? ExpectTypeOf<T, Options> : never;
1509
+ /**
1510
+ * Extracts the type asserted by a function to perform assertions on.
1511
+ *
1512
+ * @example
1513
+ * ```ts
1514
+ * function assertNumber(v: any): asserts v is number {
1515
+ * if (typeof v !== 'number')
1516
+ * throw new TypeError('Nope !')
1517
+ * }
1518
+ *
1519
+ * expectTypeOf(assertNumber).asserts.toBeNumber()
1520
+ * ```
1521
+ */
1522
+ asserts: Actual extends ((v: any, ...args: any[]) => asserts v is infer T) ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
1523
+ }
1524
+ /**
1525
+ * Represents a function that allows asserting the expected type of a value.
1526
+ */
1527
+ type _ExpectTypeOf = {
1528
+ /**
1529
+ * Asserts the expected type of a value.
1530
+ *
1531
+ * @param actual - The actual value being asserted.
1532
+ * @returns An object representing the expected type assertion.
1533
+ */
1534
+ <Actual>(actual: Actual): ExpectTypeOf<Actual, {
1535
+ positive: true;
1536
+ branded: false;
1537
+ }>;
1538
+ /**
1539
+ * Asserts the expected type of a value without providing an actual value.
1540
+ *
1541
+ * @returns An object representing the expected type assertion.
1542
+ */
1543
+ <Actual>(): ExpectTypeOf<Actual, {
1544
+ positive: true;
1545
+ branded: false;
1546
+ }>;
1547
+ };
1548
+ /**
1549
+ * Similar to Jest's `expect`, but with type-awareness.
1550
+ * Gives you access to a number of type-matchers that let you make assertions about the
1551
+ * form of a reference or generic type parameter.
1552
+ *
1553
+ * @example
1554
+ * ```ts
1555
+ * import { foo, bar } from '../foo'
1556
+ * import { expectTypeOf } from 'expect-type'
1557
+ *
1558
+ * test('foo types', () => {
1559
+ * // make sure `foo` has type { a: number }
1560
+ * expectTypeOf(foo).toMatchTypeOf({ a: 1 })
1561
+ * expectTypeOf(foo).toHaveProperty('a').toBeNumber()
1562
+ *
1563
+ * // make sure `bar` is a function taking a string:
1564
+ * expectTypeOf(bar).parameter(0).toBeString()
1565
+ * expectTypeOf(bar).returns.not.toBeAny()
1566
+ * })
1567
+ * ```
1568
+ *
1569
+ * @description
1570
+ * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
1571
+ */
1572
+ declare const expectTypeOf: _ExpectTypeOf;
1573
+ //#endregion
1574
+ export { AValue, And, BaseExpectTypeOf, ConstructorOverloadParameters, ConstructorOverloadsUnion, DecreasingConstructorOverloadsInfoUnion, DecreasingOverloadsInfoUnion, DeepBrand, DeepPickMatchingProps, Eq, ExpectAny, ExpectArray, ExpectBigInt, ExpectBoolean, ExpectFunction, ExpectNever, ExpectNull, ExpectNullable, ExpectNumber, ExpectObject, ExpectString, ExpectSymbol, ExpectTypeOf, ExpectTypeOfOptions, ExpectUndefined, ExpectUnknown, ExpectVoid, Extends, ExtendsExcludingAnyOrNever, InferConstructor, InferFunctionType, IsAny, IsNever, IsNeverOrAny, IsTuple, IsUnion, IsUnknown, IsUselessConstructorOverloadInfo, IsUselessOverloadInfo, LastOf, MismatchArgs, MismatchInfo, MutuallyExtends, NegativeExpectTypeOf, Not, NumOverloads, OptionalKeys, Or, OverloadParameters, OverloadReturnTypes, OverloadsInfoUnion, OverloadsNarrowedByParameters, PositiveExpectTypeOf, PrintType, ReadonlyKeys, RequiredKeys, Scolder, SelectOverloadsInfo, StrictEqualUsingBranding, StrictEqualUsingTSInternalIdenticalToOperator, TSPost53ConstructorOverloadsInfoUnion, TSPost53OverloadsInfoUnion, TSPre53ConstructorOverloadsInfoUnion, TSPre53OverloadsInfoUnion, Tuplify, TuplifyUnion, UnionToIntersection, UnionToTuple, UnknownConstructor, UnknownFunction, UsefulKeys, Xor, _ExpectTypeOf, expectTypeOf };