tsc-ts 0.0.10 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +1 -1
  2. package/bin/tsc-ts.js +70 -1
  3. package/dist/api/compiler/ast-utilities.d.ts +19 -1
  4. package/dist/api/compiler/ast-utilities.js +180 -95
  5. package/dist/api/compiler/ast.d.ts +20 -15
  6. package/dist/api/compiler/ast.js +1023 -995
  7. package/dist/api/compiler/astnav.js +15 -15
  8. package/dist/api/compiler/binder-utilities.js +186 -186
  9. package/dist/api/compiler/binder.js +290 -263
  10. package/dist/api/compiler/character-codes.js +2 -2
  11. package/dist/api/compiler/checker-calls.js +173 -123
  12. package/dist/api/compiler/checker-classes.d.ts +14 -3
  13. package/dist/api/compiler/checker-classes.js +134 -90
  14. package/dist/api/compiler/checker-contextual.js +64 -61
  15. package/dist/api/compiler/checker-declaration-order.js +79 -79
  16. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  17. package/dist/api/compiler/checker-declarations.js +160 -136
  18. package/dist/api/compiler/checker-declared-types.js +67 -65
  19. package/dist/api/compiler/checker-decorators.js +77 -77
  20. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  21. package/dist/api/compiler/checker-deprecation.js +76 -55
  22. package/dist/api/compiler/checker-destructuring.js +47 -45
  23. package/dist/api/compiler/checker-elaboration.js +24 -24
  24. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  25. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  26. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  27. package/dist/api/compiler/checker-evaluator.js +9 -9
  28. package/dist/api/compiler/checker-expressions.js +244 -211
  29. package/dist/api/compiler/checker-functions.js +113 -107
  30. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  31. package/dist/api/compiler/checker-generated-code.js +28 -52
  32. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  33. package/dist/api/compiler/checker-grammar.js +469 -438
  34. package/dist/api/compiler/checker-heritage.js +91 -93
  35. package/dist/api/compiler/checker-inference.d.ts +77 -5
  36. package/dist/api/compiler/checker-inference.js +487 -113
  37. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  38. package/dist/api/compiler/checker-iteration.js +35 -52
  39. package/dist/api/compiler/checker-javascript.js +14 -14
  40. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  41. package/dist/api/compiler/checker-jsdoc.js +67 -58
  42. package/dist/api/compiler/checker-jsx.js +105 -88
  43. package/dist/api/compiler/checker-members.d.ts +9 -2
  44. package/dist/api/compiler/checker-members.js +210 -74
  45. package/dist/api/compiler/checker-modules.d.ts +15 -6
  46. package/dist/api/compiler/checker-modules.js +469 -309
  47. package/dist/api/compiler/checker-narrowing.js +273 -189
  48. package/dist/api/compiler/checker-object-literals.js +25 -22
  49. package/dist/api/compiler/checker-operators.js +126 -118
  50. package/dist/api/compiler/checker-overloads.js +27 -27
  51. package/dist/api/compiler/checker-property-access.js +59 -55
  52. package/dist/api/compiler/checker-services.d.ts +1 -0
  53. package/dist/api/compiler/checker-services.js +222 -210
  54. package/dist/api/compiler/checker-signatures.js +65 -49
  55. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  56. package/dist/api/compiler/checker-source-file.js +154 -130
  57. package/dist/api/compiler/checker-statements.js +33 -32
  58. package/dist/api/compiler/checker-super.js +50 -50
  59. package/dist/api/compiler/checker-symbol-types.js +109 -93
  60. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  61. package/dist/api/compiler/checker-symbols.js +264 -149
  62. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  63. package/dist/api/compiler/checker-type-factory.js +137 -34
  64. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  65. package/dist/api/compiler/checker-type-nodes.js +179 -141
  66. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  67. package/dist/api/compiler/checker-type-operators.js +110 -63
  68. package/dist/api/compiler/checker-types.d.ts +80 -3
  69. package/dist/api/compiler/checker-types.js +121 -2
  70. package/dist/api/compiler/checker-unused.js +114 -118
  71. package/dist/api/compiler/checker-utilities.js +11 -11
  72. package/dist/api/compiler/checker.d.ts +93 -31
  73. package/dist/api/compiler/checker.js +143 -35
  74. package/dist/api/compiler/command-line.d.ts +1 -3
  75. package/dist/api/compiler/command-line.js +47 -44
  76. package/dist/api/compiler/compile-program.d.ts +19 -4
  77. package/dist/api/compiler/compile-program.js +45 -26
  78. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  79. package/dist/api/compiler/diagnostic-messages.js +128 -122
  80. package/dist/api/compiler/diagnostics.js +7 -7
  81. package/dist/api/compiler/emitter.d.ts +7 -1
  82. package/dist/api/compiler/emitter.js +53 -11
  83. package/dist/api/compiler/file-include.d.ts +2 -1
  84. package/dist/api/compiler/file-include.js +11 -7
  85. package/dist/api/compiler/file-loader.d.ts +10 -0
  86. package/dist/api/compiler/file-loader.js +138 -41
  87. package/dist/api/compiler/instantiation.d.ts +7 -0
  88. package/dist/api/compiler/instantiation.js +101 -49
  89. package/dist/api/compiler/jsdoc.js +23 -23
  90. package/dist/api/compiler/link-tables.d.ts +48 -18
  91. package/dist/api/compiler/link-tables.js +80 -37
  92. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  93. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  94. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  95. package/dist/api/compiler/locales/de-DE.js +1 -1
  96. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  97. package/dist/api/compiler/locales/es-ES.js +1 -1
  98. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  99. package/dist/api/compiler/locales/fr-FR.js +1 -1
  100. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  101. package/dist/api/compiler/locales/it-IT.js +1 -1
  102. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  103. package/dist/api/compiler/locales/ja-JP.js +1 -1
  104. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  105. package/dist/api/compiler/locales/ko-KR.js +1 -1
  106. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  107. package/dist/api/compiler/locales/pl-PL.js +1 -1
  108. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  109. package/dist/api/compiler/locales/pt-BR.js +1 -1
  110. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  111. package/dist/api/compiler/locales/ru-RU.js +1 -1
  112. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  113. package/dist/api/compiler/locales/tr-TR.js +1 -1
  114. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  115. package/dist/api/compiler/locales/zh-CN.js +1 -1
  116. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  117. package/dist/api/compiler/locales/zh-TW.js +1 -1
  118. package/dist/api/compiler/module-resolution-types.js +6 -6
  119. package/dist/api/compiler/module-resolution.d.ts +10 -1
  120. package/dist/api/compiler/module-resolution.js +115 -84
  121. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  122. package/dist/api/compiler/module-specifiers.js +24 -18
  123. package/dist/api/compiler/name-resolver.js +74 -65
  124. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  125. package/dist/api/compiler/node-builder-names.js +210 -90
  126. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  127. package/dist/api/compiler/node-builder-reuse.js +23 -22
  128. package/dist/api/compiler/node-builder.d.ts +18 -1
  129. package/dist/api/compiler/node-builder.js +191 -102
  130. package/dist/api/compiler/option-declarations.d.ts +2 -6
  131. package/dist/api/compiler/option-declarations.js +315 -375
  132. package/dist/api/compiler/options.d.ts +15 -33
  133. package/dist/api/compiler/options.js +21 -54
  134. package/dist/api/compiler/output-paths.d.ts +4 -1
  135. package/dist/api/compiler/output-paths.js +6 -11
  136. package/dist/api/compiler/package-json.d.ts +3 -3
  137. package/dist/api/compiler/package-json.js +11 -10
  138. package/dist/api/compiler/parser.d.ts +40 -19
  139. package/dist/api/compiler/parser.js +308 -216
  140. package/dist/api/compiler/path.d.ts +9 -0
  141. package/dist/api/compiler/path.js +20 -3
  142. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  143. package/dist/api/compiler/printer/emit-context.js +16 -1
  144. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  145. package/dist/api/compiler/printer/factory-base.js +7 -3
  146. package/dist/api/compiler/printer/factory.js +3 -1
  147. package/dist/api/compiler/printer/helpers.js +10 -1
  148. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  149. package/dist/api/compiler/printer/name-generator.js +35 -16
  150. package/dist/api/compiler/printer/printer.d.ts +1 -0
  151. package/dist/api/compiler/printer/printer.js +303 -281
  152. package/dist/api/compiler/printer/utilities.js +149 -147
  153. package/dist/api/compiler/program-checker.d.ts +8 -2
  154. package/dist/api/compiler/program-checker.js +84 -34
  155. package/dist/api/compiler/program-utilities.d.ts +3 -1
  156. package/dist/api/compiler/program-utilities.js +28 -15
  157. package/dist/api/compiler/program.d.ts +2 -0
  158. package/dist/api/compiler/program.js +69 -57
  159. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  160. package/dist/api/compiler/pseudo-bigint.js +18 -0
  161. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  162. package/dist/api/compiler/regexp-checker.js +93 -76
  163. package/dist/api/compiler/relations.d.ts +27 -4
  164. package/dist/api/compiler/relations.js +337 -180
  165. package/dist/api/compiler/reparser.js +60 -56
  166. package/dist/api/compiler/scanner.d.ts +19 -2
  167. package/dist/api/compiler/scanner.js +123 -108
  168. package/dist/api/compiler/shared-results.d.ts +463 -0
  169. package/dist/api/compiler/shared-results.js +2128 -0
  170. package/dist/api/compiler/sourcemap.js +2 -2
  171. package/dist/api/compiler/symbol-accessibility.js +87 -74
  172. package/dist/api/compiler/symbol.d.ts +22 -13
  173. package/dist/api/compiler/symbol.js +15 -1
  174. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  175. package/dist/api/compiler/transformers/alias-references.js +247 -139
  176. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  177. package/dist/api/compiler/transformers/async.d.ts +0 -1
  178. package/dist/api/compiler/transformers/async.js +64 -77
  179. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  180. package/dist/api/compiler/transformers/class-fields.js +81 -78
  181. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  182. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  183. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  184. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  185. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  186. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  187. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  188. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  189. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  190. package/dist/api/compiler/transformers/declarations.js +305 -238
  191. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  192. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  193. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  194. package/dist/api/compiler/transformers/destructuring.js +19 -18
  195. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  196. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  197. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  198. package/dist/api/compiler/transformers/for-await.js +25 -25
  199. package/dist/api/compiler/transformers/import-elision.js +14 -14
  200. package/dist/api/compiler/transformers/jsx.js +12 -12
  201. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  202. package/dist/api/compiler/transformers/module.js +8 -8
  203. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  204. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  205. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  206. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  207. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  208. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  209. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  210. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  211. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  212. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  213. package/dist/api/compiler/transformers/using.js +12 -12
  214. package/dist/api/compiler/transformers/utilities.js +77 -77
  215. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  216. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  217. package/dist/api/compiler/tsconfig.d.ts +10 -2
  218. package/dist/api/compiler/tsconfig.js +136 -48
  219. package/dist/api/compiler/type-printer.js +40 -3
  220. package/dist/api/compiler/types.d.ts +2 -1
  221. package/dist/api/library/ast.generated.d.ts +42 -39
  222. package/dist/api/library/ast.generated.js +1 -1
  223. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  224. package/dist/api/library/compiler-options.generated.js +1 -1
  225. package/dist/api/library/disk.js +12 -1
  226. package/dist/api/library/enums.generated.d.ts +206 -206
  227. package/dist/api/library/enums.generated.js +206 -206
  228. package/dist/api/library/nodes.js +26 -26
  229. package/package.json +9 -9
  230. package/src/compiler/ast-utilities.ts +99 -7
  231. package/src/compiler/ast.ts +55 -26
  232. package/src/compiler/binder.ts +39 -4
  233. package/src/compiler/character-codes.ts +2 -2
  234. package/src/compiler/checker-calls.ts +76 -8
  235. package/src/compiler/checker-classes.ts +78 -24
  236. package/src/compiler/checker-contextual.ts +6 -1
  237. package/src/compiler/checker-declarations.ts +31 -4
  238. package/src/compiler/checker-declared-types.ts +8 -5
  239. package/src/compiler/checker-decorators.ts +1 -1
  240. package/src/compiler/checker-deprecation.ts +29 -8
  241. package/src/compiler/checker-destructuring.ts +10 -3
  242. package/src/compiler/checker-emit-helpers.ts +1 -0
  243. package/src/compiler/checker-emit-resolver.ts +16 -6
  244. package/src/compiler/checker-expressions.ts +79 -46
  245. package/src/compiler/checker-functions.ts +21 -6
  246. package/src/compiler/checker-generated-code.ts +2 -22
  247. package/src/compiler/checker-grammar.ts +133 -60
  248. package/src/compiler/checker-heritage.ts +22 -21
  249. package/src/compiler/checker-inference.ts +514 -87
  250. package/src/compiler/checker-iteration.ts +18 -31
  251. package/src/compiler/checker-javascript.ts +1 -1
  252. package/src/compiler/checker-jsdoc.ts +50 -27
  253. package/src/compiler/checker-jsx.ts +26 -4
  254. package/src/compiler/checker-members.ts +197 -55
  255. package/src/compiler/checker-modules.ts +332 -65
  256. package/src/compiler/checker-narrowing.ts +98 -19
  257. package/src/compiler/checker-object-literals.ts +3 -0
  258. package/src/compiler/checker-operators.ts +11 -4
  259. package/src/compiler/checker-property-access.ts +7 -2
  260. package/src/compiler/checker-services.ts +39 -12
  261. package/src/compiler/checker-signatures.ts +15 -1
  262. package/src/compiler/checker-source-file.ts +39 -13
  263. package/src/compiler/checker-statements.ts +3 -2
  264. package/src/compiler/checker-symbol-types.ts +29 -6
  265. package/src/compiler/checker-symbols.ts +158 -15
  266. package/src/compiler/checker-type-factory.ts +120 -21
  267. package/src/compiler/checker-type-nodes.ts +46 -3
  268. package/src/compiler/checker-type-operators.ts +83 -26
  269. package/src/compiler/checker-types.ts +147 -4
  270. package/src/compiler/checker-unused.ts +9 -14
  271. package/src/compiler/checker.ts +168 -41
  272. package/src/compiler/command-line.ts +28 -28
  273. package/src/compiler/compile-program.ts +51 -25
  274. package/src/compiler/decoder.ts +13 -4
  275. package/src/compiler/diagnostic-messages.ts +1973 -1892
  276. package/src/compiler/emitter.ts +57 -8
  277. package/src/compiler/encoder.ts +23 -8
  278. package/src/compiler/file-include.ts +9 -3
  279. package/src/compiler/file-loader.ts +139 -32
  280. package/src/compiler/help.ts +10 -14
  281. package/src/compiler/incremental.ts +86 -18
  282. package/src/compiler/init.ts +2 -7
  283. package/src/compiler/instantiation.ts +77 -22
  284. package/src/compiler/jsdoc.ts +3 -1
  285. package/src/compiler/link-tables.ts +82 -37
  286. package/src/compiler/locales/cs-CZ.ts +1 -1
  287. package/src/compiler/locales/de-DE.ts +1 -1
  288. package/src/compiler/locales/es-ES.ts +1 -1
  289. package/src/compiler/locales/fr-FR.ts +1 -1
  290. package/src/compiler/locales/it-IT.ts +1 -1
  291. package/src/compiler/locales/ja-JP.ts +1 -1
  292. package/src/compiler/locales/ko-KR.ts +1 -1
  293. package/src/compiler/locales/pl-PL.ts +1 -1
  294. package/src/compiler/locales/pt-BR.ts +1 -1
  295. package/src/compiler/locales/ru-RU.ts +1 -1
  296. package/src/compiler/locales/tr-TR.ts +1 -1
  297. package/src/compiler/locales/zh-CN.ts +1 -1
  298. package/src/compiler/locales/zh-TW.ts +1 -1
  299. package/src/compiler/module-resolution.ts +44 -8
  300. package/src/compiler/module-specifiers.ts +62 -20
  301. package/src/compiler/name-resolver.ts +9 -1
  302. package/src/compiler/node-builder-names.ts +236 -54
  303. package/src/compiler/node-builder-pseudo.ts +4 -7
  304. package/src/compiler/node-builder-reuse.ts +5 -4
  305. package/src/compiler/node-builder.ts +130 -31
  306. package/src/compiler/option-declarations.ts +33 -103
  307. package/src/compiler/options.ts +23 -62
  308. package/src/compiler/output-paths.ts +5 -18
  309. package/src/compiler/package-entrypoints.ts +345 -0
  310. package/src/compiler/package-json.ts +4 -4
  311. package/src/compiler/parallel-check.ts +197 -8
  312. package/src/compiler/parallel-emit.ts +1 -1
  313. package/src/compiler/parser.ts +156 -39
  314. package/src/compiler/path.ts +22 -2
  315. package/src/compiler/printer/emit-context.ts +16 -0
  316. package/src/compiler/printer/factory-base.ts +10 -3
  317. package/src/compiler/printer/factory.ts +4 -1
  318. package/src/compiler/printer/helpers.ts +10 -1
  319. package/src/compiler/printer/name-generator.ts +24 -2
  320. package/src/compiler/printer/printer.ts +35 -14
  321. package/src/compiler/printer/utilities.ts +8 -2
  322. package/src/compiler/program-checker.ts +53 -5
  323. package/src/compiler/program-utilities.ts +23 -10
  324. package/src/compiler/program.ts +13 -1
  325. package/src/compiler/pseudo-bigint.ts +17 -0
  326. package/src/compiler/regexp-checker.ts +63 -30
  327. package/src/compiler/relations.ts +233 -77
  328. package/src/compiler/reparser.ts +7 -2
  329. package/src/compiler/scanner.ts +109 -79
  330. package/src/compiler/shared-results.ts +2414 -0
  331. package/src/compiler/show-config.ts +18 -1
  332. package/src/compiler/sourcemap.ts +2 -2
  333. package/src/compiler/symbol-accessibility.ts +26 -3
  334. package/src/compiler/symbol.ts +31 -14
  335. package/src/compiler/syntax-kind.ts +188 -187
  336. package/src/compiler/thread-entry.ts +19 -2
  337. package/src/compiler/transformers/alias-references.ts +123 -4
  338. package/src/compiler/transformers/async.ts +2 -17
  339. package/src/compiler/transformers/class-fields.ts +13 -12
  340. package/src/compiler/transformers/commonjs-module.ts +11 -7
  341. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  342. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  343. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  344. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  345. package/src/compiler/transformers/declarations.ts +134 -48
  346. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  347. package/src/compiler/transformers/destructuring.ts +4 -3
  348. package/src/compiler/transformers/external-module-info.ts +1 -1
  349. package/src/compiler/transformers/jsx.ts +2 -1
  350. package/src/compiler/transformers/reference-resolver.ts +83 -19
  351. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  352. package/src/compiler/transformers/syntax-facts.ts +2 -7
  353. package/src/compiler/transformers/type-eraser.ts +10 -1
  354. package/src/compiler/transformers/type-serialization.ts +3 -2
  355. package/src/compiler/transformers/visitor-base.ts +2 -1
  356. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  357. package/src/compiler/tsc-build.ts +3 -0
  358. package/src/compiler/tsc-cli.ts +2 -0
  359. package/src/compiler/tsc-compile.ts +7 -2
  360. package/src/compiler/tsc-watch.ts +74 -45
  361. package/src/compiler/tsconfig.ts +176 -19
  362. package/src/compiler/type-printer.ts +36 -2
  363. package/src/compiler/types.ts +2 -1
  364. package/src/library/ast.generated.ts +57 -41
  365. package/src/library/compiler-options.generated.ts +117 -103
  366. package/src/library/disk.ts +10 -1
  367. package/src/library/enums.generated.ts +196 -196
@@ -15,6 +15,7 @@ import { checkExpressionWithTypeArguments } from './checker-calls.js';
15
15
  import { getIntendedTypeFromJSDocTypeReference } from './checker-jsdoc.js';
16
16
  import { getCombinedNodeFlags, hasSyntacticModifier } from './binder-utilities.js';
17
17
  import { getDeclarations, getSymbolId } from './symbol.js';
18
+ import { isStatement } from './printer/utilities.js';
18
19
  export function getTypeFromTypeNode(c, node) {
19
20
  return getConditionalFlowTypeOfType(c, getTypeFromTypeNodeWorker(c, node), node);
20
21
  }
@@ -30,11 +31,11 @@ function getConditionalFlowTypeOfType(c, t, start) {
30
31
  if (parent === undefined)
31
32
  break;
32
33
  // Only parameter positions flip variance; `keyof` is mostly used invariantly in indexed accesses.
33
- if (parent.kind === 170 /* SyntaxKind.Parameter */)
34
+ if (parent.kind === 171 /* SyntaxKind.Parameter */)
34
35
  covariant = !covariant;
35
36
  // Type variables always substitute, as even contravariant positions may rely on their constraints.
36
37
  if ((covariant || (t.flags & 34078720 /* TypeFlags.TypeVariable */) !== 0) &&
37
- parent.kind === 195 /* SyntaxKind.ConditionalType */ &&
38
+ parent.kind === 196 /* SyntaxKind.ConditionalType */ &&
38
39
  node === parent.trueType) {
39
40
  const conditional = parent;
40
41
  const constraint = getImpliedConstraint(c, t, conditional.checkType, conditional.extendsType);
@@ -42,7 +43,7 @@ function getConditionalFlowTypeOfType(c, t, start) {
42
43
  (constraints ??= []).push(constraint);
43
44
  }
44
45
  else if ((t.flags & 524288 /* TypeFlags.TypeParameter */) !== 0 &&
45
- parent.kind === 201 /* SyntaxKind.MappedType */ &&
46
+ parent.kind === 202 /* SyntaxKind.MappedType */ &&
46
47
  parent.nameType === undefined &&
47
48
  node === parent.type) {
48
49
  // Homomorphic mapped types over arrays and tuples map numeric keys only.
@@ -67,32 +68,32 @@ function getImpliedConstraint(c, t, checkNode, extendsNode) {
67
68
  return undefined;
68
69
  }
69
70
  function isUnaryTupleTypeNode(node) {
70
- return node.kind === 190 /* SyntaxKind.TupleType */ && node.elements.nodes.length === 1;
71
+ return node.kind === 191 /* SyntaxKind.TupleType */ && node.elements.nodes.length === 1;
71
72
  }
72
73
  /** A statement, declaration statement or block, which ends the search for enclosing conditional types. */
73
74
  function isStatementLike(node) {
74
75
  switch (node.kind) {
75
- case 242 /* SyntaxKind.Block */:
76
- case 253 /* SyntaxKind.BreakStatement */:
77
- case 252 /* SyntaxKind.ContinueStatement */:
78
- case 260 /* SyntaxKind.DebuggerStatement */:
79
- case 247 /* SyntaxKind.DoStatement */:
80
- case 245 /* SyntaxKind.ExpressionStatement */:
81
- case 243 /* SyntaxKind.EmptyStatement */:
82
- case 250 /* SyntaxKind.ForInStatement */:
83
- case 251 /* SyntaxKind.ForOfStatement */:
84
- case 249 /* SyntaxKind.ForStatement */:
85
- case 246 /* SyntaxKind.IfStatement */:
86
- case 257 /* SyntaxKind.LabeledStatement */:
87
- case 254 /* SyntaxKind.ReturnStatement */:
88
- case 256 /* SyntaxKind.SwitchStatement */:
89
- case 258 /* SyntaxKind.ThrowStatement */:
90
- case 259 /* SyntaxKind.TryStatement */:
91
- case 244 /* SyntaxKind.VariableStatement */:
92
- case 248 /* SyntaxKind.WhileStatement */:
93
- case 255 /* SyntaxKind.WithStatement */:
94
- case 347 /* SyntaxKind.NotEmittedStatement */:
95
- case 315 /* SyntaxKind.JSDoc */:
76
+ case 243 /* SyntaxKind.Block */:
77
+ case 254 /* SyntaxKind.BreakStatement */:
78
+ case 253 /* SyntaxKind.ContinueStatement */:
79
+ case 261 /* SyntaxKind.DebuggerStatement */:
80
+ case 248 /* SyntaxKind.DoStatement */:
81
+ case 246 /* SyntaxKind.ExpressionStatement */:
82
+ case 244 /* SyntaxKind.EmptyStatement */:
83
+ case 251 /* SyntaxKind.ForInStatement */:
84
+ case 252 /* SyntaxKind.ForOfStatement */:
85
+ case 250 /* SyntaxKind.ForStatement */:
86
+ case 247 /* SyntaxKind.IfStatement */:
87
+ case 258 /* SyntaxKind.LabeledStatement */:
88
+ case 255 /* SyntaxKind.ReturnStatement */:
89
+ case 257 /* SyntaxKind.SwitchStatement */:
90
+ case 259 /* SyntaxKind.ThrowStatement */:
91
+ case 260 /* SyntaxKind.TryStatement */:
92
+ case 245 /* SyntaxKind.VariableStatement */:
93
+ case 249 /* SyntaxKind.WhileStatement */:
94
+ case 256 /* SyntaxKind.WithStatement */:
95
+ case 348 /* SyntaxKind.NotEmittedStatement */:
96
+ case 316 /* SyntaxKind.JSDoc */:
96
97
  return true;
97
98
  }
98
99
  return isDeclarationStatementKind(node.kind);
@@ -100,17 +101,17 @@ function isStatementLike(node) {
100
101
  function getTypeFromTypeNodeWorker(c, node) {
101
102
  switch (node.kind) {
102
103
  case 132 /* SyntaxKind.AnyKeyword */:
103
- case 310 /* SyntaxKind.JSDocAllType */:
104
+ case 311 /* SyntaxKind.JSDocAllType */:
104
105
  return c.anyType;
105
- case 312 /* SyntaxKind.JSDocNonNullableType */:
106
+ case 313 /* SyntaxKind.JSDocNonNullableType */:
106
107
  return getTypeFromTypeNode(c, getType(node));
107
- case 311 /* SyntaxKind.JSDocNullableType */: {
108
+ case 312 /* SyntaxKind.JSDocNullableType */: {
108
109
  const t = getTypeFromTypeNode(c, getType(node));
109
110
  return c.strictNullChecks ? getNullableType(c, t, 8 /* TypeFlags.Null */) : t;
110
111
  }
111
- case 314 /* SyntaxKind.JSDocVariadicType */:
112
+ case 315 /* SyntaxKind.JSDocVariadicType */:
112
113
  return createArrayType(c, getTypeFromTypeNode(c, getType(node)));
113
- case 313 /* SyntaxKind.JSDocOptionalType */:
114
+ case 314 /* SyntaxKind.JSDocOptionalType */:
114
115
  return addOptionality(c, getTypeFromTypeNode(c, getType(node)), false, true);
115
116
  case 159 /* SyntaxKind.UnknownKeyword */:
116
117
  return c.unknownType;
@@ -136,48 +137,48 @@ function getTypeFromTypeNodeWorker(c, node) {
136
137
  return c.nonPrimitiveType;
137
138
  case 141 /* SyntaxKind.IntrinsicKeyword */:
138
139
  return c.intrinsicMarkerType;
139
- case 198 /* SyntaxKind.ThisType */:
140
+ case 199 /* SyntaxKind.ThisType */:
140
141
  case 109 /* SyntaxKind.ThisKeyword */:
141
142
  return getTypeFromThisTypeNode(c, node);
142
- case 202 /* SyntaxKind.LiteralType */:
143
+ case 203 /* SyntaxKind.LiteralType */:
143
144
  return getTypeFromLiteralTypeNode(c, node);
144
- case 184 /* SyntaxKind.TypeReference */:
145
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
145
+ case 185 /* SyntaxKind.TypeReference */:
146
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
146
147
  return getTypeFromTypeReference(c, node);
147
- case 183 /* SyntaxKind.TypePredicate */:
148
+ case 184 /* SyntaxKind.TypePredicate */:
148
149
  return node.assertsModifier !== undefined ? c.voidType : c.booleanType;
149
- case 187 /* SyntaxKind.TypeQuery */:
150
+ case 188 /* SyntaxKind.TypeQuery */:
150
151
  return getTypeFromTypeQueryNode(c, node);
151
- case 189 /* SyntaxKind.ArrayType */:
152
- case 190 /* SyntaxKind.TupleType */:
152
+ case 190 /* SyntaxKind.ArrayType */:
153
+ case 191 /* SyntaxKind.TupleType */:
153
154
  return getTypeFromArrayOrTupleTypeNode(c, node);
154
- case 191 /* SyntaxKind.OptionalType */:
155
+ case 192 /* SyntaxKind.OptionalType */:
155
156
  return addOptionality(c, getTypeFromTypeNode(c, node.type), true, true);
156
- case 193 /* SyntaxKind.UnionType */:
157
+ case 194 /* SyntaxKind.UnionType */:
157
158
  return getTypeFromUnionTypeNode(c, node);
158
- case 194 /* SyntaxKind.IntersectionType */:
159
+ case 195 /* SyntaxKind.IntersectionType */:
159
160
  return getTypeFromIntersectionTypeNode(c, node);
160
- case 203 /* SyntaxKind.NamedTupleMember */:
161
+ case 204 /* SyntaxKind.NamedTupleMember */:
161
162
  return getTypeFromNamedTupleTypeNode(c, node);
162
- case 197 /* SyntaxKind.ParenthesizedType */:
163
+ case 198 /* SyntaxKind.ParenthesizedType */:
163
164
  return getTypeFromTypeNode(c, getType(node));
164
- case 192 /* SyntaxKind.RestType */:
165
+ case 193 /* SyntaxKind.RestType */:
165
166
  return getTypeFromRestTypeNode(c, node);
166
- case 185 /* SyntaxKind.FunctionType */:
167
- case 186 /* SyntaxKind.ConstructorType */:
168
- case 188 /* SyntaxKind.TypeLiteral */:
167
+ case 186 /* SyntaxKind.FunctionType */:
168
+ case 187 /* SyntaxKind.ConstructorType */:
169
+ case 189 /* SyntaxKind.TypeLiteral */:
169
170
  return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(c, node);
170
- case 199 /* SyntaxKind.TypeOperator */:
171
+ case 200 /* SyntaxKind.TypeOperator */:
171
172
  return getTypeFromTypeOperatorNode(c, node);
172
- case 200 /* SyntaxKind.IndexedAccessType */:
173
+ case 201 /* SyntaxKind.IndexedAccessType */:
173
174
  return getTypeFromIndexedAccessTypeNode(c, node);
174
- case 204 /* SyntaxKind.TemplateLiteralType */:
175
+ case 205 /* SyntaxKind.TemplateLiteralType */:
175
176
  return getTypeFromTemplateTypeNode(c, node);
176
- case 201 /* SyntaxKind.MappedType */:
177
+ case 202 /* SyntaxKind.MappedType */:
177
178
  return getTypeFromMappedTypeNode(c, node);
178
- case 195 /* SyntaxKind.ConditionalType */:
179
+ case 196 /* SyntaxKind.ConditionalType */:
179
180
  return getTypeFromConditionalTypeNode(c, node);
180
- case 196 /* SyntaxKind.InferType */: {
181
+ case 197 /* SyntaxKind.InferType */: {
181
182
  let type = c.resolvedTypes.get(node.id);
182
183
  if (type === undefined) {
183
184
  type = getDeclaredTypeOfTypeParameter(c, getSymbolOfDeclaration(c, node.typeParameter));
@@ -185,7 +186,7 @@ function getTypeFromTypeNodeWorker(c, node) {
185
186
  }
186
187
  return type;
187
188
  }
188
- case 206 /* SyntaxKind.ImportType */:
189
+ case 207 /* SyntaxKind.ImportType */:
189
190
  return getTypeFromImportTypeNode(c, node);
190
191
  }
191
192
  return c.errorType;
@@ -201,11 +202,11 @@ export function getTypeFromThisTypeNode(c, node) {
201
202
  function getThisType(c, node) {
202
203
  const container = getThisContainer(node, false, false);
203
204
  const parent = container.parent;
204
- if (parent !== undefined && (isClassLike(parent) || parent.kind === 265 /* SyntaxKind.InterfaceDeclaration */)) {
205
- if (!isStatic(container) && (container.kind !== 177 /* SyntaxKind.Constructor */ || isDescendant(node, getBody(container))))
205
+ if (parent !== undefined && (isClassLike(parent) || parent.kind === 266 /* SyntaxKind.InterfaceDeclaration */)) {
206
+ if (!isStatic(container) && (container.kind !== 178 /* SyntaxKind.Constructor */ || isDescendant(node, getBody(container))))
206
207
  return getDeclaredTypeOfClassOrInterface(c, getSymbolOfDeclaration(c, parent)).thisType ?? c.errorType;
207
208
  }
208
- c.error(node, 684 /* Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface */);
209
+ c.error(node, 691 /* Diagnostics.A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface */);
209
210
  return c.errorType;
210
211
  }
211
212
  function isDescendant(node, ancestor) {
@@ -276,34 +277,39 @@ function getTypeFromTypeOperatorNode(c, node) {
276
277
  }
277
278
  function walkUpParenthesizedTypes(node) {
278
279
  let n = node;
279
- while (n.kind === 197 /* SyntaxKind.ParenthesizedType */ && n.parent !== undefined)
280
+ while (n.kind === 198 /* SyntaxKind.ParenthesizedType */ && n.parent !== undefined)
280
281
  n = n.parent;
281
282
  return n;
282
283
  }
283
284
  /** A const variable of a variable statement, a static readonly property, or a readonly property signature. */
284
285
  function isValidESSymbolDeclaration(node) {
285
286
  switch (node.kind) {
286
- case 261 /* SyntaxKind.VariableDeclaration */: {
287
+ case 262 /* SyntaxKind.VariableDeclaration */: {
287
288
  const list = node.parent;
288
289
  return ((getCombinedNodeFlags(node) & 6 /* NodeFlags.Constant */) === 2 /* NodeFlags.Const */ &&
289
290
  getName(node).kind === 79 /* SyntaxKind.Identifier */ &&
290
- list.kind === 262 /* SyntaxKind.VariableDeclarationList */ &&
291
- list.parent.kind === 244 /* SyntaxKind.VariableStatement */);
291
+ list.kind === 263 /* SyntaxKind.VariableDeclarationList */ &&
292
+ list.parent.kind === 245 /* SyntaxKind.VariableStatement */);
292
293
  }
293
- case 173 /* SyntaxKind.PropertyDeclaration */:
294
+ case 174 /* SyntaxKind.PropertyDeclaration */:
294
295
  return hasSyntacticModifier(node, 8 /* ModifierFlags.Readonly */) && isStatic(node);
295
- case 172 /* SyntaxKind.PropertySignature */:
296
+ case 173 /* SyntaxKind.PropertySignature */:
296
297
  return hasSyntacticModifier(node, 8 /* ModifierFlags.Readonly */);
297
298
  }
298
299
  return false;
299
300
  }
301
+ /** tsgo's ast.BlockIdOffset, the first id of the symbols a checker numbers. */
302
+ const symbolBlockIdOffset = 2 ** 48;
300
303
  export function getESSymbolLikeTypeForNode(c, node) {
301
304
  if (isValidESSymbolDeclaration(node)) {
302
305
  const symbol = getSymbolOfDeclaration(c, node);
303
306
  if (symbol !== undefined) {
304
307
  let uniqueType = c.uniqueESSymbolTypes.get(symbol);
305
308
  if (uniqueType === undefined) {
306
- uniqueType = new UniqueESSymbolType(c.nextTypeId(), symbol, '￾@' + symbol.name + '@' + getSymbolId(symbol));
309
+ // tsgo numbers the symbols its checker keeps links for from 2^48 (ast.BlockIdOffset), and the name's length
310
+ // counts toward the node builder's truncation.
311
+ const name = '￾@' + symbol.name + '@' + (symbolBlockIdOffset + getSymbolId(symbol));
312
+ uniqueType = new UniqueESSymbolType(c.nextTypeId(), symbol, name);
307
313
  c.uniqueESSymbolTypes.set(symbol, uniqueType);
308
314
  }
309
315
  return uniqueType;
@@ -313,13 +319,13 @@ export function getESSymbolLikeTypeForNode(c, node) {
313
319
  }
314
320
  // ---- Type references
315
321
  function isConstTypeReference(node) {
316
- if (node.kind !== 184 /* SyntaxKind.TypeReference */)
322
+ if (node.kind !== 185 /* SyntaxKind.TypeReference */)
317
323
  return false;
318
324
  const ref = node;
319
325
  return (ref.typeName.kind === 79 /* SyntaxKind.Identifier */ && getText(ref.typeName) === 'const' && ref.typeArguments === undefined);
320
326
  }
321
- function isAssertionExpression(node) {
322
- return (node !== undefined && (node.kind === 235 /* SyntaxKind.AsExpression */ || node.kind === 217 /* SyntaxKind.TypeAssertionExpression */));
327
+ export function isAssertionExpression(node) {
328
+ return (node !== undefined && (node.kind === 236 /* SyntaxKind.AsExpression */ || node.kind === 218 /* SyntaxKind.TypeAssertionExpression */));
323
329
  }
324
330
  export function getTypeFromTypeReference(c, node) {
325
331
  let type = c.resolvedTypes.get(node.id);
@@ -329,11 +335,43 @@ export function getTypeFromTypeReference(c, node) {
329
335
  else
330
336
  type =
331
337
  getIntendedTypeFromJSDocTypeReference(c, node) ??
332
- getTypeReferenceType(c, node, getSymbolFromTypeReference(c, node));
338
+ getDistributedTypeParameter(c, node, getTypeReferenceType(c, node, getSymbolFromTypeReference(c, node)));
333
339
  c.resolvedTypes.set(node.id, type);
334
340
  }
335
341
  return type;
336
342
  }
343
+ /**
344
+ * The distributed form of a type parameter `t` that `node` references inside a distributive conditional type on
345
+ * it (one whose check type is a bare reference to the type parameter), up to the enclosing statement; otherwise `t`.
346
+ */
347
+ function getDistributedTypeParameter(c, node, t) {
348
+ if ((t.flags & 524288 /* TypeFlags.TypeParameter */) === 0 || t.isDistributed)
349
+ return t;
350
+ for (let n = node.parent; n !== undefined && !isStatement(n); n = n.parent) {
351
+ if (n.kind !== 196 /* SyntaxKind.ConditionalType */)
352
+ continue;
353
+ const checkTypeNode = n.checkType;
354
+ if (isSimpleIdentifierTypeReference(checkTypeNode) && getSymbolFromTypeReference(c, checkTypeNode) === t.symbol)
355
+ return getDistributedTypeFromTypeParameter(c, t);
356
+ }
357
+ return t;
358
+ }
359
+ function getDistributedTypeFromTypeParameter(c, t) {
360
+ let distributed = t.distributedType;
361
+ if (distributed === undefined) {
362
+ distributed = c.newTypeParameter(t.symbol);
363
+ distributed.isDistributed = true;
364
+ distributed.constraint = t;
365
+ t.distributedType = distributed;
366
+ }
367
+ return distributed;
368
+ }
369
+ /** A type reference that is a bare identifier without type arguments. */
370
+ function isSimpleIdentifierTypeReference(node) {
371
+ return (node.kind === 185 /* SyntaxKind.TypeReference */ &&
372
+ node.typeName.kind === 79 /* SyntaxKind.Identifier */ &&
373
+ node.typeArguments === undefined);
374
+ }
337
375
  export function getSymbolFromTypeReference(c, node) {
338
376
  let symbol = c.resolvedSymbols.get(node.id);
339
377
  if (symbol === undefined) {
@@ -346,9 +384,9 @@ export function getSymbolFromTypeReference(c, node) {
346
384
  return symbol;
347
385
  }
348
386
  function getTypeReferenceName(node) {
349
- if (node.kind === 184 /* SyntaxKind.TypeReference */)
387
+ if (node.kind === 185 /* SyntaxKind.TypeReference */)
350
388
  return node.typeName;
351
- if (node.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */) {
389
+ if (node.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */) {
352
390
  const e = node.expression;
353
391
  if (isEntityNameExpression(e))
354
392
  return e;
@@ -358,7 +396,7 @@ function getTypeReferenceName(node) {
358
396
  function isEntityNameExpression(node) {
359
397
  if (node.kind === 79 /* SyntaxKind.Identifier */)
360
398
  return true;
361
- if (node.kind === 212 /* SyntaxKind.PropertyAccessExpression */) {
399
+ if (node.kind === 213 /* SyntaxKind.PropertyAccessExpression */) {
362
400
  const name = getName(node);
363
401
  return name !== undefined && name.kind === 79 /* SyntaxKind.Identifier */ && isEntityNameExpression(getExpression(node));
364
402
  }
@@ -377,9 +415,9 @@ export function resolveTypeReferenceName(c, typeReference, meaning, ignoreErrors
377
415
  }
378
416
  export function getUnresolvedSymbolForEntityName(c, name) {
379
417
  let identifier;
380
- if (name.kind === 167 /* SyntaxKind.QualifiedName */)
418
+ if (name.kind === 168 /* SyntaxKind.QualifiedName */)
381
419
  identifier = name.right;
382
- else if (name.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
420
+ else if (name.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
383
421
  identifier = getName(name);
384
422
  else
385
423
  identifier = name;
@@ -387,14 +425,14 @@ export function getUnresolvedSymbolForEntityName(c, name) {
387
425
  if (text === '')
388
426
  return c.unknownSymbol;
389
427
  let parentSymbol;
390
- if (name.kind === 167 /* SyntaxKind.QualifiedName */)
428
+ if (name.kind === 168 /* SyntaxKind.QualifiedName */)
391
429
  parentSymbol = getUnresolvedSymbolForEntityName(c, name.left);
392
- else if (name.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
430
+ else if (name.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
393
431
  parentSymbol = getUnresolvedSymbolForEntityName(c, getExpression(name));
394
432
  const path = parentSymbol !== undefined ? getSymbolPath(parentSymbol) + '.' + text : text;
395
433
  let result = c.unresolvedSymbols.get(path);
396
434
  if (result === undefined) {
397
- result = c.newSymbolWithCheckFlags(524288 /* SymbolFlags.TypeAlias */, text, 1048576 /* CheckFlags.Unresolved */);
435
+ result = c.newSymbolWithCheckFlags(524288 /* SymbolFlags.TypeAlias */, text, 8388608 /* CheckFlags.Unresolved */);
398
436
  c.unresolvedSymbols.set(path, result);
399
437
  result.parent = parentSymbol;
400
438
  c.symbolLinks(result).declaredType = c.unresolvedType;
@@ -442,13 +480,13 @@ export function getTypeFromClassOrInterfaceReference(c, node, symbol) {
442
480
  const isJsImplicitAny = !c.noImplicitAny && isJs;
443
481
  if (!isJsImplicitAny && (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length)) {
444
482
  const message = minTypeArgumentCount < typeParameters.length
445
- ? 839 /* Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments */
446
- : 492 /* Diagnostics.Generic_type_0_requires_1_type_argument_s */;
483
+ ? 846 /* Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments */
484
+ : 499 /* Diagnostics.Generic_type_0_requires_1_type_argument_s */;
447
485
  c.error(node, message, typeToString(c, t, undefined, 1 << 1), String(minTypeArgumentCount), String(typeParameters.length));
448
486
  if (!isJs)
449
487
  return c.errorType;
450
488
  }
451
- if (node.kind === 184 /* SyntaxKind.TypeReference */ &&
489
+ if (node.kind === 185 /* SyntaxKind.TypeReference */ &&
452
490
  isDeferredTypeReferenceNode(c, node, numTypeArguments !== typeParameters.length))
453
491
  return createDeferredTypeReference(c, t, node, undefined, getAliasForTypeNode(c, node));
454
492
  // Outer type parameters are supplied automatically; the reference gives the local ones.
@@ -456,13 +494,13 @@ export function getTypeFromClassOrInterfaceReference(c, node, symbol) {
456
494
  // localTypeArguments is a new list, so without outer type parameters it is the reference's own.
457
495
  const outerCount = t.outerTypeParameterCount;
458
496
  if (outerCount === 0)
459
- return createTypeReferenceEx(c, t, localTypeArguments, 1073741824 /* ObjectFlags.FromTypeNode */);
497
+ return createTypeReferenceEx(c, t, localTypeArguments, 536870912 /* ObjectFlags.FromTypeNode */);
460
498
  const typeArguments = [];
461
499
  for (let i = 0; i < outerCount; i++)
462
500
  typeArguments.push(t.allTypeParameters[i]);
463
501
  for (const typeArgument of localTypeArguments)
464
502
  typeArguments.push(typeArgument);
465
- return createTypeReferenceEx(c, t, typeArguments, 1073741824 /* ObjectFlags.FromTypeNode */);
503
+ return createTypeReferenceEx(c, t, typeArguments, 536870912 /* ObjectFlags.FromTypeNode */);
466
504
  }
467
505
  export function checkNoTypeArguments(c, node, symbol) {
468
506
  if (typeArgumentNodesOf(node).length === 0)
@@ -470,7 +508,7 @@ export function checkNoTypeArguments(c, node, symbol) {
470
508
  const typeName = symbol !== undefined
471
509
  ? symbolToString(c, symbol)
472
510
  : declarationNameToString(getSourceFileOfNode(node), node.typeName);
473
- c.error(node, 493 /* Diagnostics.Type_0_is_not_generic */, typeName);
511
+ c.error(node, 500 /* Diagnostics.Type_0_is_not_generic */, typeName);
474
512
  return false;
475
513
  }
476
514
  /** Directly aliased references, and those possibly in circular chains of eagerly resolved types, are deferred. */
@@ -480,11 +518,11 @@ function isDeferredTypeReferenceNode(c, node, hasDefaultTypeArguments) {
480
518
  if (!isResolvedByTypeAlias(node))
481
519
  return false;
482
520
  switch (node.kind) {
483
- case 189 /* SyntaxKind.ArrayType */:
521
+ case 190 /* SyntaxKind.ArrayType */:
484
522
  return mayResolveTypeAlias(c, node.elementType);
485
- case 190 /* SyntaxKind.TupleType */:
523
+ case 191 /* SyntaxKind.TupleType */:
486
524
  return someMayResolveTypeAlias(c, node.elements.nodes);
487
- case 184 /* SyntaxKind.TypeReference */:
525
+ case 185 /* SyntaxKind.TypeReference */:
488
526
  return hasDefaultTypeArguments || someMayResolveTypeAlias(c, typeArgumentNodesOf(node));
489
527
  }
490
528
  return false;
@@ -492,48 +530,48 @@ function isDeferredTypeReferenceNode(c, node, hasDefaultTypeArguments) {
492
530
  function isResolvedByTypeAlias(node) {
493
531
  const parent = node.parent;
494
532
  switch (parent.kind) {
495
- case 197 /* SyntaxKind.ParenthesizedType */:
496
- case 203 /* SyntaxKind.NamedTupleMember */:
497
- case 184 /* SyntaxKind.TypeReference */:
498
- case 193 /* SyntaxKind.UnionType */:
499
- case 194 /* SyntaxKind.IntersectionType */:
500
- case 200 /* SyntaxKind.IndexedAccessType */:
501
- case 195 /* SyntaxKind.ConditionalType */:
502
- case 199 /* SyntaxKind.TypeOperator */:
503
- case 189 /* SyntaxKind.ArrayType */:
504
- case 190 /* SyntaxKind.TupleType */:
533
+ case 198 /* SyntaxKind.ParenthesizedType */:
534
+ case 204 /* SyntaxKind.NamedTupleMember */:
535
+ case 185 /* SyntaxKind.TypeReference */:
536
+ case 194 /* SyntaxKind.UnionType */:
537
+ case 195 /* SyntaxKind.IntersectionType */:
538
+ case 201 /* SyntaxKind.IndexedAccessType */:
539
+ case 196 /* SyntaxKind.ConditionalType */:
540
+ case 200 /* SyntaxKind.TypeOperator */:
541
+ case 190 /* SyntaxKind.ArrayType */:
542
+ case 191 /* SyntaxKind.TupleType */:
505
543
  return isResolvedByTypeAlias(parent);
506
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
507
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
544
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
545
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
508
546
  return true;
509
547
  }
510
548
  return false;
511
549
  }
512
550
  function mayResolveTypeAlias(c, node) {
513
551
  switch (node.kind) {
514
- case 184 /* SyntaxKind.TypeReference */:
552
+ case 185 /* SyntaxKind.TypeReference */:
515
553
  return (resolveTypeReferenceName(c, node, 788968 /* SymbolFlags.Type */, false).flags & 524288 /* SymbolFlags.TypeAlias */) !== 0;
516
- case 187 /* SyntaxKind.TypeQuery */:
554
+ case 188 /* SyntaxKind.TypeQuery */:
517
555
  return true;
518
- case 199 /* SyntaxKind.TypeOperator */:
556
+ case 200 /* SyntaxKind.TypeOperator */:
519
557
  return (node.operator !== 158 /* SyntaxKind.UniqueKeyword */ &&
520
558
  mayResolveTypeAlias(c, node.type));
521
- case 197 /* SyntaxKind.ParenthesizedType */:
522
- case 191 /* SyntaxKind.OptionalType */:
523
- case 203 /* SyntaxKind.NamedTupleMember */:
559
+ case 198 /* SyntaxKind.ParenthesizedType */:
560
+ case 192 /* SyntaxKind.OptionalType */:
561
+ case 204 /* SyntaxKind.NamedTupleMember */:
524
562
  return mayResolveTypeAlias(c, getType(node));
525
- case 192 /* SyntaxKind.RestType */: {
563
+ case 193 /* SyntaxKind.RestType */: {
526
564
  const t = node.type;
527
- return t.kind !== 189 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(c, t.elementType);
565
+ return t.kind !== 190 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(c, t.elementType);
528
566
  }
529
- case 193 /* SyntaxKind.UnionType */:
567
+ case 194 /* SyntaxKind.UnionType */:
530
568
  return someMayResolveTypeAlias(c, node.types.nodes);
531
- case 194 /* SyntaxKind.IntersectionType */:
569
+ case 195 /* SyntaxKind.IntersectionType */:
532
570
  return someMayResolveTypeAlias(c, node.types.nodes);
533
- case 200 /* SyntaxKind.IndexedAccessType */:
571
+ case 201 /* SyntaxKind.IndexedAccessType */:
534
572
  return (mayResolveTypeAlias(c, node.objectType) ||
535
573
  mayResolveTypeAlias(c, node.indexType));
536
- case 195 /* SyntaxKind.ConditionalType */: {
574
+ case 196 /* SyntaxKind.ConditionalType */: {
537
575
  const n = node;
538
576
  return (mayResolveTypeAlias(c, n.checkType) ||
539
577
  mayResolveTypeAlias(c, n.extendsType) ||
@@ -551,7 +589,7 @@ function someMayResolveTypeAlias(c, nodes) {
551
589
  }
552
590
  // ---- Type aliases
553
591
  export function isTypeAlias(node) {
554
- return node.kind === 266 /* SyntaxKind.TypeAliasDeclaration */ || node.kind === 345 /* SyntaxKind.JSTypeAliasDeclaration */;
592
+ return node.kind === 267 /* SyntaxKind.TypeAliasDeclaration */ || node.kind === 346 /* SyntaxKind.JSTypeAliasDeclaration */;
555
593
  }
556
594
  export function getAliasForTypeNode(c, node) {
557
595
  const symbol = getAliasSymbolForTypeNode(c, node);
@@ -561,8 +599,8 @@ export function getAliasForTypeNode(c, node) {
561
599
  }
562
600
  export function getAliasSymbolForTypeNode(c, node) {
563
601
  let host = node.parent;
564
- while (host.kind === 197 /* SyntaxKind.ParenthesizedType */ ||
565
- (host.kind === 199 /* SyntaxKind.TypeOperator */ && host.operator === 148 /* SyntaxKind.ReadonlyKeyword */))
602
+ while (host.kind === 198 /* SyntaxKind.ParenthesizedType */ ||
603
+ (host.kind === 200 /* SyntaxKind.TypeOperator */ && host.operator === 148 /* SyntaxKind.ReadonlyKeyword */))
566
604
  host = host.parent;
567
605
  return isTypeAlias(host) ? getSymbolOfDeclaration(c, host) : undefined;
568
606
  }
@@ -578,13 +616,13 @@ function isLocalTypeAlias(symbol) {
578
616
  return false;
579
617
  for (let n = declaration.parent; n !== undefined; n = n.parent) {
580
618
  switch (n.kind) {
581
- case 263 /* SyntaxKind.FunctionDeclaration */:
582
- case 219 /* SyntaxKind.FunctionExpression */:
583
- case 220 /* SyntaxKind.ArrowFunction */:
584
- case 175 /* SyntaxKind.MethodDeclaration */:
585
- case 177 /* SyntaxKind.Constructor */:
586
- case 178 /* SyntaxKind.GetAccessor */:
587
- case 179 /* SyntaxKind.SetAccessor */:
619
+ case 264 /* SyntaxKind.FunctionDeclaration */:
620
+ case 220 /* SyntaxKind.FunctionExpression */:
621
+ case 221 /* SyntaxKind.ArrowFunction */:
622
+ case 176 /* SyntaxKind.MethodDeclaration */:
623
+ case 178 /* SyntaxKind.Constructor */:
624
+ case 179 /* SyntaxKind.GetAccessor */:
625
+ case 180 /* SyntaxKind.SetAccessor */:
588
626
  return true;
589
627
  }
590
628
  }
@@ -592,7 +630,7 @@ function isLocalTypeAlias(symbol) {
592
630
  }
593
631
  function getTypeFromTypeAliasReference(c, node, symbol) {
594
632
  const typeArgumentNodes = typeArgumentNodesOf(node);
595
- if ((symbol.checkFlags & 1048576 /* CheckFlags.Unresolved */) !== 0) {
633
+ if ((symbol.checkFlags & 8388608 /* CheckFlags.Unresolved */) !== 0) {
596
634
  const alias = new TypeAlias(symbol, getTypesFromTypeNodes(c, typeArgumentNodes));
597
635
  const key = aliasKey(alias);
598
636
  let errorType = c.errorTypes.get(key);
@@ -610,8 +648,8 @@ function getTypeFromTypeAliasReference(c, node, symbol) {
610
648
  const minTypeArgumentCount = getMinTypeArgumentCount(c, typeParameters);
611
649
  if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
612
650
  const message = minTypeArgumentCount === typeParameters.length
613
- ? 492 /* Diagnostics.Generic_type_0_requires_1_type_argument_s */
614
- : 839 /* Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments */;
651
+ ? 499 /* Diagnostics.Generic_type_0_requires_1_type_argument_s */
652
+ : 846 /* Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments */;
615
653
  c.error(node, message, symbolToString(c, symbol), String(minTypeArgumentCount), String(typeParameters.length));
616
654
  return c.errorType;
617
655
  }
@@ -623,7 +661,7 @@ function getTypeFromTypeAliasReference(c, node, symbol) {
623
661
  let aliasTypeArguments;
624
662
  if (newAliasSymbol !== undefined)
625
663
  aliasTypeArguments = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(c, newAliasSymbol);
626
- else if (node.kind === 184 /* SyntaxKind.TypeReference */) {
664
+ else if (node.kind === 185 /* SyntaxKind.TypeReference */) {
627
665
  const aliased = resolveTypeReferenceName(c, node, 2097152 /* SymbolFlags.Alias */, true);
628
666
  if (aliased !== c.unknownSymbol) {
629
667
  const resolved = resolveAlias(c, aliased);
@@ -675,13 +713,13 @@ function getTypeFromTypeQueryNode(c, node) {
675
713
  }
676
714
  export function getTupleElementFlags(c, node) {
677
715
  switch (node.kind) {
678
- case 191 /* SyntaxKind.OptionalType */:
716
+ case 192 /* SyntaxKind.OptionalType */:
679
717
  return 2 /* ElementFlags.Optional */;
680
- case 192 /* SyntaxKind.RestType */:
718
+ case 193 /* SyntaxKind.RestType */:
681
719
  return getArrayElementTypeNode(node.type) !== undefined
682
720
  ? 4 /* ElementFlags.Rest */
683
721
  : 8 /* ElementFlags.Variadic */;
684
- case 203 /* SyntaxKind.NamedTupleMember */: {
722
+ case 204 /* SyntaxKind.NamedTupleMember */: {
685
723
  const named = node;
686
724
  if (named.questionToken !== undefined)
687
725
  return 2 /* ElementFlags.Optional */;
@@ -693,31 +731,31 @@ export function getTupleElementFlags(c, node) {
693
731
  return 1 /* ElementFlags.Required */;
694
732
  }
695
733
  function getTupleElementInfo(c, node) {
696
- return new TupleElementInfo(getTupleElementFlags(c, node), node.kind === 203 /* SyntaxKind.NamedTupleMember */ || node.kind === 170 /* SyntaxKind.Parameter */ ? node : undefined);
734
+ return new TupleElementInfo(getTupleElementFlags(c, node), node.kind === 204 /* SyntaxKind.NamedTupleMember */ || node.kind === 171 /* SyntaxKind.Parameter */ ? node : undefined);
697
735
  }
698
736
  function getArrayElementTypeNode(node) {
699
737
  switch (node.kind) {
700
- case 197 /* SyntaxKind.ParenthesizedType */:
738
+ case 198 /* SyntaxKind.ParenthesizedType */:
701
739
  return getArrayElementTypeNode(getType(node));
702
- case 190 /* SyntaxKind.TupleType */: {
740
+ case 191 /* SyntaxKind.TupleType */: {
703
741
  const elements = node.elements.nodes;
704
742
  if (elements.length === 1) {
705
743
  const e = elements[0];
706
- if (e.kind === 192 /* SyntaxKind.RestType */)
744
+ if (e.kind === 193 /* SyntaxKind.RestType */)
707
745
  return getArrayElementTypeNode(e.type);
708
- if (e.kind === 203 /* SyntaxKind.NamedTupleMember */ && e.dotDotDotToken !== undefined)
746
+ if (e.kind === 204 /* SyntaxKind.NamedTupleMember */ && e.dotDotDotToken !== undefined)
709
747
  return getArrayElementTypeNode(e.type);
710
748
  }
711
749
  return undefined;
712
750
  }
713
- case 189 /* SyntaxKind.ArrayType */:
751
+ case 190 /* SyntaxKind.ArrayType */:
714
752
  return node.elementType;
715
753
  }
716
754
  return undefined;
717
755
  }
718
756
  function getArrayOrTupleTargetType(c, node) {
719
757
  const parent = node.parent;
720
- const readonly = parent.kind === 199 /* SyntaxKind.TypeOperator */ && parent.operator === 148 /* SyntaxKind.ReadonlyKeyword */;
758
+ const readonly = parent.kind === 200 /* SyntaxKind.TypeOperator */ && parent.operator === 148 /* SyntaxKind.ReadonlyKeyword */;
721
759
  if (getArrayElementTypeNode(node) !== undefined)
722
760
  return readonly ? c.globalReadonlyArrayType : c.globalArrayType;
723
761
  const elementInfos = [];
@@ -732,18 +770,18 @@ function getTypeFromArrayOrTupleTypeNode(c, node) {
732
770
  const target = getArrayOrTupleTargetType(c, node);
733
771
  if (target === c.emptyGenericType)
734
772
  c.resolvedTypes.set(node.id, c.emptyObjectType);
735
- else if (!(node.kind === 190 /* SyntaxKind.TupleType */ && hasVariadicTupleElement(c, node)) &&
773
+ else if (!(node.kind === 191 /* SyntaxKind.TupleType */ && hasVariadicTupleElement(c, node)) &&
736
774
  isDeferredTypeReferenceNode(c, node, false))
737
- c.resolvedTypes.set(node.id, node.kind === 190 /* SyntaxKind.TupleType */ && node.elements.nodes.length === 0
775
+ c.resolvedTypes.set(node.id, node.kind === 191 /* SyntaxKind.TupleType */ && node.elements.nodes.length === 0
738
776
  ? target
739
777
  : createDeferredTypeReference(c, target, node, undefined, getAliasForTypeNode(c, node)));
740
778
  else {
741
- const elementTypes = node.kind === 189 /* SyntaxKind.ArrayType */
779
+ const elementTypes = node.kind === 190 /* SyntaxKind.ArrayType */
742
780
  ? [getTypeFromTypeNode(c, node.elementType)]
743
781
  : getTypesFromTypeNodes(c, node.elements.nodes);
744
782
  c.resolvedTypes.set(node.id, (target.objectFlags & 8 /* ObjectFlags.Tuple */) !== 0
745
- ? createNormalizedTupleType(c, target, elementTypes, 1073741824 /* ObjectFlags.FromTypeNode */)
746
- : createTypeReferenceEx(c, target, elementTypes, 1073741824 /* ObjectFlags.FromTypeNode */));
783
+ ? createNormalizedTupleType(c, target, elementTypes, 536870912 /* ObjectFlags.FromTypeNode */)
784
+ : createTypeReferenceEx(c, target, elementTypes, 536870912 /* ObjectFlags.FromTypeNode */));
747
785
  }
748
786
  return c.resolvedTypes.get(node.id);
749
787
  }
@@ -756,13 +794,13 @@ function hasVariadicTupleElement(c, node) {
756
794
  /** Type arguments of a deferred reference from its node. */
757
795
  export function getTypeArgumentsOfDeferredReference(c, node, target) {
758
796
  switch (node.kind) {
759
- case 184 /* SyntaxKind.TypeReference */:
797
+ case 185 /* SyntaxKind.TypeReference */:
760
798
  return target
761
799
  .outerTypeParameters()
762
800
  .concat(fillMissingTypeArguments(c, getTypeArgumentsFromNode(c, node), target.localTypeParameters(), getMinTypeArgumentCount(c, target.localTypeParameters()), (node.flags & 65536 /* NodeFlags.JavaScriptFile */) !== 0));
763
- case 189 /* SyntaxKind.ArrayType */:
801
+ case 190 /* SyntaxKind.ArrayType */:
764
802
  return [getTypeFromTypeNode(c, node.elementType)];
765
- case 190 /* SyntaxKind.TupleType */:
803
+ case 191 /* SyntaxKind.TupleType */:
766
804
  return getTypesFromTypeNodes(c, node.elements.nodes);
767
805
  }
768
806
  return [];