tstyche 7.2.5 → 8.0.0-beta.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 (393) hide show
  1. package/README.md +4 -0
  2. package/dist/api.d.ts +16 -761
  3. package/dist/api.js +16 -6204
  4. package/dist/bin.js +2 -3
  5. package/dist/checker/BaseCheckerAdapter.d.ts +15 -0
  6. package/dist/checker/BaseCheckerAdapter.js +32 -0
  7. package/dist/checker/CompatCheckerAdapter.d.ts +70 -0
  8. package/dist/checker/CompatCheckerAdapter.js +221 -0
  9. package/dist/checker/NativeCheckerAdapter.d.ts +70 -0
  10. package/dist/checker/NativeCheckerAdapter.js +200 -0
  11. package/dist/checker/index.d.ts +3 -0
  12. package/dist/checker/index.js +2 -0
  13. package/dist/checker/types.d.ts +9 -0
  14. package/dist/checker/types.js +1 -0
  15. package/dist/cli/Cli.d.ts +5 -0
  16. package/dist/cli/Cli.js +144 -0
  17. package/dist/cli/CliDIagnosticText.d.ts +3 -0
  18. package/dist/cli/CliDIagnosticText.js +9 -0
  19. package/dist/cli/index.d.ts +1 -0
  20. package/dist/cli/index.js +1 -0
  21. package/dist/collect/CollectDiagnosticText.d.ts +3 -0
  22. package/dist/collect/CollectDiagnosticText.js +5 -0
  23. package/dist/collect/CollectService.d.ts +9 -0
  24. package/dist/collect/CollectService.js +150 -0
  25. package/dist/collect/ExpectNode.d.ts +16 -0
  26. package/dist/collect/ExpectNode.js +30 -0
  27. package/dist/collect/IdentifierLookup.d.ts +18 -0
  28. package/dist/collect/IdentifierLookup.js +90 -0
  29. package/dist/collect/TestTree.d.ts +16 -0
  30. package/dist/collect/TestTree.js +15 -0
  31. package/dist/collect/TestTreeNode.d.ts +15 -0
  32. package/dist/collect/TestTreeNode.js +27 -0
  33. package/dist/collect/TestTreeNodeBrand.enum.d.ts +6 -0
  34. package/dist/collect/TestTreeNodeBrand.enum.js +7 -0
  35. package/dist/collect/TestTreeNodeFlags.enum.d.ts +6 -0
  36. package/dist/collect/TestTreeNodeFlags.enum.js +7 -0
  37. package/dist/collect/index.d.ts +6 -0
  38. package/dist/collect/index.js +6 -0
  39. package/dist/config/CommandParser.d.ts +7 -0
  40. package/dist/config/CommandParser.js +107 -0
  41. package/dist/config/Config.d.ts +18 -0
  42. package/dist/config/Config.js +59 -0
  43. package/dist/config/ConfigDiagnosticText.d.ts +19 -0
  44. package/dist/config/ConfigDiagnosticText.js +57 -0
  45. package/dist/config/ConfigParser.d.ts +10 -0
  46. package/dist/config/ConfigParser.js +165 -0
  47. package/dist/config/Directive.d.ts +9 -0
  48. package/dist/config/Directive.js +119 -0
  49. package/dist/config/DirectiveDiagnosticText.d.ts +5 -0
  50. package/dist/config/DirectiveDiagnosticText.js +11 -0
  51. package/dist/config/OptionBrand.enum.d.ts +8 -0
  52. package/dist/config/OptionBrand.enum.js +9 -0
  53. package/dist/config/OptionGroup.enum.d.ts +5 -0
  54. package/dist/config/OptionGroup.enum.js +6 -0
  55. package/dist/config/Options.d.ts +29 -0
  56. package/dist/config/Options.js +290 -0
  57. package/dist/config/Target.d.ts +7 -0
  58. package/dist/config/Target.js +47 -0
  59. package/dist/config/defaultOptions.d.ts +2 -0
  60. package/dist/config/defaultOptions.js +14 -0
  61. package/dist/config/index.d.ts +8 -0
  62. package/dist/config/index.js +7 -0
  63. package/dist/config/types.d.ts +55 -0
  64. package/dist/config/types.js +1 -0
  65. package/dist/diagnostic/Diagnostic.d.ts +19 -0
  66. package/dist/diagnostic/Diagnostic.js +51 -0
  67. package/dist/diagnostic/DiagnosticCategory.enum.d.ts +4 -0
  68. package/dist/diagnostic/DiagnosticCategory.enum.js +5 -0
  69. package/dist/diagnostic/DiagnosticOrigin.d.ts +13 -0
  70. package/dist/diagnostic/DiagnosticOrigin.js +27 -0
  71. package/dist/diagnostic/helpers.d.ts +6 -0
  72. package/dist/diagnostic/helpers.js +74 -0
  73. package/dist/diagnostic/index.d.ts +5 -0
  74. package/dist/diagnostic/index.js +4 -0
  75. package/dist/diagnostic/types.d.ts +2 -0
  76. package/dist/diagnostic/types.js +1 -0
  77. package/dist/editor/TextEditor.d.ts +15 -0
  78. package/dist/editor/TextEditor.js +88 -0
  79. package/dist/editor/index.d.ts +2 -0
  80. package/dist/editor/index.js +1 -0
  81. package/dist/editor/types.d.ts +4 -0
  82. package/dist/editor/types.js +1 -0
  83. package/dist/environment/Environment.d.ts +5 -0
  84. package/dist/environment/Environment.js +89 -0
  85. package/dist/environment/environmentOptions.d.ts +1 -0
  86. package/dist/environment/environmentOptions.js +2 -0
  87. package/dist/environment/index.d.ts +2 -0
  88. package/dist/environment/index.js +1 -0
  89. package/dist/environment/types.d.ts +10 -0
  90. package/dist/environment/types.js +1 -0
  91. package/dist/events/EventEmitter.d.ts +14 -0
  92. package/dist/events/EventEmitter.js +42 -0
  93. package/dist/events/index.d.ts +2 -0
  94. package/dist/events/index.js +1 -0
  95. package/dist/events/types.d.ts +88 -0
  96. package/dist/events/types.js +1 -0
  97. package/dist/expect/AbilityMatcherBase.d.ts +16 -0
  98. package/dist/expect/AbilityMatcherBase.js +52 -0
  99. package/dist/expect/Ensure.d.ts +10 -0
  100. package/dist/expect/Ensure.js +51 -0
  101. package/dist/expect/ExpectDiagnosticText.d.ts +29 -0
  102. package/dist/expect/ExpectDiagnosticText.js +87 -0
  103. package/dist/expect/ExpectService.d.ts +21 -0
  104. package/dist/expect/ExpectService.js +90 -0
  105. package/dist/expect/RelationMatcherBase.d.ts +12 -0
  106. package/dist/expect/RelationMatcherBase.js +16 -0
  107. package/dist/expect/ToAcceptProps.d.ts +10 -0
  108. package/dist/expect/ToAcceptProps.js +52 -0
  109. package/dist/expect/ToBe.d.ts +13 -0
  110. package/dist/expect/ToBe.js +18 -0
  111. package/dist/expect/ToBeApplicable.d.ts +10 -0
  112. package/dist/expect/ToBeApplicable.js +72 -0
  113. package/dist/expect/ToBeAssignableFrom.d.ts +9 -0
  114. package/dist/expect/ToBeAssignableFrom.js +12 -0
  115. package/dist/expect/ToBeAssignableTo.d.ts +9 -0
  116. package/dist/expect/ToBeAssignableTo.js +12 -0
  117. package/dist/expect/ToBeCallableWith.d.ts +11 -0
  118. package/dist/expect/ToBeCallableWith.js +29 -0
  119. package/dist/expect/ToBeConstructableWith.d.ts +11 -0
  120. package/dist/expect/ToBeConstructableWith.js +29 -0
  121. package/dist/expect/ToBeInstantiableWith.d.ts +10 -0
  122. package/dist/expect/ToBeInstantiableWith.js +31 -0
  123. package/dist/expect/ToHaveProperty.d.ts +10 -0
  124. package/dist/expect/ToHaveProperty.js +59 -0
  125. package/dist/expect/ToRaiseError.d.ts +9 -0
  126. package/dist/expect/ToRaiseError.js +82 -0
  127. package/dist/expect/index.d.ts +2 -0
  128. package/dist/expect/index.js +1 -0
  129. package/dist/expect/types.d.ts +7 -0
  130. package/dist/expect/types.js +1 -0
  131. package/dist/file/FilePosition.d.ts +7 -0
  132. package/dist/file/FilePosition.js +16 -0
  133. package/dist/file/index.d.ts +1 -0
  134. package/dist/file/index.js +1 -0
  135. package/dist/glob/Braces.d.ts +4 -0
  136. package/dist/glob/Braces.js +56 -0
  137. package/dist/glob/Glob.d.ts +4 -0
  138. package/dist/glob/Glob.js +47 -0
  139. package/dist/glob/index.d.ts +1 -0
  140. package/dist/glob/index.js +1 -0
  141. package/dist/handlers/CancellationHandler.d.ts +7 -0
  142. package/dist/handlers/CancellationHandler.js +15 -0
  143. package/dist/handlers/ExitCodeHandler.d.ts +7 -0
  144. package/dist/handlers/ExitCodeHandler.js +20 -0
  145. package/dist/handlers/ResultHandler.d.ts +5 -0
  146. package/dist/handlers/ResultHandler.js +206 -0
  147. package/dist/handlers/index.d.ts +3 -0
  148. package/dist/handlers/index.js +3 -0
  149. package/dist/index.cjs +5 -5
  150. package/dist/index.d.cts +40 -45
  151. package/dist/index.d.ts +40 -45
  152. package/dist/index.js +1 -2
  153. package/dist/input/InputService.d.ts +6 -0
  154. package/dist/input/InputService.js +16 -0
  155. package/dist/input/index.d.ts +1 -0
  156. package/dist/input/index.js +1 -0
  157. package/dist/json/JsonNode.d.ts +11 -0
  158. package/dist/json/JsonNode.js +28 -0
  159. package/dist/json/JsonScanner.d.ts +14 -0
  160. package/dist/json/JsonScanner.js +105 -0
  161. package/dist/json/index.d.ts +3 -0
  162. package/dist/json/index.js +2 -0
  163. package/dist/json/types.d.ts +1 -0
  164. package/dist/json/types.js +1 -0
  165. package/dist/layers/AbilityLayer.d.ts +10 -0
  166. package/dist/layers/AbilityLayer.js +186 -0
  167. package/dist/layers/Layers.d.ts +11 -0
  168. package/dist/layers/Layers.js +47 -0
  169. package/dist/layers/SuppressedLayer.d.ts +11 -0
  170. package/dist/layers/SuppressedLayer.js +93 -0
  171. package/dist/layers/index.d.ts +2 -0
  172. package/dist/layers/index.js +1 -0
  173. package/dist/layers/types.d.ts +8 -0
  174. package/dist/layers/types.js +1 -0
  175. package/dist/output/CodeFrameText.d.ts +10 -0
  176. package/dist/output/CodeFrameText.js +71 -0
  177. package/dist/output/OutputService.d.ts +13 -0
  178. package/dist/output/OutputService.js +38 -0
  179. package/dist/output/StreamController.d.ts +10 -0
  180. package/dist/output/StreamController.js +16 -0
  181. package/dist/output/addsText.d.ts +4 -0
  182. package/dist/output/addsText.js +8 -0
  183. package/dist/output/describeNameText.d.ts +2 -0
  184. package/dist/output/describeNameText.js +5 -0
  185. package/dist/output/diagnosticText.d.ts +4 -0
  186. package/dist/output/diagnosticText.js +23 -0
  187. package/dist/output/dotText.d.ts +3 -0
  188. package/dist/output/dotText.js +11 -0
  189. package/dist/output/fileStatusText.d.ts +4 -0
  190. package/dist/output/fileStatusText.js +26 -0
  191. package/dist/output/formattedText.d.ts +2 -0
  192. package/dist/output/formattedText.js +19 -0
  193. package/dist/output/helpText.d.ts +3 -0
  194. package/dist/output/helpText.js +52 -0
  195. package/dist/output/helpers.d.ts +5 -0
  196. package/dist/output/helpers.js +23 -0
  197. package/dist/output/index.d.ts +16 -0
  198. package/dist/output/index.js +15 -0
  199. package/dist/output/prologueText.d.ts +2 -0
  200. package/dist/output/prologueText.js +5 -0
  201. package/dist/output/summaryText.d.ts +12 -0
  202. package/dist/output/summaryText.js +31 -0
  203. package/dist/output/testNameText.d.ts +3 -0
  204. package/dist/output/testNameText.js +24 -0
  205. package/dist/output/types.d.ts +5 -0
  206. package/dist/output/types.js +1 -0
  207. package/dist/output/usesText.d.ts +5 -0
  208. package/dist/output/usesText.js +22 -0
  209. package/dist/output/waitingForFileChangesText.d.ts +2 -0
  210. package/dist/output/waitingForFileChangesText.js +5 -0
  211. package/dist/output/watchUsageText.d.ts +2 -0
  212. package/dist/output/watchUsageText.js +12 -0
  213. package/dist/path/Path.d.ts +7 -0
  214. package/dist/path/Path.js +28 -0
  215. package/dist/path/index.d.ts +1 -0
  216. package/dist/path/index.js +1 -0
  217. package/dist/project/CompatMappedDiagnostic.d.ts +12 -0
  218. package/dist/project/CompatMappedDiagnostic.js +25 -0
  219. package/dist/project/CompatProjectService.d.ts +19 -0
  220. package/dist/project/CompatProjectService.js +188 -0
  221. package/dist/project/FileMapService.d.ts +6 -0
  222. package/dist/project/FileMapService.js +14 -0
  223. package/dist/project/NativeMappedDiagnostic.d.ts +14 -0
  224. package/dist/project/NativeMappedDiagnostic.js +29 -0
  225. package/dist/project/NativeProjectService.d.ts +21 -0
  226. package/dist/project/NativeProjectService.js +216 -0
  227. package/dist/project/ProjectConfigService.d.ts +8 -0
  228. package/dist/project/ProjectConfigService.js +73 -0
  229. package/dist/project/index.d.ts +3 -0
  230. package/dist/project/index.js +2 -0
  231. package/dist/project/types.d.ts +7 -0
  232. package/dist/project/types.js +1 -0
  233. package/dist/reject/Reject.d.ts +9 -0
  234. package/dist/reject/Reject.js +43 -0
  235. package/dist/reject/RejectDiagnosticText.d.ts +5 -0
  236. package/dist/reject/RejectDiagnosticText.js +16 -0
  237. package/dist/reject/helpers.d.ts +1 -0
  238. package/dist/reject/helpers.js +3 -0
  239. package/dist/reject/index.d.ts +1 -0
  240. package/dist/reject/index.js +1 -0
  241. package/dist/reporters/BaseReporter.d.ts +7 -0
  242. package/dist/reporters/BaseReporter.js +6 -0
  243. package/dist/reporters/DotReporter.d.ts +6 -0
  244. package/dist/reporters/DotReporter.js +51 -0
  245. package/dist/reporters/FileView.d.ts +13 -0
  246. package/dist/reporters/FileView.js +33 -0
  247. package/dist/reporters/ListReporter.d.ts +6 -0
  248. package/dist/reporters/ListReporter.js +125 -0
  249. package/dist/reporters/SetupReporter.d.ts +4 -0
  250. package/dist/reporters/SetupReporter.js +21 -0
  251. package/dist/reporters/SummaryReporter.d.ts +5 -0
  252. package/dist/reporters/SummaryReporter.js +19 -0
  253. package/dist/reporters/WatchReporter.d.ts +5 -0
  254. package/dist/reporters/WatchReporter.js +21 -0
  255. package/dist/reporters/index.d.ts +7 -0
  256. package/dist/reporters/index.js +6 -0
  257. package/dist/reporters/types.d.ts +5 -0
  258. package/dist/reporters/types.js +1 -0
  259. package/dist/result/DescribeResult.d.ts +9 -0
  260. package/dist/result/DescribeResult.js +11 -0
  261. package/dist/result/ExpectResult.d.ts +10 -0
  262. package/dist/result/ExpectResult.js +11 -0
  263. package/dist/result/FileResult.d.ts +15 -0
  264. package/dist/result/FileResult.js +13 -0
  265. package/dist/result/ProjectConfigKind.enum.d.ts +6 -0
  266. package/dist/result/ProjectConfigKind.enum.js +7 -0
  267. package/dist/result/ProjectResult.d.ts +8 -0
  268. package/dist/result/ProjectResult.js +9 -0
  269. package/dist/result/Result.d.ts +13 -0
  270. package/dist/result/Result.js +14 -0
  271. package/dist/result/ResultStatus.enum.d.ts +10 -0
  272. package/dist/result/ResultStatus.enum.js +11 -0
  273. package/dist/result/SuppressedResult.d.ts +5 -0
  274. package/dist/result/SuppressedResult.js +6 -0
  275. package/dist/result/TargetResult.d.ts +11 -0
  276. package/dist/result/TargetResult.js +12 -0
  277. package/dist/result/TestResult.d.ts +13 -0
  278. package/dist/result/TestResult.js +13 -0
  279. package/dist/result/helpers.d.ts +7 -0
  280. package/dist/result/helpers.js +21 -0
  281. package/dist/result/index.d.ts +11 -0
  282. package/dist/result/index.js +10 -0
  283. package/dist/result/types.d.ts +31 -0
  284. package/dist/result/types.js +1 -0
  285. package/dist/runner/FileRunner.d.ts +10 -0
  286. package/dist/runner/FileRunner.js +93 -0
  287. package/dist/runner/FixmeDiagnosticText.d.ts +4 -0
  288. package/dist/runner/FixmeDiagnosticText.js +8 -0
  289. package/dist/runner/FixmeService.d.ts +9 -0
  290. package/dist/runner/FixmeService.js +51 -0
  291. package/dist/runner/RunModeFlags.enum.d.ts +7 -0
  292. package/dist/runner/RunModeFlags.enum.js +8 -0
  293. package/dist/runner/Runner.d.ts +9 -0
  294. package/dist/runner/Runner.js +101 -0
  295. package/dist/runner/TestTreeWalker.d.ts +19 -0
  296. package/dist/runner/TestTreeWalker.js +169 -0
  297. package/dist/runner/index.d.ts +1 -0
  298. package/dist/runner/index.js +1 -0
  299. package/dist/scribbler/Color.enum.d.ts +10 -0
  300. package/dist/scribbler/Color.enum.js +11 -0
  301. package/dist/scribbler/Line.d.ts +9 -0
  302. package/dist/scribbler/Line.js +5 -0
  303. package/dist/scribbler/Scribbler.d.ts +10 -0
  304. package/dist/scribbler/Scribbler.js +53 -0
  305. package/dist/scribbler/Text.d.ts +9 -0
  306. package/dist/scribbler/Text.js +8 -0
  307. package/dist/scribbler/index.d.ts +5 -0
  308. package/dist/scribbler/index.js +4 -0
  309. package/dist/scribbler/jsxRuntime.d.ts +4 -0
  310. package/dist/scribbler/jsxRuntime.js +4 -0
  311. package/dist/scribbler/types.d.ts +19 -0
  312. package/dist/scribbler/types.js +1 -0
  313. package/dist/select/Select.d.ts +7 -0
  314. package/dist/select/Select.js +91 -0
  315. package/dist/select/SelectDiagnosticText.d.ts +6 -0
  316. package/dist/select/SelectDiagnosticText.js +24 -0
  317. package/dist/select/index.d.ts +2 -0
  318. package/dist/select/index.js +2 -0
  319. package/dist/store/Fetcher.d.ts +8 -0
  320. package/dist/store/Fetcher.js +52 -0
  321. package/dist/store/Lock.d.ts +5 -0
  322. package/dist/store/Lock.js +17 -0
  323. package/dist/store/LockService.d.ts +8 -0
  324. package/dist/store/LockService.js +36 -0
  325. package/dist/store/Manifest.d.ts +35 -0
  326. package/dist/store/Manifest.js +58 -0
  327. package/dist/store/ManifestService.d.ts +10 -0
  328. package/dist/store/ManifestService.js +129 -0
  329. package/dist/store/PackageService.d.ts +8 -0
  330. package/dist/store/PackageService.js +69 -0
  331. package/dist/store/Store.d.ts +12 -0
  332. package/dist/store/Store.js +103 -0
  333. package/dist/store/StoreDiagnosticText.d.ts +12 -0
  334. package/dist/store/StoreDiagnosticText.js +36 -0
  335. package/dist/store/TarReader.d.ts +9 -0
  336. package/dist/store/TarReader.js +56 -0
  337. package/dist/store/helpers.d.ts +1 -0
  338. package/dist/store/helpers.js +3 -0
  339. package/dist/store/index.d.ts +1 -0
  340. package/dist/store/index.js +1 -0
  341. package/dist/structure/ComparisonResult.enum.d.ts +5 -0
  342. package/dist/structure/ComparisonResult.enum.js +6 -0
  343. package/dist/structure/Structure.d.ts +24 -0
  344. package/dist/structure/Structure.js +481 -0
  345. package/dist/structure/index.d.ts +1 -0
  346. package/dist/structure/index.js +1 -0
  347. package/dist/suppressed/SuppressedDiagnosticText.d.ts +6 -0
  348. package/dist/suppressed/SuppressedDiagnosticText.js +18 -0
  349. package/dist/suppressed/SuppressedService.d.ts +5 -0
  350. package/dist/suppressed/SuppressedService.js +61 -0
  351. package/dist/suppressed/index.d.ts +1 -0
  352. package/dist/suppressed/index.js +1 -0
  353. package/dist/tag.d.ts +1 -3
  354. package/dist/tag.js +2 -5
  355. package/dist/text/TextFile.d.ts +11 -0
  356. package/dist/text/TextFile.js +41 -0
  357. package/dist/text/TextFileService.d.ts +10 -0
  358. package/dist/text/TextFileService.js +31 -0
  359. package/dist/text/index.d.ts +3 -0
  360. package/dist/text/index.js +2 -0
  361. package/dist/text/types.d.ts +5 -0
  362. package/dist/text/types.js +1 -0
  363. package/dist/token/CancellationReason.enum.d.ts +6 -0
  364. package/dist/token/CancellationReason.enum.js +7 -0
  365. package/dist/token/CancellationToken.d.ts +8 -0
  366. package/dist/token/CancellationToken.js +22 -0
  367. package/dist/token/index.d.ts +2 -0
  368. package/dist/token/index.js +2 -0
  369. package/dist/typescript/BaseAdapter.d.ts +36 -0
  370. package/dist/typescript/BaseAdapter.js +83 -0
  371. package/dist/typescript/CompatTypeScript.d.ts +21 -0
  372. package/dist/typescript/CompatTypeScript.js +37 -0
  373. package/dist/typescript/NativeTypeScript.d.ts +24 -0
  374. package/dist/typescript/NativeTypeScript.js +44 -0
  375. package/dist/typescript/index.d.ts +3 -0
  376. package/dist/typescript/index.js +2 -0
  377. package/dist/typescript/types.d.ts +69 -0
  378. package/dist/typescript/types.js +1 -0
  379. package/dist/version/Version.d.ts +6 -0
  380. package/dist/version/Version.js +30 -0
  381. package/dist/version/index.d.ts +1 -0
  382. package/dist/version/index.js +1 -0
  383. package/dist/watch/Debounce.d.ts +9 -0
  384. package/dist/watch/Debounce.js +27 -0
  385. package/dist/watch/FileWatcher.d.ts +5 -0
  386. package/dist/watch/FileWatcher.js +12 -0
  387. package/dist/watch/WatchService.d.ts +8 -0
  388. package/dist/watch/WatchService.js +96 -0
  389. package/dist/watch/Watcher.d.ts +10 -0
  390. package/dist/watch/Watcher.js +31 -0
  391. package/dist/watch/index.d.ts +3 -0
  392. package/dist/watch/index.js +3 -0
  393. package/package.json +9 -1
@@ -0,0 +1,15 @@
1
+ import type * as ts from "#typescript";
2
+ import type { Offset } from "./types.js";
3
+ export declare class TextEditor {
4
+ #private;
5
+ static getOffset(position: number, offsets: Array<Offset>): number;
6
+ open(sourceFile: ts.SourceFile): void;
7
+ close(): void;
8
+ erase(start: number, end: number): this;
9
+ eraseTrailingComma(node: ts.NodeArray<ts.Node>): this;
10
+ insert(position: number, text: string): this;
11
+ getFilePath(): string;
12
+ getOffsets(): Array<Offset>;
13
+ getText(): string;
14
+ update(start: number, end: number, text: string): this;
15
+ }
@@ -0,0 +1,88 @@
1
+ export class TextEditor {
2
+ #filePath = "";
3
+ #offset = 0;
4
+ #offsets = [];
5
+ #text = "";
6
+ static getOffset(position, offsets) {
7
+ let diff = 0;
8
+ for (const offset of offsets) {
9
+ if (offset.position > position - diff) {
10
+ break;
11
+ }
12
+ diff += offset.diff;
13
+ }
14
+ return diff;
15
+ }
16
+ open(sourceFile) {
17
+ this.#filePath = sourceFile.fileName;
18
+ this.#text = sourceFile.text;
19
+ this.#offset = 0;
20
+ this.#offsets = [];
21
+ }
22
+ close() {
23
+ this.#filePath = "";
24
+ this.#text = "";
25
+ this.#offset = 0;
26
+ this.#offsets = [];
27
+ }
28
+ erase(start, end) {
29
+ this.#text =
30
+ this.#text.slice(0, start + this.#offset) +
31
+ this.#getErased(start + this.#offset, end + this.#offset) +
32
+ this.#text.slice(end + this.#offset);
33
+ return this;
34
+ }
35
+ eraseTrailingComma(node) {
36
+ if (node.hasTrailingComma) {
37
+ this.erase(node.end - 1, node.end);
38
+ }
39
+ return this;
40
+ }
41
+ insert(position, text) {
42
+ this.update(position, position, text);
43
+ return this;
44
+ }
45
+ #getErased(start, end) {
46
+ if (this.#text.indexOf("\n", start) >= end) {
47
+ return " ".repeat(end - start);
48
+ }
49
+ const text = [];
50
+ for (let index = start; index < end; index++) {
51
+ const character = this.#text.charAt(index);
52
+ switch (character) {
53
+ case "\n":
54
+ case "\r":
55
+ text.push(character);
56
+ break;
57
+ default:
58
+ text.push(" ");
59
+ }
60
+ }
61
+ return text.join("");
62
+ }
63
+ getFilePath() {
64
+ return this.#filePath;
65
+ }
66
+ getOffsets() {
67
+ return this.#offsets;
68
+ }
69
+ getText() {
70
+ return this.#text;
71
+ }
72
+ #setOffset(start, end, text) {
73
+ const diff = text.length - (end - start);
74
+ if (diff > 0) {
75
+ this.#offset += diff;
76
+ this.#offsets.push({ position: end, diff });
77
+ }
78
+ }
79
+ update(start, end, text) {
80
+ this.#text =
81
+ this.#text.slice(0, start + this.#offset) +
82
+ text +
83
+ this.#getErased(start + this.#offset, end + this.#offset).slice(text.length) +
84
+ this.#text.slice(end + this.#offset);
85
+ this.#setOffset(start, end, text);
86
+ return this;
87
+ }
88
+ }
@@ -0,0 +1,2 @@
1
+ export { TextEditor } from "./TextEditor.js";
2
+ export type { Offset } from "./types.js";
@@ -0,0 +1 @@
1
+ export { TextEditor } from "./TextEditor.js";
@@ -0,0 +1,4 @@
1
+ export interface Offset {
2
+ position: number;
3
+ diff: number;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { EnvironmentOptions } from "./types.js";
2
+ export declare class Environment {
3
+ #private;
4
+ static resolve(): EnvironmentOptions;
5
+ }
@@ -0,0 +1,89 @@
1
+ import os from "node:os";
2
+ import process from "node:process";
3
+ import { Path } from "#path";
4
+ export class Environment {
5
+ static resolve() {
6
+ return {
7
+ fetchRetries: Environment.#resolveFetchRetries(),
8
+ fetchTimeout: Environment.#resolveFetchTimeout(),
9
+ isCi: Environment.#resolveIsCi(),
10
+ noColor: Environment.#resolveNoColor(),
11
+ noInteractive: Environment.#resolveNoInteractive(),
12
+ npmRegistry: Environment.#resolveNpmRegistry(),
13
+ storePath: Environment.#resolveStorePath(),
14
+ typescriptSpecifier: Environment.#resolveTypeScriptSpecifier(),
15
+ };
16
+ }
17
+ static #resolveFetchRetries() {
18
+ if (process.env["TSTYCHE_FETCH_RETRIES"] != null) {
19
+ return Number(process.env["TSTYCHE_FETCH_RETRIES"]);
20
+ }
21
+ return 2;
22
+ }
23
+ static #resolveFetchTimeout() {
24
+ if (process.env["TSTYCHE_FETCH_TIMEOUT"] != null) {
25
+ return Number.parseFloat(process.env["TSTYCHE_FETCH_TIMEOUT"]);
26
+ }
27
+ return 30;
28
+ }
29
+ static #resolveIsCi() {
30
+ if (process.env["CI"] != null) {
31
+ return process.env["CI"] !== "";
32
+ }
33
+ return false;
34
+ }
35
+ static #resolveNoColor() {
36
+ if (process.env["TSTYCHE_NO_COLOR"] != null) {
37
+ return process.env["TSTYCHE_NO_COLOR"] !== "";
38
+ }
39
+ if (process.env["NO_COLOR"] != null) {
40
+ return process.env["NO_COLOR"] !== "";
41
+ }
42
+ return false;
43
+ }
44
+ static #resolveNoInteractive() {
45
+ if (process.env["TSTYCHE_NO_INTERACTIVE"] != null) {
46
+ return process.env["TSTYCHE_NO_INTERACTIVE"] !== "";
47
+ }
48
+ return !process.stdout.isTTY;
49
+ }
50
+ static #resolveNpmRegistry() {
51
+ if (process.env["TSTYCHE_NPM_REGISTRY"] != null) {
52
+ return process.env["TSTYCHE_NPM_REGISTRY"];
53
+ }
54
+ return "https://registry.npmjs.org";
55
+ }
56
+ static #resolveStorePath() {
57
+ if (process.env["TSTYCHE_STORE_PATH"] != null) {
58
+ return Path.resolve(process.env["TSTYCHE_STORE_PATH"]);
59
+ }
60
+ if (process.platform === "darwin") {
61
+ return Path.resolve(os.homedir(), "Library", "TSTyche");
62
+ }
63
+ if (process.env["LocalAppData"] != null) {
64
+ return Path.resolve(process.env["LocalAppData"], "TSTyche");
65
+ }
66
+ if (process.env["XDG_DATA_HOME"] != null) {
67
+ return Path.resolve(process.env["XDG_DATA_HOME"], "TSTyche");
68
+ }
69
+ return Path.resolve(os.homedir(), ".local", "share", "TSTyche");
70
+ }
71
+ static #resolveTypeScriptSpecifier() {
72
+ function resolve(specifier) {
73
+ return import.meta.resolve(`${specifier}/package.json`).replace(/package\.json$/, "");
74
+ }
75
+ if (process.env["TSTYCHE_TYPESCRIPT_SPECIFIER"] != null) {
76
+ const specifier = process.env["TSTYCHE_TYPESCRIPT_SPECIFIER"];
77
+ if (specifier !== "") {
78
+ return resolve(specifier);
79
+ }
80
+ return;
81
+ }
82
+ try {
83
+ return resolve("typescript");
84
+ }
85
+ catch {
86
+ }
87
+ return;
88
+ }
89
+ }
@@ -0,0 +1 @@
1
+ export declare const environmentOptions: import("./types.js").EnvironmentOptions;
@@ -0,0 +1,2 @@
1
+ import { Environment } from "./Environment.js";
2
+ export const environmentOptions = Environment.resolve();
@@ -0,0 +1,2 @@
1
+ export { environmentOptions } from "./environmentOptions.js";
2
+ export type { EnvironmentOptions } from "./types.js";
@@ -0,0 +1 @@
1
+ export { environmentOptions } from "./environmentOptions.js";
@@ -0,0 +1,10 @@
1
+ export interface EnvironmentOptions {
2
+ fetchRetries: number;
3
+ fetchTimeout: number;
4
+ isCi: boolean;
5
+ noColor: boolean;
6
+ noInteractive: boolean;
7
+ npmRegistry: string;
8
+ storePath: string;
9
+ typescriptSpecifier: string | undefined;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Reporter } from "#reporters";
2
+ import type { Event, EventHandler } from "./types.js";
3
+ export declare class EventEmitter {
4
+ #private;
5
+ static instanceCount: number;
6
+ constructor();
7
+ addHandler(handler: EventHandler): void;
8
+ addReporter(reporter: Reporter): void;
9
+ static dispatch(event: Event): void;
10
+ removeHandler(handler: EventHandler): void;
11
+ removeReporter(reporter: Reporter): void;
12
+ removeHandlers(): void;
13
+ removeReporters(): void;
14
+ }
@@ -0,0 +1,42 @@
1
+ export class EventEmitter {
2
+ static instanceCount = 0;
3
+ static #handlers = new Map();
4
+ static #reporters = new Map();
5
+ #scope;
6
+ constructor() {
7
+ this.#scope = EventEmitter.instanceCount++;
8
+ EventEmitter.#handlers.set(this.#scope, new Set());
9
+ EventEmitter.#reporters.set(this.#scope, new Set());
10
+ }
11
+ addHandler(handler) {
12
+ EventEmitter.#handlers.get(this.#scope)?.add(handler);
13
+ }
14
+ addReporter(reporter) {
15
+ EventEmitter.#reporters.get(this.#scope)?.add(reporter);
16
+ }
17
+ static dispatch(event) {
18
+ function forEachHandler(handlers, event) {
19
+ for (const handler of handlers) {
20
+ handler.on(event);
21
+ }
22
+ }
23
+ for (const handlers of EventEmitter.#handlers.values()) {
24
+ forEachHandler(handlers, event);
25
+ }
26
+ for (const handlers of EventEmitter.#reporters.values()) {
27
+ forEachHandler(handlers, event);
28
+ }
29
+ }
30
+ removeHandler(handler) {
31
+ EventEmitter.#handlers.get(this.#scope)?.delete(handler);
32
+ }
33
+ removeReporter(reporter) {
34
+ EventEmitter.#reporters.get(this.#scope)?.delete(reporter);
35
+ }
36
+ removeHandlers() {
37
+ EventEmitter.#handlers.get(this.#scope)?.clear();
38
+ }
39
+ removeReporters() {
40
+ EventEmitter.#reporters.get(this.#scope)?.clear();
41
+ }
42
+ }
@@ -0,0 +1,2 @@
1
+ export { EventEmitter } from "./EventEmitter.js";
2
+ export type { Event, EventHandler } from "./types.js";
@@ -0,0 +1 @@
1
+ export { EventEmitter } from "./EventEmitter.js";
@@ -0,0 +1,88 @@
1
+ import type { ExpectNode, TestTree, TestTreeNode } from "#collect";
2
+ import type { Diagnostic } from "#diagnostic";
3
+ import type { DescribeResult, ExpectResult, FileResult, ProjectConfig, Result, SuppressedResult, TargetResult, TestResult } from "#result";
4
+ export type Event = ["config:error", {
5
+ diagnostics: Array<Diagnostic>;
6
+ }] | ["select:error", {
7
+ diagnostics: Array<Diagnostic>;
8
+ }] | ["run:start", {
9
+ result: Result;
10
+ }] | ["run:end", {
11
+ result: Result;
12
+ }] | ["store:adds", {
13
+ packagePath: string;
14
+ packageVersion: string;
15
+ }] | ["store:error", {
16
+ diagnostics: Array<Diagnostic>;
17
+ }] | ["target:start", {
18
+ result: TargetResult;
19
+ }] | ["target:end", {
20
+ result: TargetResult;
21
+ }] | ["project:uses", {
22
+ compilerVersion: string;
23
+ projectConfig: ProjectConfig;
24
+ }] | ["project:error", {
25
+ diagnostics: Array<Diagnostic>;
26
+ }] | ["file:start", {
27
+ result: FileResult;
28
+ }] | ["file:error", {
29
+ diagnostics: Array<Diagnostic>;
30
+ result: FileResult;
31
+ }] | ["file:end", {
32
+ result: FileResult;
33
+ }] | ["directive:error", {
34
+ diagnostics: Array<Diagnostic>;
35
+ }] | ["collect:start", {
36
+ tree: TestTree;
37
+ }] | ["collect:error", {
38
+ diagnostics: Array<Diagnostic>;
39
+ }] | ["collect:node", {
40
+ node: TestTreeNode | ExpectNode;
41
+ }] | ["collect:end", {
42
+ tree: TestTree;
43
+ }] | ["describe:start", {
44
+ result: DescribeResult;
45
+ }] | ["describe:end", {
46
+ result: DescribeResult;
47
+ }] | ["test:start", {
48
+ result: TestResult;
49
+ }] | ["test:error", {
50
+ diagnostics: Array<Diagnostic>;
51
+ result: TestResult;
52
+ }] | ["test:fail", {
53
+ result: TestResult;
54
+ }] | ["test:pass", {
55
+ result: TestResult;
56
+ }] | ["test:skip", {
57
+ result: TestResult;
58
+ }] | ["test:fixme", {
59
+ result: TestResult;
60
+ }] | ["test:todo", {
61
+ result: TestResult;
62
+ }] | ["expect:start", {
63
+ result: ExpectResult;
64
+ }] | ["expect:error", {
65
+ diagnostics: Array<Diagnostic>;
66
+ result: ExpectResult;
67
+ }] | ["expect:fail", {
68
+ diagnostics: Array<Diagnostic>;
69
+ result: ExpectResult;
70
+ }] | ["expect:pass", {
71
+ result: ExpectResult;
72
+ }] | ["expect:skip", {
73
+ result: ExpectResult;
74
+ }] | ["expect:fixme", {
75
+ result: ExpectResult;
76
+ }] | ["suppressed:error", {
77
+ diagnostics: Array<Diagnostic>;
78
+ result: SuppressedResult;
79
+ }] | ["suppressed:match", {
80
+ result: SuppressedResult;
81
+ }] | ["suppressed:ignore", {
82
+ result: SuppressedResult;
83
+ }] | ["watch:error", {
84
+ diagnostics: Array<Diagnostic>;
85
+ }];
86
+ export interface EventHandler {
87
+ on: (event: Event) => void;
88
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { Checker } from "#checker";
2
+ import type { ExpectNode } from "#collect";
3
+ import { Diagnostic, type DiagnosticsHandler } from "#diagnostic";
4
+ import type * as ts from "#typescript";
5
+ import type { ArgumentNode, MatchResult } from "./types.js";
6
+ export declare abstract class AbilityMatcherBase {
7
+ protected checker: Checker;
8
+ protected ts: ts.TypeScript;
9
+ constructor(ts: ts.TypeScript, checker: Checker);
10
+ abstract explainText(isExpression: boolean, targetText?: string): string;
11
+ abstract explainNotText(isExpression: boolean, targetText?: string): string;
12
+ protected getArgumentCountText(nodes: ts.NodeArray<ArgumentNode>): string;
13
+ protected getTypeArgumentCountText(targetNode: ts.TupleTypeNode): string;
14
+ explain(expectNode: ExpectNode, sourceNode: ArgumentNode, targetNode: ts.NodeArray<ArgumentNode> | ArgumentNode, getArgumentCountText?: () => string): Array<Diagnostic>;
15
+ abstract match(expectNode: ExpectNode, sourceNode: ArgumentNode, targetNodes: ts.NodeArray<ArgumentNode> | ArgumentNode | undefined, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): MatchResult | undefined;
16
+ }
@@ -0,0 +1,52 @@
1
+ import { Diagnostic, DiagnosticOrigin, diagnosticBelongsToNode, getDiagnosticMessageText, isDiagnosticLocation, isDiagnosticPosition, } from "#diagnostic";
2
+ export class AbilityMatcherBase {
3
+ checker;
4
+ ts;
5
+ constructor(ts, checker) {
6
+ this.ts = ts;
7
+ this.checker = checker;
8
+ }
9
+ getArgumentCountText(nodes) {
10
+ if (nodes.length === 0) {
11
+ return "without arguments";
12
+ }
13
+ if (nodes.length === 1 && nodes[0]?.kind === this.ts.SyntaxKind.SpreadElement) {
14
+ return "with the given arguments";
15
+ }
16
+ return `with the given argument${nodes.length === 1 ? "" : "s"}`;
17
+ }
18
+ getTypeArgumentCountText(targetNode) {
19
+ if (targetNode.elements.length === 0) {
20
+ return "without type arguments";
21
+ }
22
+ return `with the given type argument${targetNode.elements.length === 1 ? "" : "s"}`;
23
+ }
24
+ explain(expectNode, sourceNode, targetNode, getArgumentCountText) {
25
+ const isExpression = this.ts.belongsToArgumentList(sourceNode);
26
+ const argumentCountText = getArgumentCountText?.();
27
+ const diagnostics = [];
28
+ if (expectNode.abilityDiagnostics.size > 0) {
29
+ for (const diagnostic of expectNode.abilityDiagnostics) {
30
+ const text = [this.explainNotText(isExpression, argumentCountText), ...getDiagnosticMessageText(diagnostic)];
31
+ let origin;
32
+ if ((isDiagnosticPosition(diagnostic) || isDiagnosticLocation(diagnostic)) &&
33
+ diagnosticBelongsToNode(diagnostic, targetNode)) {
34
+ origin = DiagnosticOrigin.fromAbilityDiagnostic(diagnostic, expectNode);
35
+ }
36
+ else {
37
+ origin = DiagnosticOrigin.fromAssertion(expectNode);
38
+ }
39
+ let related;
40
+ if (diagnostic.relatedInformation != null) {
41
+ related = Diagnostic.fromDiagnostics(diagnostic.relatedInformation);
42
+ }
43
+ diagnostics.push(Diagnostic.error(text, origin).add({ related }));
44
+ }
45
+ }
46
+ else {
47
+ const origin = DiagnosticOrigin.fromAssertion(expectNode);
48
+ diagnostics.push(Diagnostic.error(this.explainText(isExpression, argumentCountText), origin));
49
+ }
50
+ return diagnostics;
51
+ }
52
+ }
@@ -0,0 +1,10 @@
1
+ import { Diagnostic, type DiagnosticsHandler } from "#diagnostic";
2
+ import type * as ts from "#typescript";
3
+ export declare class Ensure {
4
+ #private;
5
+ constructor(ts: ts.TypeScript, program: ts.Program);
6
+ argument<T extends ts.Node>(node: T | undefined, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
7
+ argumentOrTypeArgument<T extends ts.Node>(node: T | undefined, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
8
+ jsxSetup(node: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): boolean;
9
+ typeArgument<T extends ts.Node>(node: T | undefined, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
10
+ }
@@ -0,0 +1,51 @@
1
+ import { Diagnostic, DiagnosticOrigin } from "#diagnostic";
2
+ export class Ensure {
3
+ #compilerOptions;
4
+ #ts;
5
+ constructor(ts, program) {
6
+ this.#ts = ts;
7
+ this.#compilerOptions = program.getCompilerOptions();
8
+ }
9
+ argument(node, enclosingNode, onDiagnostics) {
10
+ if (!node || !this.#ts.belongsToArgumentList(node)) {
11
+ this.#emitDiagnostic("An argument must be provided.", enclosingNode, onDiagnostics);
12
+ return false;
13
+ }
14
+ return true;
15
+ }
16
+ argumentOrTypeArgument(node, enclosingNode, onDiagnostics) {
17
+ if (!node) {
18
+ this.#emitDiagnostic("An argument or type argument must be provided.", enclosingNode, onDiagnostics);
19
+ return false;
20
+ }
21
+ return true;
22
+ }
23
+ jsxSetup(node, onDiagnostics) {
24
+ const diagnosticText = [];
25
+ if (!this.#compilerOptions.jsx) {
26
+ diagnosticText.push("The matcher requires the 'jsx' compiler option to be configured.");
27
+ }
28
+ if (node.getSourceFile().languageVariant !== this.#ts.LanguageVariant.JSX) {
29
+ diagnosticText.push("The matcher requires a '.tsx' file extension.");
30
+ }
31
+ if (diagnosticText.length > 0) {
32
+ this.#emitDiagnostic(diagnosticText, node, onDiagnostics);
33
+ return false;
34
+ }
35
+ return true;
36
+ }
37
+ typeArgument(node, enclosingNode, onDiagnostics) {
38
+ if (!node || this.#ts.belongsToArgumentList(node)) {
39
+ this.#emitDiagnostic("A type argument must be provided.", enclosingNode, onDiagnostics);
40
+ return false;
41
+ }
42
+ return true;
43
+ }
44
+ #emitDiagnostic(text, enclosingNode, onDiagnostics) {
45
+ if (!Array.isArray(text)) {
46
+ text = [text];
47
+ }
48
+ const origin = DiagnosticOrigin.fromNode(enclosingNode);
49
+ onDiagnostics(text.map((text) => Diagnostic.error(text, origin)));
50
+ }
51
+ }
@@ -0,0 +1,29 @@
1
+ export declare class ExpectDiagnosticText {
2
+ static argumentMustBe(expectedText: string): string;
3
+ static typeArgumentMustBe(expectedText: string): string;
4
+ static isCallable(isExpression: boolean, targetText: string): string;
5
+ static isNotCallable(isExpression: boolean, targetText: string): string;
6
+ static isConstructable(isExpression: boolean, targetText: string): string;
7
+ static isNotConstructable(isExpression: boolean, targetText: string): string;
8
+ static isInstantiable(isExpression: boolean, targetText: string): string;
9
+ static isNotInstantiable(isExpression: boolean, targetText: string): string;
10
+ static acceptsProps(isExpression: boolean): string;
11
+ static doesNotAcceptProps(isExpression: boolean): string;
12
+ static canBeApplied(targetText: string): string;
13
+ static cannotBeApplied(targetText: string): string;
14
+ static hasProperty(typeText: string, propertyNameText: string): string;
15
+ static doesNotHaveProperty(typeText: string, propertyNameText: string): string;
16
+ static didYouMeanToUse(suggestionText: string): string;
17
+ static matcherIsNotSupported(matcherNameText: string): string;
18
+ static raisedTypeError(count?: number): string;
19
+ static raisedError(isExpression: boolean, count: number, targetCount: number): string;
20
+ static didNotRaiseError(isExpression: boolean): string;
21
+ static raisedMatchingError(isExpression: boolean): string;
22
+ static didNotRaiseMatchingError(isExpression: boolean): string;
23
+ static isAssignableTo(sourceTypeText: string, targetTypeText: string): string;
24
+ static isNotAssignableTo(sourceTypeText: string, targetTypeText: string): string;
25
+ static isAssignableFrom(sourceTypeText: string, targetTypeText: string): string;
26
+ static isNotAssignableFrom(sourceTypeText: string, targetTypeText: string): string;
27
+ static isTheSame(sourceTypeText: string, targetTypeText: string): string;
28
+ static isNotTheSame(sourceTypeText: string, targetTypeText: string): string;
29
+ }
@@ -0,0 +1,87 @@
1
+ export class ExpectDiagnosticText {
2
+ static argumentMustBe(expectedText) {
3
+ return `The argument must be ${expectedText}.`;
4
+ }
5
+ static typeArgumentMustBe(expectedText) {
6
+ return `The type argument must be ${expectedText}.`;
7
+ }
8
+ static isCallable(isExpression, targetText) {
9
+ return `${isExpression ? "Expression" : "Type"} is callable ${targetText}.`;
10
+ }
11
+ static isNotCallable(isExpression, targetText) {
12
+ return `${isExpression ? "Expression" : "Type"} is not callable ${targetText}.`;
13
+ }
14
+ static isConstructable(isExpression, targetText) {
15
+ return `${isExpression ? "Expression" : "Type"} is constructable ${targetText}.`;
16
+ }
17
+ static isNotConstructable(isExpression, targetText) {
18
+ return `${isExpression ? "Expression" : "Type"} is not constructable ${targetText}.`;
19
+ }
20
+ static isInstantiable(isExpression, targetText) {
21
+ return `${isExpression ? "Expression" : "Type"} is instantiable ${targetText}.`;
22
+ }
23
+ static isNotInstantiable(isExpression, targetText) {
24
+ return `${isExpression ? "Expression" : "Type"} is not instantiable ${targetText}.`;
25
+ }
26
+ static acceptsProps(isExpression) {
27
+ return `${isExpression ? "Component" : "Type"} accepts props of the given type.`;
28
+ }
29
+ static doesNotAcceptProps(isExpression) {
30
+ return `${isExpression ? "Component" : "Type"} does not accept props of the given type.`;
31
+ }
32
+ static canBeApplied(targetText) {
33
+ return `The decorator function can be applied${targetText}.`;
34
+ }
35
+ static cannotBeApplied(targetText) {
36
+ return `The decorator function cannot be applied${targetText}.`;
37
+ }
38
+ static hasProperty(typeText, propertyNameText) {
39
+ return `Type '${typeText}' has property '${propertyNameText}'.`;
40
+ }
41
+ static doesNotHaveProperty(typeText, propertyNameText) {
42
+ return `Type '${typeText}' does not have property '${propertyNameText}'.`;
43
+ }
44
+ static didYouMeanToUse(suggestionText) {
45
+ return `Did you mean to use ${suggestionText}?`;
46
+ }
47
+ static matcherIsNotSupported(matcherNameText) {
48
+ return `The '.${matcherNameText}()' matcher is not supported.`;
49
+ }
50
+ static raisedTypeError(count = 1) {
51
+ return `The raised type error${count === 1 ? "" : "s"}:`;
52
+ }
53
+ static raisedError(isExpression, count, targetCount) {
54
+ let countText = "a";
55
+ if (count > 1 || targetCount > 1) {
56
+ countText = count > targetCount ? `${count}` : `only ${count}`;
57
+ }
58
+ return `${isExpression ? "Expression" : "Type"} raised ${countText} type error${count === 1 ? "" : "s"}.`;
59
+ }
60
+ static didNotRaiseError(isExpression) {
61
+ return `${isExpression ? "Expression" : "Type"} did not raise a type error.`;
62
+ }
63
+ static raisedMatchingError(isExpression) {
64
+ return `${isExpression ? "Expression" : "Type"} raised a matching type error.`;
65
+ }
66
+ static didNotRaiseMatchingError(isExpression) {
67
+ return `${isExpression ? "Expression" : "Type"} did not raise a matching type error.`;
68
+ }
69
+ static isAssignableTo(sourceTypeText, targetTypeText) {
70
+ return `Type '${sourceTypeText}' is assignable to type '${targetTypeText}'.`;
71
+ }
72
+ static isNotAssignableTo(sourceTypeText, targetTypeText) {
73
+ return `Type '${sourceTypeText}' is not assignable to type '${targetTypeText}'.`;
74
+ }
75
+ static isAssignableFrom(sourceTypeText, targetTypeText) {
76
+ return `Type '${sourceTypeText}' is assignable from type '${targetTypeText}'.`;
77
+ }
78
+ static isNotAssignableFrom(sourceTypeText, targetTypeText) {
79
+ return `Type '${sourceTypeText}' is not assignable from type '${targetTypeText}'.`;
80
+ }
81
+ static isTheSame(sourceTypeText, targetTypeText) {
82
+ return `Type '${sourceTypeText}' is the same as type '${targetTypeText}'.`;
83
+ }
84
+ static isNotTheSame(sourceTypeText, targetTypeText) {
85
+ return `Type '${sourceTypeText}' is not the same as type '${targetTypeText}'.`;
86
+ }
87
+ }