tsc-ts 0.0.4 → 0.0.5

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 (584) hide show
  1. package/README.md +33 -1
  2. package/dist/api/compiler/ast-utilities.d.ts +82 -0
  3. package/dist/api/compiler/ast-utilities.js +462 -0
  4. package/dist/api/compiler/ast.d.ts +2350 -0
  5. package/dist/api/compiler/ast.js +11206 -0
  6. package/dist/api/compiler/astnav.d.ts +37 -0
  7. package/dist/api/compiler/astnav.js +767 -0
  8. package/dist/api/compiler/binder-utilities.d.ts +182 -0
  9. package/dist/api/compiler/binder-utilities.js +1240 -0
  10. package/dist/api/compiler/binder.d.ts +33 -0
  11. package/dist/api/compiler/binder.js +2358 -0
  12. package/dist/api/compiler/character-codes.d.ts +161 -0
  13. package/dist/api/compiler/character-codes.js +160 -0
  14. package/dist/api/compiler/checker-calls.d.ts +46 -0
  15. package/dist/api/compiler/checker-calls.js +1640 -0
  16. package/dist/api/compiler/checker-classes.d.ts +30 -0
  17. package/dist/api/compiler/checker-classes.js +582 -0
  18. package/dist/api/compiler/checker-contextual.d.ts +77 -0
  19. package/dist/api/compiler/checker-contextual.js +1136 -0
  20. package/dist/api/compiler/checker-declaration-order.d.ts +12 -0
  21. package/dist/api/compiler/checker-declaration-order.js +356 -0
  22. package/dist/api/compiler/checker-declarations.d.ts +33 -0
  23. package/dist/api/compiler/checker-declarations.js +888 -0
  24. package/dist/api/compiler/checker-declared-types.d.ts +48 -0
  25. package/dist/api/compiler/checker-declared-types.js +787 -0
  26. package/dist/api/compiler/checker-decorators.d.ts +26 -0
  27. package/dist/api/compiler/checker-decorators.js +562 -0
  28. package/dist/api/compiler/checker-deprecation.d.ts +33 -0
  29. package/dist/api/compiler/checker-deprecation.js +315 -0
  30. package/dist/api/compiler/checker-destructuring.d.ts +34 -0
  31. package/dist/api/compiler/checker-destructuring.js +584 -0
  32. package/dist/api/compiler/checker-elaboration.d.ts +15 -0
  33. package/dist/api/compiler/checker-elaboration.js +290 -0
  34. package/dist/api/compiler/checker-emit-helpers.d.ts +58 -0
  35. package/dist/api/compiler/checker-emit-helpers.js +154 -0
  36. package/dist/api/compiler/checker-emit-resolver.d.ts +75 -0
  37. package/dist/api/compiler/checker-emit-resolver.js +579 -0
  38. package/dist/api/compiler/checker-evaluator.d.ts +27 -0
  39. package/dist/api/compiler/checker-evaluator.js +188 -0
  40. package/dist/api/compiler/checker-expressions.d.ts +67 -0
  41. package/dist/api/compiler/checker-expressions.js +1351 -0
  42. package/dist/api/compiler/checker-features.d.ts +6 -0
  43. package/dist/api/compiler/checker-features.js +354 -0
  44. package/dist/api/compiler/checker-flow.d.ts +86 -0
  45. package/dist/api/compiler/checker-flow.js +169 -0
  46. package/dist/api/compiler/checker-functions.d.ts +43 -0
  47. package/dist/api/compiler/checker-functions.js +1002 -0
  48. package/dist/api/compiler/checker-generated-code.d.ts +25 -0
  49. package/dist/api/compiler/checker-generated-code.js +168 -0
  50. package/dist/api/compiler/checker-globals.d.ts +14 -0
  51. package/dist/api/compiler/checker-globals.js +37 -0
  52. package/dist/api/compiler/checker-grammar.d.ts +35 -0
  53. package/dist/api/compiler/checker-grammar.js +2573 -0
  54. package/dist/api/compiler/checker-heritage.d.ts +28 -0
  55. package/dist/api/compiler/checker-heritage.js +900 -0
  56. package/dist/api/compiler/checker-inference.d.ts +179 -0
  57. package/dist/api/compiler/checker-inference.js +2105 -0
  58. package/dist/api/compiler/checker-iteration.d.ts +115 -0
  59. package/dist/api/compiler/checker-iteration.js +857 -0
  60. package/dist/api/compiler/checker-javascript.d.ts +42 -0
  61. package/dist/api/compiler/checker-javascript.js +441 -0
  62. package/dist/api/compiler/checker-jsdoc.d.ts +30 -0
  63. package/dist/api/compiler/checker-jsdoc.js +320 -0
  64. package/dist/api/compiler/checker-jsx.d.ts +94 -0
  65. package/dist/api/compiler/checker-jsx.js +1433 -0
  66. package/dist/api/compiler/checker-literals.d.ts +6 -0
  67. package/dist/api/compiler/checker-literals.js +43 -0
  68. package/dist/api/compiler/checker-members.d.ts +198 -0
  69. package/dist/api/compiler/checker-members.js +2126 -0
  70. package/dist/api/compiler/checker-modules.d.ts +85 -0
  71. package/dist/api/compiler/checker-modules.js +2141 -0
  72. package/dist/api/compiler/checker-narrowing.d.ts +120 -0
  73. package/dist/api/compiler/checker-narrowing.js +2797 -0
  74. package/dist/api/compiler/checker-object-literals.d.ts +14 -0
  75. package/dist/api/compiler/checker-object-literals.js +479 -0
  76. package/dist/api/compiler/checker-operators.d.ts +33 -0
  77. package/dist/api/compiler/checker-operators.js +1040 -0
  78. package/dist/api/compiler/checker-overloads.d.ts +7 -0
  79. package/dist/api/compiler/checker-overloads.js +270 -0
  80. package/dist/api/compiler/checker-property-access.d.ts +34 -0
  81. package/dist/api/compiler/checker-property-access.js +672 -0
  82. package/dist/api/compiler/checker-services.d.ts +49 -0
  83. package/dist/api/compiler/checker-services.js +995 -0
  84. package/dist/api/compiler/checker-signatures.d.ts +55 -0
  85. package/dist/api/compiler/checker-signatures.js +788 -0
  86. package/dist/api/compiler/checker-source-file.d.ts +27 -0
  87. package/dist/api/compiler/checker-source-file.js +619 -0
  88. package/dist/api/compiler/checker-statements.d.ts +18 -0
  89. package/dist/api/compiler/checker-statements.js +226 -0
  90. package/dist/api/compiler/checker-super.d.ts +13 -0
  91. package/dist/api/compiler/checker-super.js +241 -0
  92. package/dist/api/compiler/checker-symbol-types.d.ts +67 -0
  93. package/dist/api/compiler/checker-symbol-types.js +1885 -0
  94. package/dist/api/compiler/checker-symbols.d.ts +181 -0
  95. package/dist/api/compiler/checker-symbols.js +1782 -0
  96. package/dist/api/compiler/checker-type-factory.d.ts +142 -0
  97. package/dist/api/compiler/checker-type-factory.js +2501 -0
  98. package/dist/api/compiler/checker-type-nodes.d.ts +26 -0
  99. package/dist/api/compiler/checker-type-nodes.js +828 -0
  100. package/dist/api/compiler/checker-type-operators.d.ts +109 -0
  101. package/dist/api/compiler/checker-type-operators.js +1842 -0
  102. package/dist/api/compiler/checker-types.d.ts +1027 -0
  103. package/dist/api/compiler/checker-types.js +1697 -0
  104. package/dist/api/compiler/checker-unused.d.ts +19 -0
  105. package/dist/api/compiler/checker-unused.js +524 -0
  106. package/dist/api/compiler/checker-utilities.d.ts +33 -0
  107. package/dist/api/compiler/checker-utilities.js +141 -0
  108. package/dist/api/compiler/checker.d.ts +491 -0
  109. package/dist/api/compiler/checker.js +912 -0
  110. package/dist/api/compiler/command-line.d.ts +32 -0
  111. package/dist/api/compiler/command-line.js +383 -0
  112. package/dist/api/compiler/compile-program.d.ts +118 -0
  113. package/dist/api/compiler/compile-program.js +384 -0
  114. package/dist/api/compiler/diagnostic-locales.d.ts +22 -0
  115. package/dist/api/compiler/diagnostic-locales.js +64 -0
  116. package/dist/api/compiler/diagnostic-messages.d.ts +2166 -0
  117. package/dist/api/compiler/diagnostic-messages.js +184 -0
  118. package/dist/api/compiler/diagnostics.d.ts +167 -0
  119. package/dist/api/compiler/diagnostics.js +820 -0
  120. package/dist/api/compiler/emitter.d.ts +71 -0
  121. package/dist/api/compiler/emitter.js +327 -0
  122. package/dist/api/compiler/file-include.d.ts +117 -0
  123. package/dist/api/compiler/file-include.js +536 -0
  124. package/dist/api/compiler/file-loader.d.ts +261 -0
  125. package/dist/api/compiler/file-loader.js +1257 -0
  126. package/dist/api/compiler/file-system.d.ts +51 -0
  127. package/dist/api/compiler/file-system.js +132 -0
  128. package/dist/api/compiler/flow.d.ts +60 -0
  129. package/dist/api/compiler/flow.js +45 -0
  130. package/dist/api/compiler/instantiation.d.ts +74 -0
  131. package/dist/api/compiler/instantiation.js +799 -0
  132. package/dist/api/compiler/jsdoc.d.ts +75 -0
  133. package/dist/api/compiler/jsdoc.js +1229 -0
  134. package/dist/api/compiler/link-tables.d.ts +36 -0
  135. package/dist/api/compiler/link-tables.js +83 -0
  136. package/dist/api/compiler/locale-data.d.ts +24 -0
  137. package/dist/api/compiler/locale-data.js +183 -0
  138. package/dist/api/compiler/locale.d.ts +4 -0
  139. package/dist/api/compiler/locale.js +317 -0
  140. package/dist/api/compiler/locales/cs-CZ.d.ts +2 -0
  141. package/dist/api/compiler/locales/cs-CZ.js +3 -0
  142. package/dist/api/compiler/locales/de-DE.d.ts +2 -0
  143. package/dist/api/compiler/locales/de-DE.js +3 -0
  144. package/dist/api/compiler/locales/es-ES.d.ts +2 -0
  145. package/dist/api/compiler/locales/es-ES.js +3 -0
  146. package/dist/api/compiler/locales/fr-FR.d.ts +2 -0
  147. package/dist/api/compiler/locales/fr-FR.js +3 -0
  148. package/dist/api/compiler/locales/it-IT.d.ts +2 -0
  149. package/dist/api/compiler/locales/it-IT.js +3 -0
  150. package/dist/api/compiler/locales/ja-JP.d.ts +2 -0
  151. package/dist/api/compiler/locales/ja-JP.js +3 -0
  152. package/dist/api/compiler/locales/ko-KR.d.ts +2 -0
  153. package/dist/api/compiler/locales/ko-KR.js +3 -0
  154. package/dist/api/compiler/locales/pl-PL.d.ts +2 -0
  155. package/dist/api/compiler/locales/pl-PL.js +3 -0
  156. package/dist/api/compiler/locales/pt-BR.d.ts +2 -0
  157. package/dist/api/compiler/locales/pt-BR.js +3 -0
  158. package/dist/api/compiler/locales/ru-RU.d.ts +2 -0
  159. package/dist/api/compiler/locales/ru-RU.js +3 -0
  160. package/dist/api/compiler/locales/tr-TR.d.ts +2 -0
  161. package/dist/api/compiler/locales/tr-TR.js +3 -0
  162. package/dist/api/compiler/locales/zh-CN.d.ts +2 -0
  163. package/dist/api/compiler/locales/zh-CN.js +3 -0
  164. package/dist/api/compiler/locales/zh-TW.d.ts +2 -0
  165. package/dist/api/compiler/locales/zh-TW.js +3 -0
  166. package/dist/api/compiler/module-resolution-types.d.ts +83 -0
  167. package/dist/api/compiler/module-resolution-types.js +176 -0
  168. package/dist/api/compiler/module-resolution.d.ts +71 -0
  169. package/dist/api/compiler/module-resolution.js +1598 -0
  170. package/dist/api/compiler/module-specifiers.d.ts +64 -0
  171. package/dist/api/compiler/module-specifiers.js +1101 -0
  172. package/dist/api/compiler/name-resolver.d.ts +43 -0
  173. package/dist/api/compiler/name-resolver.js +509 -0
  174. package/dist/api/compiler/node-builder-names.d.ts +32 -0
  175. package/dist/api/compiler/node-builder-names.js +854 -0
  176. package/dist/api/compiler/node-builder-pseudo.d.ts +36 -0
  177. package/dist/api/compiler/node-builder-pseudo.js +744 -0
  178. package/dist/api/compiler/node-builder-reuse.d.ts +4 -0
  179. package/dist/api/compiler/node-builder-reuse.js +647 -0
  180. package/dist/api/compiler/node-builder.d.ts +270 -0
  181. package/dist/api/compiler/node-builder.js +2645 -0
  182. package/dist/api/compiler/option-declarations.d.ts +90 -0
  183. package/dist/api/compiler/option-declarations.js +1460 -0
  184. package/dist/api/compiler/options.d.ts +289 -0
  185. package/dist/api/compiler/options.js +1197 -0
  186. package/dist/api/compiler/output-paths.d.ts +42 -0
  187. package/dist/api/compiler/output-paths.js +195 -0
  188. package/dist/api/compiler/package-json.d.ts +175 -0
  189. package/dist/api/compiler/package-json.js +1015 -0
  190. package/dist/api/compiler/parallel-parse.d.ts +219 -0
  191. package/dist/api/compiler/parallel-parse.js +537 -0
  192. package/dist/api/compiler/parser.d.ts +587 -0
  193. package/dist/api/compiler/parser.js +6407 -0
  194. package/dist/api/compiler/path.d.ts +91 -0
  195. package/dist/api/compiler/path.js +705 -0
  196. package/dist/api/compiler/printer/async-helpers.d.ts +22 -0
  197. package/dist/api/compiler/printer/async-helpers.js +91 -0
  198. package/dist/api/compiler/printer/auto-generate.d.ts +13 -0
  199. package/dist/api/compiler/printer/auto-generate.js +20 -0
  200. package/dist/api/compiler/printer/decorator-helpers.d.ts +24 -0
  201. package/dist/api/compiler/printer/decorator-helpers.js +118 -0
  202. package/dist/api/compiler/printer/emit-context.d.ts +154 -0
  203. package/dist/api/compiler/printer/emit-context.js +576 -0
  204. package/dist/api/compiler/printer/emit-flags.d.ts +60 -0
  205. package/dist/api/compiler/printer/emit-flags.js +2 -0
  206. package/dist/api/compiler/printer/factory-base.d.ts +171 -0
  207. package/dist/api/compiler/printer/factory-base.js +1505 -0
  208. package/dist/api/compiler/printer/factory.d.ts +147 -0
  209. package/dist/api/compiler/printer/factory.js +542 -0
  210. package/dist/api/compiler/printer/helpers.d.ts +27 -0
  211. package/dist/api/compiler/printer/helpers.js +164 -0
  212. package/dist/api/compiler/printer/name-generator.d.ts +41 -0
  213. package/dist/api/compiler/printer/name-generator.js +283 -0
  214. package/dist/api/compiler/printer/printer.d.ts +411 -0
  215. package/dist/api/compiler/printer/printer.js +4517 -0
  216. package/dist/api/compiler/printer/text-writer.d.ts +46 -0
  217. package/dist/api/compiler/printer/text-writer.js +172 -0
  218. package/dist/api/compiler/printer/utilities.d.ts +82 -0
  219. package/dist/api/compiler/printer/utilities.js +817 -0
  220. package/dist/api/compiler/program-checker.d.ts +156 -0
  221. package/dist/api/compiler/program-checker.js +526 -0
  222. package/dist/api/compiler/program-utilities.d.ts +52 -0
  223. package/dist/api/compiler/program-utilities.js +365 -0
  224. package/dist/api/compiler/program.d.ts +180 -0
  225. package/dist/api/compiler/program.js +1011 -0
  226. package/dist/api/compiler/pseudo-bigint.d.ts +5 -0
  227. package/dist/api/compiler/pseudo-bigint.js +61 -0
  228. package/dist/api/compiler/regexp-checker.d.ts +38 -0
  229. package/dist/api/compiler/regexp-checker.js +942 -0
  230. package/dist/api/compiler/relations.d.ts +263 -0
  231. package/dist/api/compiler/relations.js +4002 -0
  232. package/dist/api/compiler/reparser.d.ts +48 -0
  233. package/dist/api/compiler/reparser.js +1323 -0
  234. package/dist/api/compiler/scanner.d.ts +256 -0
  235. package/dist/api/compiler/scanner.js +2853 -0
  236. package/dist/api/compiler/side-state.d.ts +16 -0
  237. package/dist/api/compiler/side-state.js +89 -0
  238. package/dist/api/compiler/sourcemap.d.ts +55 -0
  239. package/dist/api/compiler/sourcemap.js +340 -0
  240. package/dist/api/compiler/spelling.d.ts +14 -0
  241. package/dist/api/compiler/spelling.js +128 -0
  242. package/dist/api/compiler/symbol-accessibility.d.ts +57 -0
  243. package/dist/api/compiler/symbol-accessibility.js +894 -0
  244. package/dist/api/compiler/symbol.d.ts +240 -0
  245. package/dist/api/compiler/symbol.js +228 -0
  246. package/dist/api/compiler/symlinks.d.ts +32 -0
  247. package/dist/api/compiler/symlinks.js +114 -0
  248. package/dist/api/compiler/syntax-kind.d.ts +389 -0
  249. package/dist/api/compiler/syntax-kind.js +2 -0
  250. package/dist/api/compiler/timeline.d.ts +9 -0
  251. package/dist/api/compiler/timeline.js +54 -0
  252. package/dist/api/compiler/transformers/alias-references.d.ts +39 -0
  253. package/dist/api/compiler/transformers/alias-references.js +676 -0
  254. package/dist/api/compiler/transformers/async-utilities.d.ts +51 -0
  255. package/dist/api/compiler/transformers/async-utilities.js +260 -0
  256. package/dist/api/compiler/transformers/async.d.ts +53 -0
  257. package/dist/api/compiler/transformers/async.js +645 -0
  258. package/dist/api/compiler/transformers/class-fields.d.ts +206 -0
  259. package/dist/api/compiler/transformers/class-fields.js +2418 -0
  260. package/dist/api/compiler/transformers/class-utilities.d.ts +46 -0
  261. package/dist/api/compiler/transformers/class-utilities.js +261 -0
  262. package/dist/api/compiler/transformers/commonjs-module.d.ts +103 -0
  263. package/dist/api/compiler/transformers/commonjs-module.js +1180 -0
  264. package/dist/api/compiler/transformers/const-enum-inliner.d.ts +11 -0
  265. package/dist/api/compiler/transformers/const-enum-inliner.js +36 -0
  266. package/dist/api/compiler/transformers/declarations-diagnostics.d.ts +52 -0
  267. package/dist/api/compiler/transformers/declarations-diagnostics.js +538 -0
  268. package/dist/api/compiler/transformers/declarations-pseudo.d.ts +160 -0
  269. package/dist/api/compiler/transformers/declarations-pseudo.js +797 -0
  270. package/dist/api/compiler/transformers/declarations-resolver.d.ts +152 -0
  271. package/dist/api/compiler/transformers/declarations-resolver.js +35 -0
  272. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +119 -0
  273. package/dist/api/compiler/transformers/declarations-syntactic.js +1582 -0
  274. package/dist/api/compiler/transformers/declarations-tracker.d.ts +46 -0
  275. package/dist/api/compiler/transformers/declarations-tracker.js +197 -0
  276. package/dist/api/compiler/transformers/declarations.d.ts +175 -0
  277. package/dist/api/compiler/transformers/declarations.js +2380 -0
  278. package/dist/api/compiler/transformers/decorator-metadata.d.ts +54 -0
  279. package/dist/api/compiler/transformers/decorator-metadata.js +554 -0
  280. package/dist/api/compiler/transformers/decorator-utilities.d.ts +38 -0
  281. package/dist/api/compiler/transformers/decorator-utilities.js +238 -0
  282. package/dist/api/compiler/transformers/destructuring.d.ts +25 -0
  283. package/dist/api/compiler/transformers/destructuring.js +626 -0
  284. package/dist/api/compiler/transformers/downlevel.d.ts +6 -0
  285. package/dist/api/compiler/transformers/downlevel.js +45 -0
  286. package/dist/api/compiler/transformers/emit-resolver.d.ts +61 -0
  287. package/dist/api/compiler/transformers/emit-resolver.js +197 -0
  288. package/dist/api/compiler/transformers/es-decorators.d.ts +118 -0
  289. package/dist/api/compiler/transformers/es-decorators.js +1901 -0
  290. package/dist/api/compiler/transformers/exponentiation.d.ts +11 -0
  291. package/dist/api/compiler/transformers/exponentiation.js +76 -0
  292. package/dist/api/compiler/transformers/external-module-info.d.ts +35 -0
  293. package/dist/api/compiler/transformers/external-module-info.js +351 -0
  294. package/dist/api/compiler/transformers/for-await.d.ts +43 -0
  295. package/dist/api/compiler/transformers/for-await.js +469 -0
  296. package/dist/api/compiler/transformers/import-elision.d.ts +16 -0
  297. package/dist/api/compiler/transformers/import-elision.js +124 -0
  298. package/dist/api/compiler/transformers/jsx-entities.d.ts +1 -0
  299. package/dist/api/compiler/transformers/jsx-entities.js +256 -0
  300. package/dist/api/compiler/transformers/jsx.d.ts +71 -0
  301. package/dist/api/compiler/transformers/jsx.js +700 -0
  302. package/dist/api/compiler/transformers/legacy-decorators.d.ts +56 -0
  303. package/dist/api/compiler/transformers/legacy-decorators.js +564 -0
  304. package/dist/api/compiler/transformers/logical-assignment.d.ts +14 -0
  305. package/dist/api/compiler/transformers/logical-assignment.js +62 -0
  306. package/dist/api/compiler/transformers/module-utilities.d.ts +9 -0
  307. package/dist/api/compiler/transformers/module-utilities.js +36 -0
  308. package/dist/api/compiler/transformers/module.d.ts +49 -0
  309. package/dist/api/compiler/transformers/module.js +296 -0
  310. package/dist/api/compiler/transformers/named-evaluation.d.ts +26 -0
  311. package/dist/api/compiler/transformers/named-evaluation.js +266 -0
  312. package/dist/api/compiler/transformers/nullish-coalescing.d.ts +9 -0
  313. package/dist/api/compiler/transformers/nullish-coalescing.js +26 -0
  314. package/dist/api/compiler/transformers/object-rest-spread.d.ts +34 -0
  315. package/dist/api/compiler/transformers/object-rest-spread.js +411 -0
  316. package/dist/api/compiler/transformers/optional-catch.d.ts +9 -0
  317. package/dist/api/compiler/transformers/optional-catch.js +20 -0
  318. package/dist/api/compiler/transformers/optional-chain.d.ts +14 -0
  319. package/dist/api/compiler/transformers/optional-chain.js +188 -0
  320. package/dist/api/compiler/transformers/reference-resolver.d.ts +128 -0
  321. package/dist/api/compiler/transformers/reference-resolver.js +1155 -0
  322. package/dist/api/compiler/transformers/runtime-syntax.d.ts +71 -0
  323. package/dist/api/compiler/transformers/runtime-syntax.js +753 -0
  324. package/dist/api/compiler/transformers/subtree-facts.d.ts +9 -0
  325. package/dist/api/compiler/transformers/subtree-facts.js +203 -0
  326. package/dist/api/compiler/transformers/syntax-facts.d.ts +51 -0
  327. package/dist/api/compiler/transformers/syntax-facts.js +254 -0
  328. package/dist/api/compiler/transformers/tagged-template.d.ts +17 -0
  329. package/dist/api/compiler/transformers/tagged-template.js +148 -0
  330. package/dist/api/compiler/transformers/transformer.d.ts +17 -0
  331. package/dist/api/compiler/transformers/transformer.js +54 -0
  332. package/dist/api/compiler/transformers/type-eraser.d.ts +21 -0
  333. package/dist/api/compiler/transformers/type-eraser.js +346 -0
  334. package/dist/api/compiler/transformers/type-serialization.d.ts +20 -0
  335. package/dist/api/compiler/transformers/type-serialization.js +347 -0
  336. package/dist/api/compiler/transformers/using.d.ts +56 -0
  337. package/dist/api/compiler/transformers/using.js +453 -0
  338. package/dist/api/compiler/transformers/utilities.d.ts +50 -0
  339. package/dist/api/compiler/transformers/utilities.js +347 -0
  340. package/dist/api/compiler/transformers/visitor-base.d.ts +6 -0
  341. package/dist/api/compiler/transformers/visitor-base.js +817 -0
  342. package/dist/api/compiler/transformers/visitor-hooks.d.ts +29 -0
  343. package/dist/api/compiler/transformers/visitor-hooks.js +189 -0
  344. package/dist/api/compiler/tsconfig.d.ts +177 -0
  345. package/dist/api/compiler/tsconfig.js +1311 -0
  346. package/dist/api/compiler/type-printer.d.ts +15 -0
  347. package/dist/api/compiler/type-printer.js +74 -0
  348. package/dist/api/compiler/types.d.ts +87 -0
  349. package/dist/api/compiler/types.js +23 -0
  350. package/dist/api/compiler/unicode-identifiers.d.ts +2 -0
  351. package/dist/api/compiler/unicode-identifiers.js +209 -0
  352. package/dist/api/compiler/unicode-properties.d.ts +8 -0
  353. package/dist/api/compiler/unicode-properties.js +531 -0
  354. package/dist/api/compiler/vfs-match.d.ts +24 -0
  355. package/dist/api/compiler/vfs-match.js +587 -0
  356. package/dist/api/library/ast.d.ts +3 -2
  357. package/dist/api/library/ast.generated.d.ts +127 -139
  358. package/dist/api/library/checker.d.ts +51 -0
  359. package/dist/api/library/checker.js +318 -0
  360. package/dist/api/library/diagnostics.d.ts +13 -0
  361. package/dist/api/library/diagnostics.js +50 -0
  362. package/dist/api/library/disk.d.ts +13 -0
  363. package/dist/api/library/disk.js +66 -0
  364. package/dist/api/library/errors.d.ts +13 -0
  365. package/dist/api/library/errors.js +24 -0
  366. package/dist/api/library/host.d.ts +24 -0
  367. package/dist/api/library/host.js +52 -0
  368. package/dist/api/library/index.d.ts +5 -1
  369. package/dist/api/library/index.js +4 -0
  370. package/dist/api/library/nodes.d.ts +51 -0
  371. package/dist/api/library/nodes.js +196 -0
  372. package/dist/api/library/options.d.ts +144 -0
  373. package/dist/api/library/options.js +308 -0
  374. package/dist/api/library/parse.d.ts +19 -0
  375. package/dist/api/library/parse.js +41 -0
  376. package/dist/api/library/program.d.ts +21 -0
  377. package/dist/api/library/program.js +234 -0
  378. package/dist/api/library/types.d.ts +14 -1
  379. package/package.json +12 -8
  380. package/src/compiler/ast-utilities.ts +548 -0
  381. package/src/compiler/ast.ts +12862 -0
  382. package/src/compiler/astnav.ts +799 -0
  383. package/src/compiler/binder-utilities.ts +1392 -0
  384. package/src/compiler/binder.ts +2703 -0
  385. package/src/compiler/build-info.ts +1197 -0
  386. package/src/compiler/character-codes.ts +323 -0
  387. package/src/compiler/checker-calls.ts +2155 -0
  388. package/src/compiler/checker-classes.ts +706 -0
  389. package/src/compiler/checker-contextual.ts +1457 -0
  390. package/src/compiler/checker-declaration-order.ts +438 -0
  391. package/src/compiler/checker-declarations.ts +1194 -0
  392. package/src/compiler/checker-declared-types.ts +919 -0
  393. package/src/compiler/checker-decorators.ts +694 -0
  394. package/src/compiler/checker-deprecation.ts +359 -0
  395. package/src/compiler/checker-destructuring.ts +805 -0
  396. package/src/compiler/checker-elaboration.ts +477 -0
  397. package/src/compiler/checker-emit-helpers.ts +224 -0
  398. package/src/compiler/checker-emit-resolver.ts +769 -0
  399. package/src/compiler/checker-evaluator.ts +243 -0
  400. package/src/compiler/checker-expressions.ts +1831 -0
  401. package/src/compiler/checker-features.ts +361 -0
  402. package/src/compiler/checker-flow.ts +394 -0
  403. package/src/compiler/checker-functions.ts +1296 -0
  404. package/src/compiler/checker-generated-code.ts +227 -0
  405. package/src/compiler/checker-globals.ts +52 -0
  406. package/src/compiler/checker-grammar.ts +3584 -0
  407. package/src/compiler/checker-heritage.ts +1233 -0
  408. package/src/compiler/checker-inference.ts +2576 -0
  409. package/src/compiler/checker-iteration.ts +1206 -0
  410. package/src/compiler/checker-javascript.ts +502 -0
  411. package/src/compiler/checker-jsdoc.ts +360 -0
  412. package/src/compiler/checker-jsx.ts +1924 -0
  413. package/src/compiler/checker-literals.ts +61 -0
  414. package/src/compiler/checker-members.ts +2436 -0
  415. package/src/compiler/checker-modules.ts +2886 -0
  416. package/src/compiler/checker-narrowing.ts +3230 -0
  417. package/src/compiler/checker-object-literals.ts +575 -0
  418. package/src/compiler/checker-operators.ts +1422 -0
  419. package/src/compiler/checker-overloads.ts +328 -0
  420. package/src/compiler/checker-property-access.ts +906 -0
  421. package/src/compiler/checker-services.ts +1149 -0
  422. package/src/compiler/checker-signatures.ts +1032 -0
  423. package/src/compiler/checker-source-file.ts +732 -0
  424. package/src/compiler/checker-statements.ts +292 -0
  425. package/src/compiler/checker-super.ts +261 -0
  426. package/src/compiler/checker-symbol-types.ts +2107 -0
  427. package/src/compiler/checker-symbols.ts +2150 -0
  428. package/src/compiler/checker-type-factory.ts +2579 -0
  429. package/src/compiler/checker-type-nodes.ts +1033 -0
  430. package/src/compiler/checker-type-operators.ts +2502 -0
  431. package/src/compiler/checker-types.ts +2340 -0
  432. package/src/compiler/checker-unused.ts +642 -0
  433. package/src/compiler/checker-utilities.ts +161 -0
  434. package/src/compiler/checker.ts +1116 -0
  435. package/src/compiler/command-line.ts +436 -0
  436. package/src/compiler/compile-program.ts +439 -0
  437. package/src/compiler/decoder.ts +1209 -0
  438. package/src/compiler/diagnostic-locales.ts +86 -0
  439. package/src/compiler/diagnostic-messages.ts +2349 -0
  440. package/src/compiler/diagnostics.ts +897 -0
  441. package/src/compiler/emitter.ts +434 -0
  442. package/src/compiler/encoder.ts +1945 -0
  443. package/src/compiler/file-include.ts +673 -0
  444. package/src/compiler/file-loader.ts +1528 -0
  445. package/src/compiler/file-system.ts +143 -0
  446. package/src/compiler/flow.ts +89 -0
  447. package/src/compiler/help.ts +473 -0
  448. package/src/compiler/incremental.ts +2784 -0
  449. package/src/compiler/init.ts +141 -0
  450. package/src/compiler/instantiation.ts +894 -0
  451. package/src/compiler/jsdoc.ts +1386 -0
  452. package/src/compiler/link-tables.ts +98 -0
  453. package/src/compiler/locale-data.ts +203 -0
  454. package/src/compiler/locale.ts +307 -0
  455. package/src/compiler/locales/cs-CZ.ts +5 -0
  456. package/src/compiler/locales/de-DE.ts +5 -0
  457. package/src/compiler/locales/es-ES.ts +5 -0
  458. package/src/compiler/locales/fr-FR.ts +5 -0
  459. package/src/compiler/locales/it-IT.ts +5 -0
  460. package/src/compiler/locales/ja-JP.ts +5 -0
  461. package/src/compiler/locales/ko-KR.ts +5 -0
  462. package/src/compiler/locales/pl-PL.ts +5 -0
  463. package/src/compiler/locales/pt-BR.ts +5 -0
  464. package/src/compiler/locales/ru-RU.ts +5 -0
  465. package/src/compiler/locales/tr-TR.ts +5 -0
  466. package/src/compiler/locales/zh-CN.ts +5 -0
  467. package/src/compiler/locales/zh-TW.ts +5 -0
  468. package/src/compiler/module-resolution-types.ts +243 -0
  469. package/src/compiler/module-resolution.ts +2072 -0
  470. package/src/compiler/module-specifiers.ts +1491 -0
  471. package/src/compiler/name-resolver.ts +646 -0
  472. package/src/compiler/node-builder-names.ts +1069 -0
  473. package/src/compiler/node-builder-pseudo.ts +892 -0
  474. package/src/compiler/node-builder-reuse.ts +764 -0
  475. package/src/compiler/node-builder.ts +3425 -0
  476. package/src/compiler/option-declarations.ts +1560 -0
  477. package/src/compiler/options.ts +1576 -0
  478. package/src/compiler/output-paths.ts +334 -0
  479. package/src/compiler/package-json.ts +1083 -0
  480. package/src/compiler/parallel-check.ts +1951 -0
  481. package/src/compiler/parallel-parse.ts +590 -0
  482. package/src/compiler/parse-thread.ts +140 -0
  483. package/src/compiler/parser.ts +7716 -0
  484. package/src/compiler/path.ts +717 -0
  485. package/src/compiler/printer/async-helpers.ts +183 -0
  486. package/src/compiler/printer/auto-generate.ts +27 -0
  487. package/src/compiler/printer/decorator-helpers.ts +218 -0
  488. package/src/compiler/printer/emit-context.ts +679 -0
  489. package/src/compiler/printer/emit-flags.ts +64 -0
  490. package/src/compiler/printer/factory-base.ts +2577 -0
  491. package/src/compiler/printer/factory.ts +764 -0
  492. package/src/compiler/printer/helpers.ts +291 -0
  493. package/src/compiler/printer/name-generator.ts +372 -0
  494. package/src/compiler/printer/printer.ts +5072 -0
  495. package/src/compiler/printer/text-writer.ts +183 -0
  496. package/src/compiler/printer/utilities.ts +884 -0
  497. package/src/compiler/program-checker.ts +592 -0
  498. package/src/compiler/program-utilities.ts +435 -0
  499. package/src/compiler/program.ts +1419 -0
  500. package/src/compiler/pseudo-bigint.ts +62 -0
  501. package/src/compiler/regexp-checker.ts +1142 -0
  502. package/src/compiler/relations.ts +5149 -0
  503. package/src/compiler/reparser.ts +1566 -0
  504. package/src/compiler/scanner.ts +2951 -0
  505. package/src/compiler/show-config.ts +239 -0
  506. package/src/compiler/side-state.ts +125 -0
  507. package/src/compiler/sourcemap.ts +366 -0
  508. package/src/compiler/spelling.ts +122 -0
  509. package/src/compiler/symbol-accessibility.ts +1071 -0
  510. package/src/compiler/symbol.ts +439 -0
  511. package/src/compiler/symlinks.ts +137 -0
  512. package/src/compiler/syntax-kind.ts +391 -0
  513. package/src/compiler/thread-entry.ts +191 -0
  514. package/src/compiler/timeline.ts +53 -0
  515. package/src/compiler/transformers/alias-references.ts +757 -0
  516. package/src/compiler/transformers/async-utilities.ts +335 -0
  517. package/src/compiler/transformers/async.ts +838 -0
  518. package/src/compiler/transformers/class-fields.ts +2967 -0
  519. package/src/compiler/transformers/class-utilities.ts +324 -0
  520. package/src/compiler/transformers/commonjs-module.ts +1621 -0
  521. package/src/compiler/transformers/const-enum-inliner.ts +50 -0
  522. package/src/compiler/transformers/declarations-diagnostics.ts +832 -0
  523. package/src/compiler/transformers/declarations-pseudo.ts +966 -0
  524. package/src/compiler/transformers/declarations-resolver.ts +249 -0
  525. package/src/compiler/transformers/declarations-syntactic.ts +1859 -0
  526. package/src/compiler/transformers/declarations-tracker.ts +269 -0
  527. package/src/compiler/transformers/declarations.ts +3120 -0
  528. package/src/compiler/transformers/decorator-metadata.ts +697 -0
  529. package/src/compiler/transformers/decorator-utilities.ts +283 -0
  530. package/src/compiler/transformers/destructuring.ts +708 -0
  531. package/src/compiler/transformers/downlevel.ts +50 -0
  532. package/src/compiler/transformers/emit-resolver.ts +258 -0
  533. package/src/compiler/transformers/es-decorators.ts +2682 -0
  534. package/src/compiler/transformers/exponentiation.ts +80 -0
  535. package/src/compiler/transformers/external-module-info.ts +412 -0
  536. package/src/compiler/transformers/for-await.ts +687 -0
  537. package/src/compiler/transformers/import-elision.ts +152 -0
  538. package/src/compiler/transformers/jsx-entities.ts +256 -0
  539. package/src/compiler/transformers/jsx.ts +824 -0
  540. package/src/compiler/transformers/legacy-decorators.ts +726 -0
  541. package/src/compiler/transformers/logical-assignment.ts +75 -0
  542. package/src/compiler/transformers/module-utilities.ts +42 -0
  543. package/src/compiler/transformers/module.ts +474 -0
  544. package/src/compiler/transformers/named-evaluation.ts +389 -0
  545. package/src/compiler/transformers/nullish-coalescing.ts +35 -0
  546. package/src/compiler/transformers/object-rest-spread.ts +577 -0
  547. package/src/compiler/transformers/optional-catch.ts +29 -0
  548. package/src/compiler/transformers/optional-chain.ts +246 -0
  549. package/src/compiler/transformers/reference-resolver.ts +1201 -0
  550. package/src/compiler/transformers/runtime-syntax.ts +942 -0
  551. package/src/compiler/transformers/subtree-facts.ts +245 -0
  552. package/src/compiler/transformers/syntax-facts.ts +353 -0
  553. package/src/compiler/transformers/tagged-template.ts +167 -0
  554. package/src/compiler/transformers/transformer.ts +56 -0
  555. package/src/compiler/transformers/type-eraser.ts +520 -0
  556. package/src/compiler/transformers/type-serialization.ts +374 -0
  557. package/src/compiler/transformers/using.ts +613 -0
  558. package/src/compiler/transformers/utilities.ts +419 -0
  559. package/src/compiler/transformers/visitor-base.ts +1601 -0
  560. package/src/compiler/transformers/visitor-hooks.ts +252 -0
  561. package/src/compiler/tsc-build.ts +1418 -0
  562. package/src/compiler/tsc-cli.ts +666 -0
  563. package/src/compiler/tsc-compile.ts +437 -0
  564. package/src/compiler/tsc-watch.ts +854 -0
  565. package/src/compiler/tsconfig.ts +1574 -0
  566. package/src/compiler/type-printer.ts +110 -0
  567. package/src/compiler/types.ts +115 -0
  568. package/src/compiler/unicode-identifiers.ts +212 -0
  569. package/src/compiler/unicode-properties.ts +537 -0
  570. package/src/compiler/vfs-match.ts +597 -0
  571. package/src/compiler/xxh3.ts +650 -0
  572. package/src/library/ast.generated.ts +141 -167
  573. package/src/library/ast.ts +4 -1
  574. package/src/library/checker.ts +384 -0
  575. package/src/library/diagnostics.ts +72 -0
  576. package/src/library/disk.ts +73 -0
  577. package/src/library/errors.ts +26 -0
  578. package/src/library/host.ts +63 -0
  579. package/src/library/index.ts +21 -0
  580. package/src/library/nodes.ts +232 -0
  581. package/src/library/options.ts +449 -0
  582. package/src/library/parse.ts +63 -0
  583. package/src/library/program.ts +293 -0
  584. package/src/library/types.ts +14 -1
@@ -0,0 +1,1697 @@
1
+ import { getSymbolId } from './symbol.js';
2
+ /** The sign bit, which TypeScript enums can't hold as a positive flag. */
3
+ export const typeFlagsReserved3 = -2147483648;
4
+ export function cachedTypeKey(kind, id) {
5
+ return id * 32 + kind;
6
+ }
7
+ /** Type ids below this bound pack in pairs into a `cachedTypesByPair` key. */
8
+ const CachedTypePairIdLimit = 1 << 24;
9
+ /** The `cachedTypesByPair` key of two type ids and four bits, or -1 when an id is too large to pack. */
10
+ export function cachedTypePairKey(a, b, bits) {
11
+ return a < CachedTypePairIdLimit && b < CachedTypePairIdLimit ? (a * CachedTypePairIdLimit + b) * 16 + bits : -1;
12
+ }
13
+ // ---- Types
14
+ /** An alias symbol and its type arguments, for types written through a type alias. */
15
+ export class TypeAlias {
16
+ symbol;
17
+ typeArguments;
18
+ constructor(symbol, typeArguments) {
19
+ this.symbol = symbol;
20
+ this.typeArguments = typeArguments;
21
+ }
22
+ }
23
+ /** One entry of a `TypeListCache`: the parts of its key, its value, and the next entry with the same hash. */
24
+ class TypeListEntry {
25
+ types;
26
+ alias;
27
+ tag;
28
+ value;
29
+ next;
30
+ constructor(types, alias, tag, value) {
31
+ this.types = types;
32
+ this.alias = alias;
33
+ this.tag = tag;
34
+ this.value = value;
35
+ this.next = undefined;
36
+ }
37
+ }
38
+ function sameTypeListParts(a, b) {
39
+ if (a.length !== b.length)
40
+ return false;
41
+ for (let i = 0; i < a.length; i++)
42
+ if (a[i] !== b[i])
43
+ return false;
44
+ return true;
45
+ }
46
+ function sameAliasParts(a, b) {
47
+ if (a === undefined || b === undefined)
48
+ return a === b;
49
+ return a.symbol === b.symbol && sameTypeListParts(a.typeArguments, b.typeArguments);
50
+ }
51
+ /**
52
+ * Values keyed by a list of types, an optional alias and a small tag: the keys `typeListKey(types) +
53
+ * aliasKey(alias)` plus a suffix spelled, without building them. A lookup takes a number hashing the
54
+ * parts (`typeListHash`); entries keep their parts, so a match is exact and keys sharing a hash chain.
55
+ * Like tsgo's hashed type list keys. A list must not change after it keys an entry.
56
+ */
57
+ export class TypeListCache {
58
+ entries = new Map();
59
+ get(hash, types, alias, tag) {
60
+ for (let e = this.entries.get(hash); e !== undefined; e = e.next)
61
+ if (e.tag === tag && sameTypeListParts(e.types, types) && sameAliasParts(e.alias, alias))
62
+ return e.value;
63
+ return undefined;
64
+ }
65
+ set(hash, types, alias, tag, value) {
66
+ const head = this.entries.get(hash);
67
+ if (head === undefined) {
68
+ this.entries.set(hash, new TypeListEntry(types, alias, tag, value));
69
+ return;
70
+ }
71
+ for (let e = head; e !== undefined; e = e.next)
72
+ if (e.tag === tag && sameTypeListParts(e.types, types) && sameAliasParts(e.alias, alias)) {
73
+ e.value = value;
74
+ return;
75
+ }
76
+ const entry = new TypeListEntry(types, alias, tag, value);
77
+ entry.next = head.next;
78
+ head.next = entry;
79
+ }
80
+ clear() {
81
+ this.entries.clear();
82
+ }
83
+ }
84
+ /**
85
+ * The references to a generic class, interface or tuple type, by the hash of their type arguments
86
+ * (`createTypeReference`). A reference is its own entry: a lookup compares its type arguments. A
87
+ * reference whose hash another reference has is kept in `collisions`.
88
+ */
89
+ export class ReferenceCache {
90
+ references = new Map();
91
+ collisions = undefined;
92
+ get(hash, typeArguments) {
93
+ const reference = this.references.get(hash);
94
+ if (reference === undefined)
95
+ return undefined;
96
+ if (sameTypeListParts(reference.resolvedTypeArguments, typeArguments))
97
+ return reference;
98
+ const collisions = this.collisions;
99
+ return collisions !== undefined ? collisions.get(hash, typeArguments, undefined, 0) : undefined;
100
+ }
101
+ /** Adds `reference`, whose type arguments `get` did not find. */
102
+ add(hash, reference) {
103
+ if (this.references.get(hash) === undefined) {
104
+ this.references.set(hash, reference);
105
+ return;
106
+ }
107
+ let collisions = this.collisions;
108
+ if (collisions === undefined) {
109
+ collisions = new TypeListCache();
110
+ this.collisions = collisions;
111
+ }
112
+ collisions.set(hash, reference.resolvedTypeArguments, undefined, 0, reference);
113
+ }
114
+ }
115
+ /**
116
+ * Fields that few types set, kept out of line in `Type.extra`, which is created on the first write
117
+ * of a value other than the field's default. A type then costs one slot for all of them. Each field
118
+ * is read and written through an accessor of the type class it belongs to, which returns the
119
+ * default while the type has no extra fields. Rare fields that hot paths read stay inline (the
120
+ * alias, construct signatures): a native accessor returns an owned reference, which costs reference
121
+ * counting on every read of a counted value.
122
+ */
123
+ export class TypeExtra {
124
+ // StructuredType
125
+ objectTypeWithoutAbstractConstructSignatures;
126
+ // ObjectType
127
+ instantiations;
128
+ // TypeReference
129
+ node;
130
+ // UnionType
131
+ resolvedReducedType;
132
+ regularType;
133
+ origin;
134
+ keyPropertyName;
135
+ constituentMap;
136
+ constituentSet;
137
+ membershipTests;
138
+ // IntersectionType
139
+ uniqueLiteralFilledInstantiation;
140
+ constructor() {
141
+ this.objectTypeWithoutAbstractConstructSignatures = undefined;
142
+ this.instantiations = undefined;
143
+ this.node = undefined;
144
+ this.resolvedReducedType = undefined;
145
+ this.regularType = undefined;
146
+ this.origin = undefined;
147
+ this.keyPropertyName = '';
148
+ this.constituentMap = undefined;
149
+ this.constituentSet = undefined;
150
+ this.membershipTests = 0;
151
+ this.uniqueLiteralFilledInstantiation = undefined;
152
+ }
153
+ }
154
+ /** The extra fields of `t`, created if it has none yet. */
155
+ export function typeExtra(t) {
156
+ let extra = t.extra;
157
+ if (extra === undefined) {
158
+ extra = new TypeExtra();
159
+ t.extra = extra;
160
+ }
161
+ return extra;
162
+ }
163
+ /**
164
+ * The base of every type. Narrow by `flags` (and `objectFlags` for object types), then cast to
165
+ * the subclass, as tsgo does with `AsUnionType()` etc.
166
+ */
167
+ /**
168
+ * `TSC_TS_SIDE_STATE=1` (a test of the side tables): every type and signature keeps its lazily
169
+ * computed state in the checker's side tables (`ObjectFlags.SideState`, `SignatureFlags.SideState`).
170
+ */
171
+ export const sideStateForAll = process.env.TSC_TS_SIDE_STATE === '1';
172
+ /** `symbol`, with its id assigned (`getSymbolId`): every symbol tsc-ts's public API hands out has one. */
173
+ function withId(symbol) {
174
+ if (symbol !== undefined)
175
+ getSymbolId(symbol);
176
+ return symbol;
177
+ }
178
+ export class Type {
179
+ flags;
180
+ objectFlags;
181
+ id;
182
+ symbol;
183
+ alias;
184
+ /** For types with a computed base constraint (type variables, structured types, …). */
185
+ resolvedBaseConstraint;
186
+ /** Rarely set fields; undefined while all of them have their defaults. */
187
+ extra;
188
+ constructor(flags, objectFlags, id, symbol) {
189
+ this.flags = flags;
190
+ this.objectFlags = sideStateForAll ? objectFlags | -2147483648 /* ObjectFlags.SideState */ : objectFlags;
191
+ this.id = id | 0;
192
+ this.symbol = symbol;
193
+ this.alias = undefined;
194
+ this.resolvedBaseConstraint = undefined;
195
+ this.extra = undefined;
196
+ }
197
+ // TypeScript 7's API (tsc-ts/api): the parts of a type, undefined or empty where its kind has none.
198
+ getSymbol() {
199
+ return withId(this.symbol);
200
+ }
201
+ getAliasSymbol() {
202
+ return withId(this.alias?.symbol);
203
+ }
204
+ getAliasTypeArguments() {
205
+ const alias = this.alias;
206
+ return alias === undefined ? emptyTypes : alias.typeArguments.slice();
207
+ }
208
+ /** The target of a type reference, index type or string mapping type. */
209
+ getTarget() {
210
+ if ((this.flags & 2097152 /* TypeFlags.Index */) !== 0)
211
+ return this.target;
212
+ if ((this.flags & 8388608 /* TypeFlags.StringMapping */) !== 0)
213
+ return this.target;
214
+ if (this.isTypeReference())
215
+ return this.target;
216
+ return undefined;
217
+ }
218
+ /** The members of a union or intersection type, or the types of a template literal type. */
219
+ getTypes() {
220
+ if ((this.flags & 4194304 /* TypeFlags.TemplateLiteral */) !== 0)
221
+ return this.types.slice();
222
+ if ((this.flags & 402653184 /* TypeFlags.UnionOrIntersection */) !== 0)
223
+ return this.types.slice();
224
+ return emptyTypes;
225
+ }
226
+ getFreshType() {
227
+ return this instanceof LiteralType ? this.freshType : undefined;
228
+ }
229
+ getRegularType() {
230
+ return this instanceof LiteralType ? this.regularType : undefined;
231
+ }
232
+ getObjectType() {
233
+ return (this.flags & 33554432 /* TypeFlags.IndexedAccess */) !== 0 ? this.objectType : undefined;
234
+ }
235
+ getIndexType() {
236
+ return (this.flags & 33554432 /* TypeFlags.IndexedAccess */) !== 0 ? this.indexType : undefined;
237
+ }
238
+ getCheckType() {
239
+ return (this.flags & 67108864 /* TypeFlags.Conditional */) !== 0 ? this.checkType : undefined;
240
+ }
241
+ getExtendsType() {
242
+ return (this.flags & 67108864 /* TypeFlags.Conditional */) !== 0 ? this.extendsType : undefined;
243
+ }
244
+ getTrueType() {
245
+ if ((this.flags & 67108864 /* TypeFlags.Conditional */) === 0)
246
+ return undefined;
247
+ const conditional = this;
248
+ return conditional.checking?.trueTypeOf(conditional);
249
+ }
250
+ getFalseType() {
251
+ if ((this.flags & 67108864 /* TypeFlags.Conditional */) === 0)
252
+ return undefined;
253
+ const conditional = this;
254
+ return conditional.checking?.falseTypeOf(conditional);
255
+ }
256
+ /** The base type of a substitution type. */
257
+ getBaseType() {
258
+ return (this.flags & 16777216 /* TypeFlags.Substitution */) !== 0 ? this.baseType : undefined;
259
+ }
260
+ /** The constraint of a substitution type. */
261
+ getConstraint() {
262
+ return (this.flags & 16777216 /* TypeFlags.Substitution */) !== 0 ? this.constraint : undefined;
263
+ }
264
+ /** The type parameters of a class or interface type, outer and local, without its `this` type. */
265
+ getTypeParameters() {
266
+ return this.isClassOrInterface() ? this.typeParameters() : emptyTypes;
267
+ }
268
+ getOuterTypeParameters() {
269
+ return this.isClassOrInterface() ? this.outerTypeParameters() : emptyTypes;
270
+ }
271
+ getLocalTypeParameters() {
272
+ return this.isClassOrInterface() ? this.localTypeParameters() : emptyTypes;
273
+ }
274
+ /** The base types of a class or interface type, or undefined for any other type. */
275
+ getBaseTypes() {
276
+ if (!this.isClassOrInterface())
277
+ return undefined;
278
+ const declared = this;
279
+ return declared.checking === undefined ? emptyTypes : declared.checking.baseTypesOf(declared).slice();
280
+ }
281
+ isClassOrInterface() {
282
+ return (this.flags & 1048576 /* TypeFlags.Object */) !== 0 && (this.objectFlags & 3 /* ObjectFlags.ClassOrInterface */) !== 0;
283
+ }
284
+ isUnionType() {
285
+ return (this.flags & 134217728 /* TypeFlags.Union */) !== 0;
286
+ }
287
+ isIntersectionType() {
288
+ return (this.flags & 268435456 /* TypeFlags.Intersection */) !== 0;
289
+ }
290
+ isObjectType() {
291
+ return (this.flags & 1048576 /* TypeFlags.Object */) !== 0;
292
+ }
293
+ isIntrinsicType() {
294
+ return (this.flags & 393983 /* TypeFlags.Intrinsic */) !== 0;
295
+ }
296
+ /** Whether this is the error type: an intrinsic type named `error`. */
297
+ isErrorType() {
298
+ return this instanceof IntrinsicType && this.intrinsicName === 'error';
299
+ }
300
+ isLiteralType() {
301
+ return (this.flags & 15360 /* TypeFlags.Literal */) !== 0;
302
+ }
303
+ isStringLiteralType() {
304
+ return (this.flags & 1024 /* TypeFlags.StringLiteral */) !== 0;
305
+ }
306
+ isNumberLiteralType() {
307
+ return (this.flags & 2048 /* TypeFlags.NumberLiteral */) !== 0;
308
+ }
309
+ isBigIntLiteralType() {
310
+ return (this.flags & 4096 /* TypeFlags.BigIntLiteral */) !== 0;
311
+ }
312
+ isBooleanLiteralType() {
313
+ return (this.flags & 8192 /* TypeFlags.BooleanLiteral */) !== 0;
314
+ }
315
+ isTypeReference() {
316
+ return (this.flags & 1048576 /* TypeFlags.Object */) !== 0 && (this.objectFlags & 4 /* ObjectFlags.Reference */) !== 0;
317
+ }
318
+ isTupleType() {
319
+ return (this.flags & 1048576 /* TypeFlags.Object */) !== 0 && (this.objectFlags & 8 /* ObjectFlags.Tuple */) !== 0;
320
+ }
321
+ isIndexType() {
322
+ return (this.flags & 2097152 /* TypeFlags.Index */) !== 0;
323
+ }
324
+ isIndexedAccessType() {
325
+ return (this.flags & 33554432 /* TypeFlags.IndexedAccess */) !== 0;
326
+ }
327
+ isConditionalType() {
328
+ return (this.flags & 67108864 /* TypeFlags.Conditional */) !== 0;
329
+ }
330
+ isSubstitutionType() {
331
+ return (this.flags & 16777216 /* TypeFlags.Substitution */) !== 0;
332
+ }
333
+ isTemplateLiteralType() {
334
+ return (this.flags & 4194304 /* TypeFlags.TemplateLiteral */) !== 0;
335
+ }
336
+ isStringMappingType() {
337
+ return (this.flags & 8388608 /* TypeFlags.StringMapping */) !== 0;
338
+ }
339
+ isTypeParameter() {
340
+ return (this.flags & 524288 /* TypeFlags.TypeParameter */) !== 0;
341
+ }
342
+ }
343
+ export class IntrinsicType extends Type {
344
+ intrinsicName;
345
+ constructor(flags, objectFlags, id, intrinsicName) {
346
+ super(flags, objectFlags, id, undefined);
347
+ this.intrinsicName = intrinsicName;
348
+ }
349
+ }
350
+ /**
351
+ * A literal or enum member type. `value` is the string of string literals, the number of number
352
+ * literals, `true`/`false` for booleans, the decimal digits (with a leading `-`) of bigints, and
353
+ * unset for computed enum members.
354
+ */
355
+ export class LiteralType extends Type {
356
+ stringValue;
357
+ numberValue;
358
+ /** Created on first use, except for `true` and `false`. */
359
+ freshType;
360
+ regularType;
361
+ constructor(flags, id, symbol, stringValue, numberValue) {
362
+ super(flags, 0 /* ObjectFlags.None */, id, symbol);
363
+ this.stringValue = stringValue;
364
+ this.numberValue = numberValue;
365
+ this.freshType = undefined;
366
+ this.regularType = this;
367
+ }
368
+ /** The value, as TypeScript 7's API gives it: a string, number, bigint or boolean. */
369
+ get value() {
370
+ if ((this.flags & 1024 /* TypeFlags.StringLiteral */) !== 0)
371
+ return this.stringValue;
372
+ if ((this.flags & 4096 /* TypeFlags.BigIntLiteral */) !== 0)
373
+ return BigInt(this.stringValue);
374
+ if ((this.flags & 8192 /* TypeFlags.BooleanLiteral */) !== 0)
375
+ return this.stringValue === 'true';
376
+ return this.numberValue;
377
+ }
378
+ }
379
+ export class UniqueESSymbolType extends Type {
380
+ name;
381
+ constructor(id, symbol, name) {
382
+ super(16384 /* TypeFlags.UniqueESSymbol */, 0 /* ObjectFlags.None */, id, symbol);
383
+ this.name = name;
384
+ }
385
+ }
386
+ /**
387
+ * The members table of a type, built when `members` is read (checker-members.ts): of an instantiated
388
+ * type whose member symbols are instantiated on demand (`PendingInstantiatedMembers`), where reading
389
+ * `properties` builds the properties too, as tsgo builds them when it resolves the members, and
390
+ * lookups by name instantiate only the member asked for; or of a type whose members are all
391
+ * properties (`PropertyMembers`), where lookups by name read the properties.
392
+ */
393
+ export class PendingMembers {
394
+ /**
395
+ * Set when `properties` is built and the members table is not (`PropertyMembers`): the type's
396
+ * properties, which lookups by name then read.
397
+ */
398
+ materializedProperties = undefined;
399
+ }
400
+ /**
401
+ * The property names of instantiated types whose members tables are built on demand, shared by the
402
+ * instantiations of one source that have the same names in the same order: most instantiations of
403
+ * a class or interface have the members of their source and of the same bases.
404
+ */
405
+ export class MemberNames {
406
+ /** The names of the properties, in order. */
407
+ names;
408
+ /** The index of each name in `names`. */
409
+ positions;
410
+ /** The indexes in `names` of the members table's names, in table order. */
411
+ tableOrder;
412
+ constructor(names, positions, tableOrder) {
413
+ this.names = names;
414
+ this.positions = positions;
415
+ this.tableOrder = tableOrder;
416
+ }
417
+ }
418
+ /** A type with members: object types, unions and intersections. */
419
+ export class StructuredType extends Type {
420
+ membersValue;
421
+ propertiesValue;
422
+ /** Set while the member symbols of an instantiated type are not instantiated yet. */
423
+ pendingMembers;
424
+ callSignatures;
425
+ constructSignatures;
426
+ indexInfos;
427
+ constructor(flags, objectFlags, id, symbol) {
428
+ super(flags, objectFlags, id, symbol);
429
+ this.membersValue = undefined;
430
+ this.propertiesValue = emptySymbols;
431
+ this.pendingMembers = undefined;
432
+ this.callSignatures = emptySignatures;
433
+ this.constructSignatures = emptySignatures;
434
+ this.indexInfos = emptyIndexInfos;
435
+ }
436
+ get objectTypeWithoutAbstractConstructSignatures() {
437
+ const extra = this.extra;
438
+ return extra !== undefined ? extra.objectTypeWithoutAbstractConstructSignatures : undefined;
439
+ }
440
+ set objectTypeWithoutAbstractConstructSignatures(t) {
441
+ if (t !== undefined || this.extra !== undefined)
442
+ typeExtra(this).objectTypeWithoutAbstractConstructSignatures = t;
443
+ }
444
+ get members() {
445
+ const pending = this.pendingMembers;
446
+ if (pending !== undefined)
447
+ pending.materializeTable(this);
448
+ return this.membersValue;
449
+ }
450
+ set members(members) {
451
+ this.membersValue = members;
452
+ }
453
+ get properties() {
454
+ const pending = this.pendingMembers;
455
+ if (pending !== undefined && pending.materializedProperties === undefined)
456
+ pending.materialize(this);
457
+ return this.propertiesValue;
458
+ }
459
+ set properties(properties) {
460
+ this.propertiesValue = properties;
461
+ }
462
+ }
463
+ export class ObjectType extends StructuredType {
464
+ /** The generic type this one instantiates. */
465
+ target;
466
+ mapper;
467
+ constructor(objectFlags, id, symbol) {
468
+ super(1048576 /* TypeFlags.Object */, objectFlags, id, symbol);
469
+ this.target = undefined;
470
+ this.mapper = undefined;
471
+ }
472
+ get instantiations() {
473
+ const extra = this.extra;
474
+ return extra !== undefined ? extra.instantiations : undefined;
475
+ }
476
+ set instantiations(instantiations) {
477
+ if (instantiations !== undefined || this.extra !== undefined)
478
+ typeExtra(this).instantiations = instantiations;
479
+ }
480
+ }
481
+ /** An instantiation of a generic class, interface or tuple type. */
482
+ export class TypeReference extends ObjectType {
483
+ resolvedTypeArguments;
484
+ constructor(objectFlags, id, symbol) {
485
+ super(objectFlags, id, symbol);
486
+ this.resolvedTypeArguments = undefined;
487
+ }
488
+ /** The type node of a deferred reference, else undefined. */
489
+ get node() {
490
+ const extra = this.extra;
491
+ return extra !== undefined ? extra.node : undefined;
492
+ }
493
+ set node(node) {
494
+ if (node !== undefined || this.extra !== undefined)
495
+ typeExtra(this).node = node;
496
+ }
497
+ }
498
+ /** A class or interface; when generic, also the reference to itself instantiated with its own type parameters. */
499
+ export class InterfaceType extends TypeReference {
500
+ /** Outer, then local type parameters, then the `this` type. */
501
+ allTypeParameters;
502
+ outerTypeParameterCount;
503
+ thisType;
504
+ baseTypesResolved;
505
+ declaredMembersResolved;
506
+ resolvedBaseConstructorType;
507
+ resolvedBaseTypes;
508
+ declaredMembers;
509
+ declaredCallSignatures;
510
+ declaredConstructSignatures;
511
+ declaredIndexInfos;
512
+ /** Positions of the declared members by name, for lazily instantiated members of instantiations. */
513
+ declaredMemberPositions;
514
+ /** The member states of the last pending instantiation of the type's members (`sharedStates`). */
515
+ lastMemberStates;
516
+ /** The property names of the last instantiation whose members table is built on demand. */
517
+ lastMemberNames;
518
+ /** The references to a generic class, interface or tuple type, by their type arguments. */
519
+ references;
520
+ /** The checker that created the type, for `getBaseTypes()`. */
521
+ checking;
522
+ constructor(objectFlags, id, symbol) {
523
+ super(objectFlags, id, symbol);
524
+ this.references = undefined;
525
+ this.checking = undefined;
526
+ this.declaredMemberPositions = undefined;
527
+ this.lastMemberStates = undefined;
528
+ this.lastMemberNames = undefined;
529
+ this.allTypeParameters = emptyTypes;
530
+ this.outerTypeParameterCount = 0;
531
+ this.thisType = undefined;
532
+ this.baseTypesResolved = false;
533
+ this.declaredMembersResolved = false;
534
+ this.resolvedBaseConstructorType = undefined;
535
+ this.resolvedBaseTypes = emptyTypes;
536
+ this.declaredMembers = undefined;
537
+ this.declaredCallSignatures = emptySignatures;
538
+ this.declaredConstructSignatures = emptySignatures;
539
+ this.declaredIndexInfos = emptyIndexInfos;
540
+ }
541
+ outerTypeParameters() {
542
+ return this.allTypeParameters.length === 0
543
+ ? emptyTypes
544
+ : this.allTypeParameters.slice(0, this.outerTypeParameterCount);
545
+ }
546
+ localTypeParameters() {
547
+ const all = this.allTypeParameters;
548
+ return all.length === 0 ? emptyTypes : all.slice(this.outerTypeParameterCount, all.length - 1);
549
+ }
550
+ typeParameters() {
551
+ const all = this.allTypeParameters;
552
+ return all.length === 0 ? emptyTypes : all.slice(0, all.length - 1);
553
+ }
554
+ /** `typeParameters().length`, without copying them. */
555
+ typeParameterCount() {
556
+ const count = this.allTypeParameters.length;
557
+ return count === 0 ? 0 : count - 1;
558
+ }
559
+ }
560
+ export class TupleElementInfo {
561
+ flags;
562
+ /** A NamedTupleMember or ParameterDeclaration, if labeled. */
563
+ labeledDeclaration;
564
+ constructor(flags, labeledDeclaration) {
565
+ this.flags = flags;
566
+ this.labeledDeclaration = labeledDeclaration;
567
+ }
568
+ }
569
+ export class TupleType extends InterfaceType {
570
+ elementInfos;
571
+ /** Required or variadic elements. */
572
+ minLength;
573
+ /** Leading required or optional elements. */
574
+ fixedLength;
575
+ combinedFlags;
576
+ readonly;
577
+ constructor(objectFlags, id) {
578
+ super(objectFlags, id, undefined);
579
+ this.elementInfos = [];
580
+ this.minLength = 0;
581
+ this.fixedLength = 0;
582
+ this.combinedFlags = 0 /* ElementFlags.None */;
583
+ this.readonly = false;
584
+ }
585
+ /** The flags of each element (TypeScript 7's API). */
586
+ get elementFlags() {
587
+ return this.elementInfos.map((info) => info.flags);
588
+ }
589
+ }
590
+ export class InstantiationExpressionType extends ObjectType {
591
+ node;
592
+ constructor(objectFlags, id, symbol) {
593
+ super(objectFlags, id, symbol);
594
+ this.node = undefined;
595
+ }
596
+ }
597
+ export class MappedType extends ObjectType {
598
+ declaration;
599
+ typeParameter;
600
+ constraintType;
601
+ nameType;
602
+ templateType;
603
+ modifiersType;
604
+ resolvedApparentType;
605
+ containsError;
606
+ constructor(objectFlags, id, symbol) {
607
+ super(objectFlags, id, symbol);
608
+ this.declaration = undefined;
609
+ this.typeParameter = undefined;
610
+ this.constraintType = undefined;
611
+ this.nameType = undefined;
612
+ this.templateType = undefined;
613
+ this.modifiersType = undefined;
614
+ this.resolvedApparentType = undefined;
615
+ this.containsError = false;
616
+ }
617
+ }
618
+ export class ReverseMappedType extends ObjectType {
619
+ source;
620
+ mappedType;
621
+ constraintType;
622
+ constructor(objectFlags, id) {
623
+ super(objectFlags, id, undefined);
624
+ this.source = undefined;
625
+ this.mappedType = undefined;
626
+ this.constraintType = undefined;
627
+ }
628
+ }
629
+ export class EvolvingArrayType extends ObjectType {
630
+ elementType;
631
+ finalArrayType;
632
+ constructor(objectFlags, id) {
633
+ super(objectFlags, id, undefined);
634
+ this.elementType = undefined;
635
+ this.finalArrayType = undefined;
636
+ }
637
+ }
638
+ export class UnionOrIntersectionType extends StructuredType {
639
+ types;
640
+ propertyCache;
641
+ propertyCacheWithoutFunctionPropertyAugment;
642
+ resolvedProperties;
643
+ constructor(flags, objectFlags, id, types) {
644
+ super(flags, objectFlags, id, undefined);
645
+ this.types = types;
646
+ this.propertyCache = undefined;
647
+ this.propertyCacheWithoutFunctionPropertyAugment = undefined;
648
+ this.resolvedProperties = undefined;
649
+ }
650
+ }
651
+ /** A union; all of its own fields are rarely set and live in `extra`. */
652
+ export class UnionType extends UnionOrIntersectionType {
653
+ constructor(objectFlags, id, types) {
654
+ super(134217728 /* TypeFlags.Union */, objectFlags, id, types);
655
+ }
656
+ get resolvedReducedType() {
657
+ const extra = this.extra;
658
+ return extra !== undefined ? extra.resolvedReducedType : undefined;
659
+ }
660
+ set resolvedReducedType(t) {
661
+ if (t !== undefined || this.extra !== undefined)
662
+ typeExtra(this).resolvedReducedType = t;
663
+ }
664
+ get regularType() {
665
+ const extra = this.extra;
666
+ return extra !== undefined ? extra.regularType : undefined;
667
+ }
668
+ set regularType(t) {
669
+ if (t !== undefined || this.extra !== undefined)
670
+ typeExtra(this).regularType = t;
671
+ }
672
+ /** The denormalized union, intersection or index type the union came from. */
673
+ get origin() {
674
+ const extra = this.extra;
675
+ return extra !== undefined ? extra.origin : undefined;
676
+ }
677
+ set origin(t) {
678
+ if (t !== undefined || this.extra !== undefined)
679
+ typeExtra(this).origin = t;
680
+ }
681
+ /** A property with a unique unit type in every object of the union; '' if not computed, '\0' if none. */
682
+ get keyPropertyName() {
683
+ const extra = this.extra;
684
+ return extra !== undefined ? extra.keyPropertyName : '';
685
+ }
686
+ set keyPropertyName(name) {
687
+ if (name !== '' || this.extra !== undefined)
688
+ typeExtra(this).keyPropertyName = name;
689
+ }
690
+ get constituentMap() {
691
+ const extra = this.extra;
692
+ return extra !== undefined ? extra.constituentMap : undefined;
693
+ }
694
+ set constituentMap(map) {
695
+ if (map !== undefined || this.extra !== undefined)
696
+ typeExtra(this).constituentMap = map;
697
+ }
698
+ /** The constituents of a large union, for membership tests; created on the second test. */
699
+ get constituentSet() {
700
+ const extra = this.extra;
701
+ return extra !== undefined ? extra.constituentSet : undefined;
702
+ }
703
+ set constituentSet(set) {
704
+ if (set !== undefined || this.extra !== undefined)
705
+ typeExtra(this).constituentSet = set;
706
+ }
707
+ get membershipTests() {
708
+ const extra = this.extra;
709
+ return extra !== undefined ? extra.membershipTests : 0;
710
+ }
711
+ set membershipTests(tests) {
712
+ if (tests !== 0 || this.extra !== undefined)
713
+ typeExtra(this).membershipTests = tests;
714
+ }
715
+ }
716
+ export class IntersectionType extends UnionOrIntersectionType {
717
+ resolvedApparentType;
718
+ constructor(objectFlags, id, types) {
719
+ super(268435456 /* TypeFlags.Intersection */, objectFlags, id, types);
720
+ this.resolvedApparentType = undefined;
721
+ }
722
+ get uniqueLiteralFilledInstantiation() {
723
+ const extra = this.extra;
724
+ return extra !== undefined ? extra.uniqueLiteralFilledInstantiation : undefined;
725
+ }
726
+ set uniqueLiteralFilledInstantiation(t) {
727
+ if (t !== undefined || this.extra !== undefined)
728
+ typeExtra(this).uniqueLiteralFilledInstantiation = t;
729
+ }
730
+ }
731
+ export class TypeParameter extends Type {
732
+ constraint;
733
+ target;
734
+ mapper;
735
+ isThisType;
736
+ resolvedDefaultType;
737
+ constructor(id, symbol) {
738
+ super(524288 /* TypeFlags.TypeParameter */, 0 /* ObjectFlags.None */, id, symbol);
739
+ this.constraint = undefined;
740
+ this.target = undefined;
741
+ this.mapper = undefined;
742
+ this.isThisType = false;
743
+ this.resolvedDefaultType = undefined;
744
+ }
745
+ }
746
+ /** `keyof T`. */
747
+ export class IndexType extends Type {
748
+ target;
749
+ indexFlags;
750
+ constructor(id, target, indexFlags) {
751
+ super(2097152 /* TypeFlags.Index */, 0 /* ObjectFlags.None */, id, undefined);
752
+ this.target = target;
753
+ this.indexFlags = indexFlags;
754
+ }
755
+ }
756
+ /** `T[K]`. */
757
+ export class IndexedAccessType extends Type {
758
+ objectType;
759
+ indexType;
760
+ /** Only AccessFlags.Persistent. */
761
+ accessFlags;
762
+ constructor(id, objectType, indexType, accessFlags) {
763
+ super(33554432 /* TypeFlags.IndexedAccess */, 0 /* ObjectFlags.None */, id, undefined);
764
+ this.objectType = objectType;
765
+ this.indexType = indexType;
766
+ this.accessFlags = accessFlags;
767
+ }
768
+ }
769
+ export class TemplateLiteralType extends Type {
770
+ /** One longer than `types`. */
771
+ texts;
772
+ types;
773
+ constructor(id, texts, types) {
774
+ super(4194304 /* TypeFlags.TemplateLiteral */, 0 /* ObjectFlags.None */, id, undefined);
775
+ this.texts = texts;
776
+ this.types = types;
777
+ }
778
+ }
779
+ /** `Uppercase<T>` and friends. */
780
+ export class StringMappingType extends Type {
781
+ target;
782
+ constructor(id, symbol, target) {
783
+ super(8388608 /* TypeFlags.StringMapping */, 0 /* ObjectFlags.None */, id, symbol);
784
+ this.target = target;
785
+ }
786
+ }
787
+ export class SubstitutionType extends Type {
788
+ baseType;
789
+ /** What the base type is known to satisfy. */
790
+ constraint;
791
+ constructor(id, baseType, constraint) {
792
+ super(16777216 /* TypeFlags.Substitution */, 0 /* ObjectFlags.None */, id, undefined);
793
+ this.baseType = baseType;
794
+ this.constraint = constraint;
795
+ }
796
+ }
797
+ export class ConditionalRoot {
798
+ node;
799
+ checkType;
800
+ extendsType;
801
+ isDistributive;
802
+ inferTypeParameters;
803
+ outerTypeParameters;
804
+ instantiations;
805
+ alias;
806
+ /**
807
+ * The type arguments of an extends type that is a reference to a class or interface; null for
808
+ * other extends types, undefined until computed.
809
+ */
810
+ referenceArgs;
811
+ constructor(node, checkType, extendsType, isDistributive, inferTypeParameters, outerTypeParameters, alias) {
812
+ this.node = node;
813
+ this.checkType = checkType;
814
+ this.extendsType = extendsType;
815
+ this.isDistributive = isDistributive;
816
+ this.inferTypeParameters = inferTypeParameters;
817
+ this.outerTypeParameters = outerTypeParameters;
818
+ this.instantiations = new TypeListCache();
819
+ this.alias = alias;
820
+ this.referenceArgs = undefined;
821
+ }
822
+ }
823
+ /** What each type argument of a conditional type's extends type is, for `isFalseForEveryInference`. */
824
+ export class ReferenceArgs {
825
+ kinds;
826
+ /** The `infer` type parameter of each `ReferenceArgKind.Infer` type argument. */
827
+ inferTypeParameters;
828
+ constructor(kinds, inferTypeParameters) {
829
+ this.kinds = kinds;
830
+ this.inferTypeParameters = inferTypeParameters;
831
+ }
832
+ }
833
+ export class ConditionalType extends Type {
834
+ root;
835
+ checkType;
836
+ extendsType;
837
+ resolvedTrueType;
838
+ resolvedFalseType;
839
+ /** The true and false types, as one list (getBranchTypesFromConditionalType). */
840
+ resolvedBranchTypes;
841
+ resolvedInferredTrueType;
842
+ resolvedDefaultConstraint;
843
+ resolvedConstraintOfDistributive;
844
+ mapper;
845
+ combinedMapper;
846
+ /** The checker that created the type, for `getTrueType()` and `getFalseType()`. */
847
+ checking;
848
+ constructor(id, root, checkType, extendsType, mapper, combinedMapper) {
849
+ super(67108864 /* TypeFlags.Conditional */, 0 /* ObjectFlags.None */, id, undefined);
850
+ this.root = root;
851
+ this.checkType = checkType;
852
+ this.extendsType = extendsType;
853
+ this.resolvedTrueType = undefined;
854
+ this.resolvedFalseType = undefined;
855
+ this.resolvedBranchTypes = undefined;
856
+ this.resolvedInferredTrueType = undefined;
857
+ this.resolvedDefaultConstraint = undefined;
858
+ this.resolvedConstraintOfDistributive = undefined;
859
+ this.mapper = mapper;
860
+ this.combinedMapper = combinedMapper;
861
+ this.checking = undefined;
862
+ }
863
+ }
864
+ // ---- Signatures and index infos
865
+ export class TypePredicate {
866
+ kind;
867
+ parameterIndex;
868
+ parameterName;
869
+ type;
870
+ constructor(kind, parameterName, parameterIndex, type) {
871
+ this.kind = kind;
872
+ this.parameterIndex = parameterIndex;
873
+ this.parameterName = parameterName;
874
+ this.type = type;
875
+ }
876
+ }
877
+ export class CompositeSignature {
878
+ /** False for an intersection. */
879
+ isUnion;
880
+ signatures;
881
+ constructor(isUnion, signatures) {
882
+ this.isUnion = isUnion;
883
+ this.signatures = signatures;
884
+ }
885
+ }
886
+ /**
887
+ * Fields that few signatures set, kept out of line in `Signature.extra` (see TypeExtra): the `this`
888
+ * parameter, composite signatures and the caches of derived signatures.
889
+ */
890
+ export class SignatureExtra {
891
+ thisParameter;
892
+ isolatedSignatureType;
893
+ composite;
894
+ erasedSignatureCache;
895
+ canonicalSignatureCache;
896
+ baseSignatureCache;
897
+ optionalCallSignatureCache;
898
+ instantiations;
899
+ constructor() {
900
+ this.thisParameter = undefined;
901
+ this.isolatedSignatureType = undefined;
902
+ this.composite = undefined;
903
+ this.erasedSignatureCache = undefined;
904
+ this.canonicalSignatureCache = undefined;
905
+ this.baseSignatureCache = undefined;
906
+ this.optionalCallSignatureCache = undefined;
907
+ this.instantiations = undefined;
908
+ }
909
+ }
910
+ /** The extra fields of `s`, created if it has none yet. */
911
+ export function signatureExtra(s) {
912
+ let extra = s.extra;
913
+ if (extra === undefined) {
914
+ extra = new SignatureExtra();
915
+ s.extra = extra;
916
+ }
917
+ return extra;
918
+ }
919
+ export class Signature {
920
+ id;
921
+ flags;
922
+ minArgumentCount;
923
+ /** -1 until computed. */
924
+ resolvedMinArgumentCount;
925
+ declaration;
926
+ typeParameters;
927
+ parameters;
928
+ resolvedReturnType;
929
+ resolvedTypePredicate;
930
+ target;
931
+ mapper;
932
+ /** Rarely set fields; undefined while all of them have their defaults. */
933
+ extra;
934
+ constructor(id, flags, declaration, typeParameters, thisParameter, parameters, resolvedReturnType, resolvedTypePredicate, minArgumentCount) {
935
+ this.id = id | 0;
936
+ this.flags = sideStateForAll ? flags | 512 /* SignatureFlags.SideState */ : flags;
937
+ this.minArgumentCount = minArgumentCount | 0;
938
+ this.resolvedMinArgumentCount = -1;
939
+ this.declaration = declaration;
940
+ this.typeParameters = typeParameters;
941
+ this.parameters = parameters;
942
+ this.resolvedReturnType = resolvedReturnType;
943
+ this.resolvedTypePredicate = resolvedTypePredicate;
944
+ this.target = undefined;
945
+ this.mapper = undefined;
946
+ this.extra = undefined;
947
+ if (thisParameter !== undefined)
948
+ signatureExtra(this).thisParameter = thisParameter;
949
+ }
950
+ get thisParameter() {
951
+ const extra = this.extra;
952
+ return extra !== undefined ? extra.thisParameter : undefined;
953
+ }
954
+ set thisParameter(symbol) {
955
+ if (symbol !== undefined || this.extra !== undefined)
956
+ signatureExtra(this).thisParameter = symbol;
957
+ }
958
+ // TypeScript 7's API (tsc-ts/api).
959
+ getTypeParameters() {
960
+ return this.typeParameters.slice();
961
+ }
962
+ getParameters() {
963
+ for (const parameter of this.parameters)
964
+ getSymbolId(parameter);
965
+ return this.parameters.slice();
966
+ }
967
+ getThisParameter() {
968
+ return withId(this.thisParameter);
969
+ }
970
+ /** The signature this one was instantiated from. */
971
+ getTarget() {
972
+ return this.target;
973
+ }
974
+ get isolatedSignatureType() {
975
+ const extra = this.extra;
976
+ return extra !== undefined ? extra.isolatedSignatureType : undefined;
977
+ }
978
+ set isolatedSignatureType(t) {
979
+ if (t !== undefined || this.extra !== undefined)
980
+ signatureExtra(this).isolatedSignatureType = t;
981
+ }
982
+ get composite() {
983
+ const extra = this.extra;
984
+ return extra !== undefined ? extra.composite : undefined;
985
+ }
986
+ set composite(composite) {
987
+ if (composite !== undefined || this.extra !== undefined)
988
+ signatureExtra(this).composite = composite;
989
+ }
990
+ /** Caches of derived signatures. */
991
+ get erasedSignatureCache() {
992
+ const extra = this.extra;
993
+ return extra !== undefined ? extra.erasedSignatureCache : undefined;
994
+ }
995
+ set erasedSignatureCache(s) {
996
+ if (s !== undefined || this.extra !== undefined)
997
+ signatureExtra(this).erasedSignatureCache = s;
998
+ }
999
+ get canonicalSignatureCache() {
1000
+ const extra = this.extra;
1001
+ return extra !== undefined ? extra.canonicalSignatureCache : undefined;
1002
+ }
1003
+ set canonicalSignatureCache(s) {
1004
+ if (s !== undefined || this.extra !== undefined)
1005
+ signatureExtra(this).canonicalSignatureCache = s;
1006
+ }
1007
+ get baseSignatureCache() {
1008
+ const extra = this.extra;
1009
+ return extra !== undefined ? extra.baseSignatureCache : undefined;
1010
+ }
1011
+ set baseSignatureCache(s) {
1012
+ if (s !== undefined || this.extra !== undefined)
1013
+ signatureExtra(this).baseSignatureCache = s;
1014
+ }
1015
+ get optionalCallSignatureCache() {
1016
+ const extra = this.extra;
1017
+ return extra !== undefined ? extra.optionalCallSignatureCache : undefined;
1018
+ }
1019
+ set optionalCallSignatureCache(s) {
1020
+ if (s !== undefined || this.extra !== undefined)
1021
+ signatureExtra(this).optionalCallSignatureCache = s;
1022
+ }
1023
+ get instantiations() {
1024
+ const extra = this.extra;
1025
+ return extra !== undefined ? extra.instantiations : undefined;
1026
+ }
1027
+ set instantiations(instantiations) {
1028
+ if (instantiations !== undefined || this.extra !== undefined)
1029
+ signatureExtra(this).instantiations = instantiations;
1030
+ }
1031
+ hasRestParameter() {
1032
+ return (this.flags & 1 /* SignatureFlags.HasRestParameter */) !== 0;
1033
+ }
1034
+ }
1035
+ export class IndexInfo {
1036
+ keyType;
1037
+ valueType;
1038
+ isReadonly;
1039
+ /** The IndexSignatureDeclaration. */
1040
+ declaration;
1041
+ /** Elements with computed property names that make up the index signature. */
1042
+ components;
1043
+ indexSymbol;
1044
+ constructor(keyType, valueType, isReadonly, declaration, components) {
1045
+ this.keyType = keyType;
1046
+ this.valueType = valueType;
1047
+ this.isReadonly = isReadonly;
1048
+ this.declaration = declaration;
1049
+ this.components = components;
1050
+ this.indexSymbol = undefined;
1051
+ }
1052
+ /** The value type (TypeScript 7's API). */
1053
+ get type() {
1054
+ return this.valueType;
1055
+ }
1056
+ }
1057
+ // Shared empty lists; never mutated.
1058
+ export const emptyTypes = [];
1059
+ export const emptySymbols = [];
1060
+ export const emptySignatures = [];
1061
+ export const emptyIndexInfos = [];
1062
+ /** Maps type parameters to types. Subclasses replace tsgo's function mappers. */
1063
+ export class TypeMapper {
1064
+ kind() {
1065
+ return 0 /* TypeMapperKind.Unknown */;
1066
+ }
1067
+ /** Whether the mapper only maps a `this` type parameter. */
1068
+ mapsThisOnly() {
1069
+ return false;
1070
+ }
1071
+ }
1072
+ function isThisTypeParameter(type) {
1073
+ return (type.flags & 524288 /* TypeFlags.TypeParameter */) !== 0 && type.isThisType;
1074
+ }
1075
+ export class SimpleTypeMapper extends TypeMapper {
1076
+ source;
1077
+ target;
1078
+ constructor(source, target) {
1079
+ super();
1080
+ this.source = source;
1081
+ this.target = target;
1082
+ }
1083
+ map(type) {
1084
+ return type === this.source ? this.target : type;
1085
+ }
1086
+ kind() {
1087
+ return 1 /* TypeMapperKind.Simple */;
1088
+ }
1089
+ mapsThisOnly() {
1090
+ return isThisTypeParameter(this.source);
1091
+ }
1092
+ }
1093
+ export class ArrayTypeMapper extends TypeMapper {
1094
+ sources;
1095
+ targets;
1096
+ constructor(sources, targets) {
1097
+ super();
1098
+ this.sources = sources;
1099
+ this.targets = targets;
1100
+ }
1101
+ map(type) {
1102
+ const sources = this.sources;
1103
+ for (let i = 0; i < sources.length; i++)
1104
+ if (type === sources[i])
1105
+ return this.targets[i];
1106
+ return type;
1107
+ }
1108
+ kind() {
1109
+ return 2 /* TypeMapperKind.Array */;
1110
+ }
1111
+ mapsThisOnly() {
1112
+ return this.sources.length === 1 && isThisTypeParameter(this.sources[0]);
1113
+ }
1114
+ }
1115
+ /**
1116
+ * The number of sources from which a mapper looks types up in an index. A tuple reference with thousands of
1117
+ * elements maps one type parameter per element, and searching them all for each element was quadratic in the
1118
+ * tuple's length.
1119
+ */
1120
+ const indexedTypeMapperThreshold = 64;
1121
+ /** An ArrayTypeMapper that looks its sources up in an index, built on its first lookup. */
1122
+ export class IndexedArrayTypeMapper extends ArrayTypeMapper {
1123
+ /** The index of each source's first occurrence. */
1124
+ index = undefined;
1125
+ /** The number of sources `index` was built from. */
1126
+ indexedLength = 0;
1127
+ map(type) {
1128
+ const sources = this.sources;
1129
+ let index = this.index;
1130
+ if (index === undefined || this.indexedLength !== sources.length) {
1131
+ index = new Map();
1132
+ for (let i = 0; i < sources.length; i++)
1133
+ if (!index.has(sources[i]))
1134
+ index.set(sources[i], i);
1135
+ this.index = index;
1136
+ this.indexedLength = sources.length;
1137
+ }
1138
+ const i = index.get(type);
1139
+ return i !== undefined ? this.targets[i] : type;
1140
+ }
1141
+ }
1142
+ /** Maps each of `sources` to one target. */
1143
+ export class ArrayToSingleTypeMapper extends TypeMapper {
1144
+ sources;
1145
+ target;
1146
+ constructor(sources, target) {
1147
+ super();
1148
+ this.sources = sources;
1149
+ this.target = target;
1150
+ }
1151
+ map(type) {
1152
+ return this.sources.includes(type) ? this.target : type;
1153
+ }
1154
+ mapsThisOnly() {
1155
+ return this.sources.length === 1 && isThisTypeParameter(this.sources[0]);
1156
+ }
1157
+ }
1158
+ /** Applies `m1`, then `m2`. */
1159
+ export class MergedTypeMapper extends TypeMapper {
1160
+ m1;
1161
+ m2;
1162
+ constructor(m1, m2) {
1163
+ super();
1164
+ this.m1 = m1;
1165
+ this.m2 = m2;
1166
+ }
1167
+ map(type) {
1168
+ return this.m2.map(this.m1.map(type));
1169
+ }
1170
+ kind() {
1171
+ return 3 /* TypeMapperKind.Merged */;
1172
+ }
1173
+ }
1174
+ export function newTypeMapper(sources, targets) {
1175
+ if (sources.length === 1)
1176
+ return new SimpleTypeMapper(sources[0], targets[0]);
1177
+ return sources.length >= indexedTypeMapperThreshold
1178
+ ? new IndexedArrayTypeMapper(sources, targets)
1179
+ : new ArrayTypeMapper(sources, targets);
1180
+ }
1181
+ export function mergeTypeMappers(m1, m2) {
1182
+ return m1 !== undefined ? new MergedTypeMapper(m1, m2) : m2;
1183
+ }
1184
+ export function prependTypeMapping(source, target, mapper) {
1185
+ const simple = new SimpleTypeMapper(source, target);
1186
+ return mapper === undefined ? simple : new MergedTypeMapper(simple, mapper);
1187
+ }
1188
+ export function appendTypeMapping(mapper, source, target) {
1189
+ const simple = new SimpleTypeMapper(source, target);
1190
+ return mapper === undefined ? simple : new MergedTypeMapper(mapper, simple);
1191
+ }
1192
+ // ---- Links
1193
+ /**
1194
+ * What the checker caches per symbol and rarely sets. Common values (the type, target, mapper, name type
1195
+ * and others) are columns of `Checker` instead; see link-tables.ts. The fields most links objects have
1196
+ * are fields of this class; the others are in a RareSymbolLinks object, created on the first write of
1197
+ * one of them, behind accessors.
1198
+ */
1199
+ export class SymbolLinks {
1200
+ /** Constituents of a deferred union/intersection property type. */
1201
+ deferralParent;
1202
+ deferralConstituents;
1203
+ immediateTarget;
1204
+ aliasTarget;
1205
+ resolvedExports;
1206
+ resolvedMembers;
1207
+ declaredType;
1208
+ /** The other links, created on first write. */
1209
+ rareLinks;
1210
+ functionOrConstructorChecked;
1211
+ aliasReferenced;
1212
+ constructor() {
1213
+ this.deferralParent = undefined;
1214
+ this.deferralConstituents = undefined;
1215
+ this.functionOrConstructorChecked = false;
1216
+ this.immediateTarget = undefined;
1217
+ this.aliasTarget = undefined;
1218
+ this.aliasReferenced = false;
1219
+ this.resolvedExports = undefined;
1220
+ this.resolvedMembers = undefined;
1221
+ this.declaredType = undefined;
1222
+ this.rareLinks = undefined;
1223
+ }
1224
+ rare() {
1225
+ let rare = this.rareLinks;
1226
+ if (rare === undefined) {
1227
+ rare = new RareSymbolLinks();
1228
+ this.rareLinks = rare;
1229
+ }
1230
+ return rare;
1231
+ }
1232
+ get writeType() {
1233
+ const rare = this.rareLinks;
1234
+ return rare === undefined ? undefined : rare.writeType;
1235
+ }
1236
+ set writeType(value) {
1237
+ if (value === undefined && this.rareLinks === undefined)
1238
+ return;
1239
+ this.rare().writeType = value;
1240
+ }
1241
+ get deferralWriteConstituents() {
1242
+ const rare = this.rareLinks;
1243
+ return rare === undefined ? undefined : rare.deferralWriteConstituents;
1244
+ }
1245
+ set deferralWriteConstituents(value) {
1246
+ if (value === undefined && this.rareLinks === undefined)
1247
+ return;
1248
+ this.rare().deferralWriteConstituents = value;
1249
+ }
1250
+ get typeOnlyDeclaration() {
1251
+ const rare = this.rareLinks;
1252
+ return rare === undefined ? undefined : rare.typeOnlyDeclaration;
1253
+ }
1254
+ set typeOnlyDeclaration(value) {
1255
+ if (value === undefined && this.rareLinks === undefined)
1256
+ return;
1257
+ this.rare().typeOnlyDeclaration = value;
1258
+ }
1259
+ get typeOnlyExportStarMap() {
1260
+ const rare = this.rareLinks;
1261
+ return rare === undefined ? undefined : rare.typeOnlyExportStarMap;
1262
+ }
1263
+ set typeOnlyExportStarMap(value) {
1264
+ if (value === undefined && this.rareLinks === undefined)
1265
+ return;
1266
+ this.rare().typeOnlyExportStarMap = value;
1267
+ }
1268
+ get exportsChecked() {
1269
+ const rare = this.rareLinks;
1270
+ return rare === undefined ? false : rare.exportsChecked;
1271
+ }
1272
+ set exportsChecked(value) {
1273
+ if (value === false && this.rareLinks === undefined)
1274
+ return;
1275
+ this.rare().exportsChecked = value;
1276
+ }
1277
+ get lateSymbol() {
1278
+ const rare = this.rareLinks;
1279
+ return rare === undefined ? undefined : rare.lateSymbol;
1280
+ }
1281
+ set lateSymbol(value) {
1282
+ if (value === undefined && this.rareLinks === undefined)
1283
+ return;
1284
+ this.rare().lateSymbol = value;
1285
+ }
1286
+ get typeParameters() {
1287
+ const rare = this.rareLinks;
1288
+ return rare === undefined ? undefined : rare.typeParameters;
1289
+ }
1290
+ set typeParameters(value) {
1291
+ if (value === undefined && this.rareLinks === undefined)
1292
+ return;
1293
+ this.rare().typeParameters = value;
1294
+ }
1295
+ get instantiations() {
1296
+ const rare = this.rareLinks;
1297
+ return rare === undefined ? undefined : rare.instantiations;
1298
+ }
1299
+ set instantiations(value) {
1300
+ if (value === undefined && this.rareLinks === undefined)
1301
+ return;
1302
+ this.rare().instantiations = value;
1303
+ }
1304
+ get interfaceChecked() {
1305
+ const rare = this.rareLinks;
1306
+ return rare === undefined ? false : rare.interfaceChecked;
1307
+ }
1308
+ set interfaceChecked(value) {
1309
+ if (value === false && this.rareLinks === undefined)
1310
+ return;
1311
+ this.rare().interfaceChecked = value;
1312
+ }
1313
+ get indexSignaturesChecked() {
1314
+ const rare = this.rareLinks;
1315
+ return rare === undefined ? false : rare.indexSignaturesChecked;
1316
+ }
1317
+ set indexSignaturesChecked(value) {
1318
+ if (value === false && this.rareLinks === undefined)
1319
+ return;
1320
+ this.rare().indexSignaturesChecked = value;
1321
+ }
1322
+ get typeParametersChecked() {
1323
+ const rare = this.rareLinks;
1324
+ return rare === undefined ? false : rare.typeParametersChecked;
1325
+ }
1326
+ set typeParametersChecked(value) {
1327
+ if (value === false && this.rareLinks === undefined)
1328
+ return;
1329
+ this.rare().typeParametersChecked = value;
1330
+ }
1331
+ get enumChecked() {
1332
+ const rare = this.rareLinks;
1333
+ return rare === undefined ? false : rare.enumChecked;
1334
+ }
1335
+ set enumChecked(value) {
1336
+ if (value === false && this.rareLinks === undefined)
1337
+ return;
1338
+ this.rare().enumChecked = value;
1339
+ }
1340
+ get variances() {
1341
+ const rare = this.rareLinks;
1342
+ return rare === undefined ? undefined : rare.variances;
1343
+ }
1344
+ set variances(value) {
1345
+ if (value === undefined && this.rareLinks === undefined)
1346
+ return;
1347
+ this.rare().variances = value;
1348
+ }
1349
+ get lastAssignmentPos() {
1350
+ const rare = this.rareLinks;
1351
+ return rare === undefined ? 0 : rare.lastAssignmentPos;
1352
+ }
1353
+ set lastAssignmentPos(value) {
1354
+ if (value === 0 && this.rareLinks === undefined)
1355
+ return;
1356
+ this.rare().lastAssignmentPos = value;
1357
+ }
1358
+ get hasDefiniteAssignment() {
1359
+ const rare = this.rareLinks;
1360
+ return rare === undefined ? false : rare.hasDefiniteAssignment;
1361
+ }
1362
+ set hasDefiniteAssignment(value) {
1363
+ if (value === false && this.rareLinks === undefined)
1364
+ return;
1365
+ this.rare().hasDefiniteAssignment = value;
1366
+ }
1367
+ get isConstructorDeclaredProperty() {
1368
+ const rare = this.rareLinks;
1369
+ return rare === undefined ? false : rare.isConstructorDeclaredProperty;
1370
+ }
1371
+ set isConstructorDeclaredProperty(value) {
1372
+ if (value === false && this.rareLinks === undefined)
1373
+ return;
1374
+ this.rare().isConstructorDeclaredProperty = value;
1375
+ }
1376
+ get thisAssignmentKind() {
1377
+ const rare = this.rareLinks;
1378
+ return rare === undefined ? 0 : rare.thisAssignmentKind;
1379
+ }
1380
+ set thisAssignmentKind(value) {
1381
+ if (value === 0 && this.rareLinks === undefined)
1382
+ return;
1383
+ this.rare().thisAssignmentKind = value;
1384
+ }
1385
+ get thisAssignmentLocation() {
1386
+ const rare = this.rareLinks;
1387
+ return rare === undefined ? undefined : rare.thisAssignmentLocation;
1388
+ }
1389
+ set thisAssignmentLocation(value) {
1390
+ if (value === undefined && this.rareLinks === undefined)
1391
+ return;
1392
+ this.rare().thisAssignmentLocation = value;
1393
+ }
1394
+ get reverseMappedPropertyType() {
1395
+ const rare = this.rareLinks;
1396
+ return rare === undefined ? undefined : rare.reverseMappedPropertyType;
1397
+ }
1398
+ set reverseMappedPropertyType(value) {
1399
+ if (value === undefined && this.rareLinks === undefined)
1400
+ return;
1401
+ this.rare().reverseMappedPropertyType = value;
1402
+ }
1403
+ get reverseMappedMappedType() {
1404
+ const rare = this.rareLinks;
1405
+ return rare === undefined ? undefined : rare.reverseMappedMappedType;
1406
+ }
1407
+ set reverseMappedMappedType(value) {
1408
+ if (value === undefined && this.rareLinks === undefined)
1409
+ return;
1410
+ this.rare().reverseMappedMappedType = value;
1411
+ }
1412
+ get reverseMappedConstraintType() {
1413
+ const rare = this.rareLinks;
1414
+ return rare === undefined ? undefined : rare.reverseMappedConstraintType;
1415
+ }
1416
+ set reverseMappedConstraintType(value) {
1417
+ if (value === undefined && this.rareLinks === undefined)
1418
+ return;
1419
+ this.rare().reverseMappedConstraintType = value;
1420
+ }
1421
+ }
1422
+ /** The links of a symbol that few symbols have (SymbolLinks). */
1423
+ export class RareSymbolLinks {
1424
+ // Values
1425
+ writeType;
1426
+ deferralWriteConstituents;
1427
+ typeOnlyDeclaration;
1428
+ /** Exports reached only through `export type *`, by name. */
1429
+ typeOnlyExportStarMap;
1430
+ exportsChecked;
1431
+ lateSymbol;
1432
+ /** Type parameters of a type alias. */
1433
+ typeParameters;
1434
+ /** Instantiations of a generic type alias. */
1435
+ instantiations;
1436
+ interfaceChecked;
1437
+ indexSignaturesChecked;
1438
+ typeParametersChecked;
1439
+ enumChecked;
1440
+ variances;
1441
+ // Assignment tracking
1442
+ lastAssignmentPos;
1443
+ hasDefiniteAssignment;
1444
+ isConstructorDeclaredProperty;
1445
+ // JavaScript `this.x` assignment declarations
1446
+ /** A `ThisAssignmentKind` plus one; zero until computed. */
1447
+ thisAssignmentKind;
1448
+ thisAssignmentLocation;
1449
+ // Reverse mapped properties
1450
+ reverseMappedPropertyType;
1451
+ reverseMappedMappedType;
1452
+ reverseMappedConstraintType;
1453
+ constructor() {
1454
+ this.writeType = undefined;
1455
+ this.deferralWriteConstituents = undefined;
1456
+ this.typeOnlyDeclaration = undefined;
1457
+ this.typeOnlyExportStarMap = undefined;
1458
+ this.exportsChecked = false;
1459
+ this.lateSymbol = undefined;
1460
+ this.typeParameters = undefined;
1461
+ this.instantiations = undefined;
1462
+ this.interfaceChecked = false;
1463
+ this.indexSignaturesChecked = false;
1464
+ this.typeParametersChecked = false;
1465
+ this.enumChecked = false;
1466
+ this.variances = undefined;
1467
+ this.lastAssignmentPos = 0;
1468
+ this.hasDefiniteAssignment = false;
1469
+ this.isConstructorDeclaredProperty = false;
1470
+ this.thisAssignmentKind = 0;
1471
+ this.thisAssignmentLocation = undefined;
1472
+ this.reverseMappedPropertyType = undefined;
1473
+ this.reverseMappedMappedType = undefined;
1474
+ this.reverseMappedConstraintType = undefined;
1475
+ }
1476
+ }
1477
+ /**
1478
+ * What the checker caches per node and rarely sets. The resolved symbol, type and signature are columns of
1479
+ * `Checker` instead; see link-tables.ts. As in SymbolLinks, the fields few links objects have are in a
1480
+ * RareNodeLinks object behind accessors.
1481
+ */
1482
+ export class NodeLinks {
1483
+ /** Outer type parameters of an anonymous object type node. */
1484
+ outerTypeParameters;
1485
+ effectsSignature;
1486
+ /** Type of an assertion's operand. */
1487
+ assertionExpressionType;
1488
+ /** The other links, created on first write. */
1489
+ rareLinks;
1490
+ flags;
1491
+ constructor() {
1492
+ this.flags = 0 /* NodeCheckFlags.None */;
1493
+ this.outerTypeParameters = undefined;
1494
+ this.effectsSignature = undefined;
1495
+ this.assertionExpressionType = undefined;
1496
+ this.rareLinks = undefined;
1497
+ }
1498
+ rare() {
1499
+ let rare = this.rareLinks;
1500
+ if (rare === undefined) {
1501
+ rare = new RareNodeLinks();
1502
+ this.rareLinks = rare;
1503
+ }
1504
+ return rare;
1505
+ }
1506
+ get contextFreeType() {
1507
+ const rare = this.rareLinks;
1508
+ return rare === undefined ? undefined : rare.contextFreeType;
1509
+ }
1510
+ set contextFreeType(value) {
1511
+ if (value === undefined && this.rareLinks === undefined)
1512
+ return;
1513
+ this.rare().contextFreeType = value;
1514
+ }
1515
+ get enumStringValue() {
1516
+ const rare = this.rareLinks;
1517
+ return rare === undefined ? '' : rare.enumStringValue;
1518
+ }
1519
+ set enumStringValue(value) {
1520
+ if (value === '' && this.rareLinks === undefined)
1521
+ return;
1522
+ this.rare().enumStringValue = value;
1523
+ }
1524
+ get enumNumberValue() {
1525
+ const rare = this.rareLinks;
1526
+ return rare === undefined ? 0 : rare.enumNumberValue;
1527
+ }
1528
+ set enumNumberValue(value) {
1529
+ if (value === 0 && this.rareLinks === undefined)
1530
+ return;
1531
+ this.rare().enumNumberValue = value;
1532
+ }
1533
+ get enumValueKind() {
1534
+ const rare = this.rareLinks;
1535
+ return rare === undefined ? 0 : rare.enumValueKind;
1536
+ }
1537
+ set enumValueKind(value) {
1538
+ if (value === 0 && this.rareLinks === undefined)
1539
+ return;
1540
+ this.rare().enumValueKind = value;
1541
+ }
1542
+ get enumValueFlags() {
1543
+ const rare = this.rareLinks;
1544
+ return rare === undefined ? 0 : rare.enumValueFlags;
1545
+ }
1546
+ set enumValueFlags(value) {
1547
+ if (value === 0 && this.rareLinks === undefined)
1548
+ return;
1549
+ this.rare().enumValueFlags = value;
1550
+ }
1551
+ get hasReportedStatementInAmbientContext() {
1552
+ const rare = this.rareLinks;
1553
+ return rare === undefined ? false : rare.hasReportedStatementInAmbientContext;
1554
+ }
1555
+ set hasReportedStatementInAmbientContext(value) {
1556
+ if (value === false && this.rareLinks === undefined)
1557
+ return;
1558
+ this.rare().hasReportedStatementInAmbientContext = value;
1559
+ }
1560
+ get declarationRequiresScopeChange() {
1561
+ const rare = this.rareLinks;
1562
+ return rare === undefined ? 0 : rare.declarationRequiresScopeChange;
1563
+ }
1564
+ set declarationRequiresScopeChange(value) {
1565
+ if (value === 0 && this.rareLinks === undefined)
1566
+ return;
1567
+ this.rare().declarationRequiresScopeChange = value;
1568
+ }
1569
+ get typeChecked() {
1570
+ const rare = this.rareLinks;
1571
+ return rare === undefined ? false : rare.typeChecked;
1572
+ }
1573
+ set typeChecked(value) {
1574
+ if (value === false && this.rareLinks === undefined)
1575
+ return;
1576
+ this.rare().typeChecked = value;
1577
+ }
1578
+ get deferredNodes() {
1579
+ const rare = this.rareLinks;
1580
+ return rare === undefined ? undefined : rare.deferredNodes;
1581
+ }
1582
+ set deferredNodes(value) {
1583
+ if (value === undefined && this.rareLinks === undefined)
1584
+ return;
1585
+ this.rare().deferredNodes = value;
1586
+ }
1587
+ get switchTypes() {
1588
+ const rare = this.rareLinks;
1589
+ return rare === undefined ? undefined : rare.switchTypes;
1590
+ }
1591
+ set switchTypes(value) {
1592
+ if (value === undefined && this.rareLinks === undefined)
1593
+ return;
1594
+ this.rare().switchTypes = value;
1595
+ }
1596
+ get switchWitnesses() {
1597
+ const rare = this.rareLinks;
1598
+ return rare === undefined ? undefined : rare.switchWitnesses;
1599
+ }
1600
+ set switchWitnesses(value) {
1601
+ if (value === undefined && this.rareLinks === undefined)
1602
+ return;
1603
+ this.rare().switchWitnesses = value;
1604
+ }
1605
+ get switchWitnessesValid() {
1606
+ const rare = this.rareLinks;
1607
+ return rare === undefined ? false : rare.switchWitnessesValid;
1608
+ }
1609
+ set switchWitnessesValid(value) {
1610
+ if (value === false && this.rareLinks === undefined)
1611
+ return;
1612
+ this.rare().switchWitnessesValid = value;
1613
+ }
1614
+ get exhaustiveState() {
1615
+ const rare = this.rareLinks;
1616
+ return rare === undefined ? 0 : rare.exhaustiveState;
1617
+ }
1618
+ set exhaustiveState(value) {
1619
+ if (value === 0 && this.rareLinks === undefined)
1620
+ return;
1621
+ this.rare().exhaustiveState = value;
1622
+ }
1623
+ get decoratorSignature() {
1624
+ const rare = this.rareLinks;
1625
+ return rare === undefined ? undefined : rare.decoratorSignature;
1626
+ }
1627
+ set decoratorSignature(value) {
1628
+ if (value === undefined && this.rareLinks === undefined)
1629
+ return;
1630
+ this.rare().decoratorSignature = value;
1631
+ }
1632
+ get containsArgumentsReference() {
1633
+ const rare = this.rareLinks;
1634
+ return rare === undefined ? 0 : rare.containsArgumentsReference;
1635
+ }
1636
+ set containsArgumentsReference(value) {
1637
+ if (value === 0 && this.rareLinks === undefined)
1638
+ return;
1639
+ this.rare().containsArgumentsReference = value;
1640
+ }
1641
+ get mentionsArguments() {
1642
+ const rare = this.rareLinks;
1643
+ return rare === undefined ? 0 : rare.mentionsArguments;
1644
+ }
1645
+ set mentionsArguments(value) {
1646
+ if (value === 0 && this.rareLinks === undefined)
1647
+ return;
1648
+ this.rare().mentionsArguments = value;
1649
+ }
1650
+ }
1651
+ /** The links of a node that few nodes have (NodeLinks). */
1652
+ export class RareNodeLinks {
1653
+ /** Context-free type of an expression. */
1654
+ contextFreeType;
1655
+ /** Enum member value: a string, or a number when `enumValueIsNumber`. */
1656
+ enumStringValue;
1657
+ enumNumberValue;
1658
+ enumValueKind;
1659
+ /** EvaluatedFlags of the enum member value. */
1660
+ enumValueFlags;
1661
+ hasReportedStatementInAmbientContext;
1662
+ declarationRequiresScopeChange;
1663
+ /** For source files: whether the file has been checked, and its nodes waiting for a deferred check. */
1664
+ typeChecked;
1665
+ deferredNodes;
1666
+ /** Case clause types of a switch statement. */
1667
+ switchTypes;
1668
+ /** `typeof` case texts of a switch statement; '' for default and duplicates. */
1669
+ switchWitnesses;
1670
+ switchWitnessesValid;
1671
+ /** 0 unknown, 1 computing, 2 not exhaustive, 3 exhaustive. */
1672
+ exhaustiveState;
1673
+ /** The signature the runtime calls a decorator of this declaration with. */
1674
+ decoratorSignature;
1675
+ /** Whether a function body references `arguments`: 0 until computed, 1 for no, 2 for yes. */
1676
+ containsArgumentsReference;
1677
+ /** For source files: whether the file has an identifier `arguments`: 0 until computed, 1 for no, 2 for yes. */
1678
+ mentionsArguments;
1679
+ constructor() {
1680
+ this.contextFreeType = undefined;
1681
+ this.enumStringValue = '';
1682
+ this.enumNumberValue = 0;
1683
+ this.enumValueKind = 0;
1684
+ this.enumValueFlags = 0;
1685
+ this.hasReportedStatementInAmbientContext = false;
1686
+ this.declarationRequiresScopeChange = 0;
1687
+ this.typeChecked = false;
1688
+ this.deferredNodes = undefined;
1689
+ this.switchTypes = undefined;
1690
+ this.switchWitnesses = undefined;
1691
+ this.switchWitnessesValid = false;
1692
+ this.exhaustiveState = 0;
1693
+ this.decoratorSignature = undefined;
1694
+ this.containsArgumentsReference = 0;
1695
+ this.mentionsArguments = 0;
1696
+ }
1697
+ }