tsc-ts 0.0.9 → 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 (373) hide show
  1. package/README.md +2 -2
  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 +22 -15
  6. package/dist/api/compiler/ast.js +1026 -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 +178 -124
  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 +472 -440
  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 -107
  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 +212 -75
  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 +145 -36
  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 +104 -31
  73. package/dist/api/compiler/checker.js +181 -33
  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 +42 -3
  77. package/dist/api/compiler/compile-program.js +139 -27
  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.d.ts +22 -0
  81. package/dist/api/compiler/diagnostics.js +93 -11
  82. package/dist/api/compiler/emitter.d.ts +7 -1
  83. package/dist/api/compiler/emitter.js +53 -11
  84. package/dist/api/compiler/file-include.d.ts +2 -1
  85. package/dist/api/compiler/file-include.js +11 -7
  86. package/dist/api/compiler/file-loader.d.ts +21 -1
  87. package/dist/api/compiler/file-loader.js +201 -48
  88. package/dist/api/compiler/instantiation.d.ts +7 -0
  89. package/dist/api/compiler/instantiation.js +101 -49
  90. package/dist/api/compiler/jsdoc.js +23 -23
  91. package/dist/api/compiler/link-tables.d.ts +48 -18
  92. package/dist/api/compiler/link-tables.js +80 -37
  93. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  94. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  95. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  96. package/dist/api/compiler/locales/de-DE.js +1 -1
  97. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  98. package/dist/api/compiler/locales/es-ES.js +1 -1
  99. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  100. package/dist/api/compiler/locales/fr-FR.js +1 -1
  101. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  102. package/dist/api/compiler/locales/it-IT.js +1 -1
  103. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  104. package/dist/api/compiler/locales/ja-JP.js +1 -1
  105. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  106. package/dist/api/compiler/locales/ko-KR.js +1 -1
  107. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  108. package/dist/api/compiler/locales/pl-PL.js +1 -1
  109. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  110. package/dist/api/compiler/locales/pt-BR.js +1 -1
  111. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  112. package/dist/api/compiler/locales/ru-RU.js +1 -1
  113. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  114. package/dist/api/compiler/locales/tr-TR.js +1 -1
  115. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  116. package/dist/api/compiler/locales/zh-CN.js +1 -1
  117. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  118. package/dist/api/compiler/locales/zh-TW.js +1 -1
  119. package/dist/api/compiler/module-resolution-types.js +6 -6
  120. package/dist/api/compiler/module-resolution.d.ts +10 -1
  121. package/dist/api/compiler/module-resolution.js +115 -84
  122. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  123. package/dist/api/compiler/module-specifiers.js +24 -18
  124. package/dist/api/compiler/name-resolver.js +74 -65
  125. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  126. package/dist/api/compiler/node-builder-names.js +210 -90
  127. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  128. package/dist/api/compiler/node-builder-reuse.js +23 -22
  129. package/dist/api/compiler/node-builder.d.ts +18 -1
  130. package/dist/api/compiler/node-builder.js +191 -102
  131. package/dist/api/compiler/option-declarations.d.ts +2 -6
  132. package/dist/api/compiler/option-declarations.js +315 -375
  133. package/dist/api/compiler/options.d.ts +15 -33
  134. package/dist/api/compiler/options.js +21 -54
  135. package/dist/api/compiler/output-paths.d.ts +4 -1
  136. package/dist/api/compiler/output-paths.js +6 -11
  137. package/dist/api/compiler/package-json.d.ts +3 -3
  138. package/dist/api/compiler/package-json.js +11 -10
  139. package/dist/api/compiler/parallel-parse.d.ts +3 -2
  140. package/dist/api/compiler/parallel-parse.js +17 -5
  141. package/dist/api/compiler/parser.d.ts +40 -19
  142. package/dist/api/compiler/parser.js +308 -216
  143. package/dist/api/compiler/path.d.ts +9 -0
  144. package/dist/api/compiler/path.js +20 -3
  145. package/dist/api/compiler/printer/emit-context.d.ts +5 -1
  146. package/dist/api/compiler/printer/emit-context.js +20 -1
  147. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  148. package/dist/api/compiler/printer/factory-base.js +7 -3
  149. package/dist/api/compiler/printer/factory.js +3 -1
  150. package/dist/api/compiler/printer/helpers.js +10 -1
  151. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  152. package/dist/api/compiler/printer/name-generator.js +35 -16
  153. package/dist/api/compiler/printer/printer.d.ts +49 -2
  154. package/dist/api/compiler/printer/printer.js +539 -293
  155. package/dist/api/compiler/printer/utilities.js +149 -147
  156. package/dist/api/compiler/program-checker.d.ts +12 -2
  157. package/dist/api/compiler/program-checker.js +88 -34
  158. package/dist/api/compiler/program-utilities.d.ts +3 -1
  159. package/dist/api/compiler/program-utilities.js +28 -15
  160. package/dist/api/compiler/program.d.ts +4 -6
  161. package/dist/api/compiler/program.js +74 -87
  162. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  163. package/dist/api/compiler/pseudo-bigint.js +18 -0
  164. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  165. package/dist/api/compiler/regexp-checker.js +93 -76
  166. package/dist/api/compiler/relations.d.ts +27 -4
  167. package/dist/api/compiler/relations.js +347 -180
  168. package/dist/api/compiler/reparser.js +60 -56
  169. package/dist/api/compiler/scanner.d.ts +19 -2
  170. package/dist/api/compiler/scanner.js +123 -108
  171. package/dist/api/compiler/shared-results.d.ts +463 -0
  172. package/dist/api/compiler/shared-results.js +2128 -0
  173. package/dist/api/compiler/sourcemap.js +2 -2
  174. package/dist/api/compiler/symbol-accessibility.js +87 -74
  175. package/dist/api/compiler/symbol.d.ts +23 -14
  176. package/dist/api/compiler/symbol.js +23 -11
  177. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  178. package/dist/api/compiler/transformers/alias-references.js +247 -139
  179. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  180. package/dist/api/compiler/transformers/async.d.ts +0 -1
  181. package/dist/api/compiler/transformers/async.js +64 -77
  182. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  183. package/dist/api/compiler/transformers/class-fields.js +81 -78
  184. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  185. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  186. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  187. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  188. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  189. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  190. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  191. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  192. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  193. package/dist/api/compiler/transformers/declarations.js +305 -238
  194. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  195. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  196. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  197. package/dist/api/compiler/transformers/destructuring.js +19 -18
  198. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  199. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  200. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  201. package/dist/api/compiler/transformers/for-await.js +25 -25
  202. package/dist/api/compiler/transformers/import-elision.js +14 -14
  203. package/dist/api/compiler/transformers/jsx.js +12 -12
  204. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  205. package/dist/api/compiler/transformers/module.js +8 -8
  206. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  207. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  208. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  209. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  210. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  211. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  212. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  213. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  214. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  215. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  216. package/dist/api/compiler/transformers/using.js +12 -12
  217. package/dist/api/compiler/transformers/utilities.js +77 -77
  218. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  219. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  220. package/dist/api/compiler/tsconfig.d.ts +10 -2
  221. package/dist/api/compiler/tsconfig.js +136 -48
  222. package/dist/api/compiler/type-printer.js +40 -3
  223. package/dist/api/compiler/types.d.ts +2 -1
  224. package/dist/api/library/ast.generated.d.ts +42 -39
  225. package/dist/api/library/ast.generated.js +1 -1
  226. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  227. package/dist/api/library/compiler-options.generated.js +1 -1
  228. package/dist/api/library/disk.js +12 -1
  229. package/dist/api/library/enums.generated.d.ts +206 -206
  230. package/dist/api/library/enums.generated.js +206 -206
  231. package/dist/api/library/nodes.js +26 -26
  232. package/package.json +9 -9
  233. package/src/compiler/ast-utilities.ts +99 -7
  234. package/src/compiler/ast.ts +58 -26
  235. package/src/compiler/binder.ts +39 -4
  236. package/src/compiler/character-codes.ts +2 -2
  237. package/src/compiler/checker-calls.ts +79 -9
  238. package/src/compiler/checker-classes.ts +78 -24
  239. package/src/compiler/checker-contextual.ts +6 -1
  240. package/src/compiler/checker-declarations.ts +31 -4
  241. package/src/compiler/checker-declared-types.ts +8 -5
  242. package/src/compiler/checker-decorators.ts +1 -1
  243. package/src/compiler/checker-deprecation.ts +29 -8
  244. package/src/compiler/checker-destructuring.ts +10 -3
  245. package/src/compiler/checker-emit-helpers.ts +1 -0
  246. package/src/compiler/checker-emit-resolver.ts +16 -6
  247. package/src/compiler/checker-expressions.ts +79 -46
  248. package/src/compiler/checker-functions.ts +21 -6
  249. package/src/compiler/checker-generated-code.ts +2 -22
  250. package/src/compiler/checker-grammar.ts +136 -62
  251. package/src/compiler/checker-heritage.ts +22 -21
  252. package/src/compiler/checker-inference.ts +514 -82
  253. package/src/compiler/checker-iteration.ts +18 -31
  254. package/src/compiler/checker-javascript.ts +1 -1
  255. package/src/compiler/checker-jsdoc.ts +50 -27
  256. package/src/compiler/checker-jsx.ts +26 -4
  257. package/src/compiler/checker-members.ts +200 -56
  258. package/src/compiler/checker-modules.ts +332 -65
  259. package/src/compiler/checker-narrowing.ts +98 -19
  260. package/src/compiler/checker-object-literals.ts +3 -0
  261. package/src/compiler/checker-operators.ts +11 -4
  262. package/src/compiler/checker-property-access.ts +7 -2
  263. package/src/compiler/checker-services.ts +39 -12
  264. package/src/compiler/checker-signatures.ts +15 -1
  265. package/src/compiler/checker-source-file.ts +39 -13
  266. package/src/compiler/checker-statements.ts +3 -2
  267. package/src/compiler/checker-symbol-types.ts +29 -6
  268. package/src/compiler/checker-symbols.ts +158 -15
  269. package/src/compiler/checker-type-factory.ts +124 -23
  270. package/src/compiler/checker-type-nodes.ts +46 -3
  271. package/src/compiler/checker-type-operators.ts +83 -26
  272. package/src/compiler/checker-types.ts +147 -4
  273. package/src/compiler/checker-unused.ts +9 -14
  274. package/src/compiler/checker.ts +203 -39
  275. package/src/compiler/command-line.ts +28 -28
  276. package/src/compiler/compile-program.ts +167 -27
  277. package/src/compiler/decoder.ts +13 -4
  278. package/src/compiler/diagnostic-messages.ts +1973 -1892
  279. package/src/compiler/diagnostics.ts +84 -3
  280. package/src/compiler/emitter.ts +57 -8
  281. package/src/compiler/encoder.ts +23 -8
  282. package/src/compiler/file-include.ts +9 -3
  283. package/src/compiler/file-loader.ts +197 -38
  284. package/src/compiler/help.ts +10 -14
  285. package/src/compiler/incremental.ts +165 -30
  286. package/src/compiler/init.ts +2 -7
  287. package/src/compiler/instantiation.ts +77 -22
  288. package/src/compiler/jsdoc.ts +3 -1
  289. package/src/compiler/link-tables.ts +82 -37
  290. package/src/compiler/locales/cs-CZ.ts +1 -1
  291. package/src/compiler/locales/de-DE.ts +1 -1
  292. package/src/compiler/locales/es-ES.ts +1 -1
  293. package/src/compiler/locales/fr-FR.ts +1 -1
  294. package/src/compiler/locales/it-IT.ts +1 -1
  295. package/src/compiler/locales/ja-JP.ts +1 -1
  296. package/src/compiler/locales/ko-KR.ts +1 -1
  297. package/src/compiler/locales/pl-PL.ts +1 -1
  298. package/src/compiler/locales/pt-BR.ts +1 -1
  299. package/src/compiler/locales/ru-RU.ts +1 -1
  300. package/src/compiler/locales/tr-TR.ts +1 -1
  301. package/src/compiler/locales/zh-CN.ts +1 -1
  302. package/src/compiler/locales/zh-TW.ts +1 -1
  303. package/src/compiler/module-resolution.ts +44 -8
  304. package/src/compiler/module-specifiers.ts +62 -20
  305. package/src/compiler/name-resolver.ts +9 -1
  306. package/src/compiler/node-builder-names.ts +236 -54
  307. package/src/compiler/node-builder-pseudo.ts +4 -7
  308. package/src/compiler/node-builder-reuse.ts +5 -4
  309. package/src/compiler/node-builder.ts +130 -31
  310. package/src/compiler/option-declarations.ts +33 -103
  311. package/src/compiler/options.ts +23 -62
  312. package/src/compiler/output-paths.ts +5 -18
  313. package/src/compiler/package-entrypoints.ts +345 -0
  314. package/src/compiler/package-json.ts +4 -4
  315. package/src/compiler/parallel-check.ts +326 -52
  316. package/src/compiler/parallel-emit.ts +320 -0
  317. package/src/compiler/parallel-parse.ts +16 -5
  318. package/src/compiler/parse-thread.ts +3 -0
  319. package/src/compiler/parser.ts +156 -39
  320. package/src/compiler/path.ts +22 -2
  321. package/src/compiler/printer/emit-context.ts +21 -0
  322. package/src/compiler/printer/factory-base.ts +10 -3
  323. package/src/compiler/printer/factory.ts +4 -1
  324. package/src/compiler/printer/helpers.ts +10 -1
  325. package/src/compiler/printer/name-generator.ts +24 -2
  326. package/src/compiler/printer/printer.ts +266 -30
  327. package/src/compiler/printer/utilities.ts +8 -2
  328. package/src/compiler/program-checker.ts +57 -5
  329. package/src/compiler/program-utilities.ts +23 -10
  330. package/src/compiler/program.ts +18 -26
  331. package/src/compiler/pseudo-bigint.ts +17 -0
  332. package/src/compiler/regexp-checker.ts +63 -30
  333. package/src/compiler/relations.ts +240 -77
  334. package/src/compiler/reparser.ts +7 -2
  335. package/src/compiler/scanner.ts +109 -79
  336. package/src/compiler/shared-results.ts +2414 -0
  337. package/src/compiler/show-config.ts +18 -1
  338. package/src/compiler/sourcemap.ts +2 -2
  339. package/src/compiler/symbol-accessibility.ts +26 -3
  340. package/src/compiler/symbol.ts +46 -24
  341. package/src/compiler/syntax-kind.ts +188 -187
  342. package/src/compiler/thread-entry.ts +64 -4
  343. package/src/compiler/transformers/alias-references.ts +123 -4
  344. package/src/compiler/transformers/async.ts +2 -17
  345. package/src/compiler/transformers/class-fields.ts +13 -12
  346. package/src/compiler/transformers/commonjs-module.ts +11 -7
  347. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  348. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  349. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  350. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  351. package/src/compiler/transformers/declarations.ts +134 -48
  352. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  353. package/src/compiler/transformers/destructuring.ts +4 -3
  354. package/src/compiler/transformers/external-module-info.ts +1 -1
  355. package/src/compiler/transformers/jsx.ts +2 -1
  356. package/src/compiler/transformers/reference-resolver.ts +83 -19
  357. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  358. package/src/compiler/transformers/syntax-facts.ts +2 -7
  359. package/src/compiler/transformers/type-eraser.ts +10 -1
  360. package/src/compiler/transformers/type-serialization.ts +3 -2
  361. package/src/compiler/transformers/visitor-base.ts +2 -1
  362. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  363. package/src/compiler/tsc-build.ts +66 -9
  364. package/src/compiler/tsc-cli.ts +7 -0
  365. package/src/compiler/tsc-compile.ts +284 -4
  366. package/src/compiler/tsc-watch.ts +74 -45
  367. package/src/compiler/tsconfig.ts +176 -19
  368. package/src/compiler/type-printer.ts +36 -2
  369. package/src/compiler/types.ts +2 -1
  370. package/src/library/ast.generated.ts +57 -41
  371. package/src/library/compiler-options.generated.ts +117 -103
  372. package/src/library/disk.ts +10 -1
  373. package/src/library/enums.generated.ts +196 -196
@@ -2,12 +2,11 @@
2
2
  // overloads and enum values exactly; types from annotations and the isolatedDeclarations
3
3
  // rules (literals, `as const`, annotated function expressions). Types that need inference
4
4
  // are reported to the tracker and written as `any`.
5
- import { AsExpression, BigIntLiteral, ObjectLiteralExpression, BindingElement, BindingPattern, ComputedPropertyName, ElementAccessExpression, ExportDeclaration, ExportSpecifier, ExternalModuleReference, FunctionTypeNode, Identifier, ImportAttribute, ImportAttributes, ImportEqualsDeclaration, KeywordTypeNode, LiteralTypeNode, MethodSignatureDeclaration, ModuleDeclaration, NodeVisitor, NumericLiteral, ParameterDeclaration, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertySignatureDeclaration, QualifiedName, SetAccessorDeclaration, GetAccessorDeclaration, HeritageClause, StringLiteral, NoSubstitutionTemplateLiteral, TemplateMiddle, TemplateTail, TypePredicateNode, TupleTypeNode, TypeLiteralNode, TypeOperatorNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, getAsteriskToken, getBody, getExpression, getInitializer, getMembers, getName, getText, getParameters, getSymbol, getType, } from '../ast.js';
5
+ import { AsExpression, BigIntLiteral, ObjectLiteralExpression, BindingElement, BindingPattern, ComputedPropertyName, ElementAccessExpression, ExportDeclaration, ExportSpecifier, ExternalModuleReference, FunctionTypeNode, Identifier, ImportEqualsDeclaration, KeywordTypeNode, LiteralTypeNode, MethodSignatureDeclaration, ModuleDeclaration, NodeVisitor, NumericLiteral, ParameterDeclaration, PrefixUnaryExpression, PrivateIdentifier, PropertyAccessExpression, PropertySignatureDeclaration, QualifiedName, SetAccessorDeclaration, GetAccessorDeclaration, HeritageClause, StringLiteral, NoSubstitutionTemplateLiteral, TemplateMiddle, TemplateTail, TypePredicateNode, TupleTypeNode, TypeLiteralNode, TypeOperatorNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, getAsteriskToken, getBody, getExpression, getInitializer, getMembers, getName, getParameters, getSymbol, getType, } from '../ast.js';
6
6
  import { isAmbientModule, isFunctionLike, nodeIsPresent } from '../ast-utilities.js';
7
7
  import { getContainerFlags } from '../binder.js';
8
8
  import { getCombinedModifierFlags, getCombinedNodeFlags, getRootDeclaration, getSourceFileOfNode, hasSyntacticModifier, isEntityNameExpression, isExternalOrCommonJSModule, isGlobalSourceFile, isIdentifierNamed, isModuleAugmentationExternal, isParameterPropertyDeclaration, isStringOrNumericLiteralLike, skipParentheses, } from '../binder-utilities.js';
9
9
  import { NameResolver } from '../name-resolver.js';
10
- import { ModuleKind as ModuleKinds } from '../options.js';
11
10
  import { combinePaths, getDirectoryPath, getNormalizedAbsolutePath, normalizePath } from '../path.js';
12
11
  import { isIdentifierText } from '../scanner.js';
13
12
  import { DeclarationEmitResolver, SymbolAccessibilityResult, accessible, } from './declarations-resolver.js';
@@ -125,7 +124,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
125
124
  const meaning = 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */;
126
125
  const parent = node.parent;
127
126
  let symbol = undefined;
128
- if (node.kind !== 10 /* SyntaxKind.StringLiteral */ && parent.kind === 278 /* SyntaxKind.ExportAssignment */)
127
+ if (node.kind !== 10 /* SyntaxKind.StringLiteral */ && parent.kind === 279 /* SyntaxKind.ExportAssignment */)
129
128
  symbol = this.resolveName(node, getIdentifierText(node), meaning);
130
129
  else if (parent instanceof ExportSpecifier) {
131
130
  const declaration = parent.parent.parent;
@@ -163,23 +162,23 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
163
162
  }
164
163
  determineIfDeclarationIsVisible(node) {
165
164
  switch (node.kind) {
166
- case 331 /* SyntaxKind.JSDocCallbackTag */:
167
- case 338 /* SyntaxKind.JSDocTypedefTag */: {
165
+ case 332 /* SyntaxKind.JSDocCallbackTag */:
166
+ case 339 /* SyntaxKind.JSDocTypedefTag */: {
168
167
  // Top-level JSDoc type aliases are exported.
169
168
  const host = node.parent?.parent?.parent;
170
- return host !== undefined && host.kind === 307 /* SyntaxKind.SourceFile */;
169
+ return host !== undefined && host.kind === 308 /* SyntaxKind.SourceFile */;
171
170
  }
172
- case 209 /* SyntaxKind.BindingElement */:
171
+ case 210 /* SyntaxKind.BindingElement */:
173
172
  return this.isDeclarationVisible(node.parent.parent);
174
- case 261 /* SyntaxKind.VariableDeclaration */:
175
- case 268 /* SyntaxKind.ModuleDeclaration */:
176
- case 264 /* SyntaxKind.ClassDeclaration */:
177
- case 265 /* SyntaxKind.InterfaceDeclaration */:
178
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
179
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
180
- case 263 /* SyntaxKind.FunctionDeclaration */:
181
- case 267 /* SyntaxKind.EnumDeclaration */:
182
- case 272 /* SyntaxKind.ImportEqualsDeclaration */: {
173
+ case 262 /* SyntaxKind.VariableDeclaration */:
174
+ case 269 /* SyntaxKind.ModuleDeclaration */:
175
+ case 265 /* SyntaxKind.ClassDeclaration */:
176
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
177
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
178
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
179
+ case 264 /* SyntaxKind.FunctionDeclaration */:
180
+ case 268 /* SyntaxKind.EnumDeclaration */:
181
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */: {
183
182
  if (node instanceof VariableDeclaration &&
184
183
  node.name instanceof BindingPattern &&
185
184
  node.name.elements.nodes.length === 0)
@@ -189,50 +188,50 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
189
188
  const parent = getDeclarationContainer(node);
190
189
  // Unexported declarations are visible only in global files; ambient module members are exported.
191
190
  if ((getCombinedModifierFlags(node) & 32 /* ModifierFlags.Export */) === 0 &&
192
- !(node.kind !== 272 /* SyntaxKind.ImportEqualsDeclaration */ &&
193
- parent.kind !== 307 /* SyntaxKind.SourceFile */ &&
191
+ !(node.kind !== 273 /* SyntaxKind.ImportEqualsDeclaration */ &&
192
+ parent.kind !== 308 /* SyntaxKind.SourceFile */ &&
194
193
  (parent.flags & 8388608 /* NodeFlags.Ambient */) !== 0))
195
194
  return isGlobalSourceFile(parent);
196
195
  return this.isDeclarationVisible(parent);
197
196
  }
198
- case 173 /* SyntaxKind.PropertyDeclaration */:
199
- case 172 /* SyntaxKind.PropertySignature */:
200
- case 178 /* SyntaxKind.GetAccessor */:
201
- case 179 /* SyntaxKind.SetAccessor */:
202
- case 175 /* SyntaxKind.MethodDeclaration */:
203
- case 174 /* SyntaxKind.MethodSignature */:
197
+ case 174 /* SyntaxKind.PropertyDeclaration */:
198
+ case 173 /* SyntaxKind.PropertySignature */:
199
+ case 179 /* SyntaxKind.GetAccessor */:
200
+ case 180 /* SyntaxKind.SetAccessor */:
201
+ case 176 /* SyntaxKind.MethodDeclaration */:
202
+ case 175 /* SyntaxKind.MethodSignature */:
204
203
  if (this.getEffectiveDeclarationFlags(node, 2 /* ModifierFlags.Private */ | 4 /* ModifierFlags.Protected */) !== 0)
205
204
  return false;
206
205
  return this.isDeclarationVisible(node.parent);
207
- case 177 /* SyntaxKind.Constructor */:
208
- case 181 /* SyntaxKind.ConstructSignature */:
209
- case 180 /* SyntaxKind.CallSignature */:
210
- case 182 /* SyntaxKind.IndexSignature */:
211
- case 170 /* SyntaxKind.Parameter */:
212
- case 269 /* SyntaxKind.ModuleBlock */:
213
- case 185 /* SyntaxKind.FunctionType */:
214
- case 186 /* SyntaxKind.ConstructorType */:
215
- case 188 /* SyntaxKind.TypeLiteral */:
216
- case 184 /* SyntaxKind.TypeReference */:
217
- case 189 /* SyntaxKind.ArrayType */:
218
- case 190 /* SyntaxKind.TupleType */:
219
- case 193 /* SyntaxKind.UnionType */:
220
- case 194 /* SyntaxKind.IntersectionType */:
221
- case 197 /* SyntaxKind.ParenthesizedType */:
222
- case 203 /* SyntaxKind.NamedTupleMember */:
206
+ case 178 /* SyntaxKind.Constructor */:
207
+ case 182 /* SyntaxKind.ConstructSignature */:
208
+ case 181 /* SyntaxKind.CallSignature */:
209
+ case 183 /* SyntaxKind.IndexSignature */:
210
+ case 171 /* SyntaxKind.Parameter */:
211
+ case 270 /* SyntaxKind.ModuleBlock */:
212
+ case 186 /* SyntaxKind.FunctionType */:
213
+ case 187 /* SyntaxKind.ConstructorType */:
214
+ case 189 /* SyntaxKind.TypeLiteral */:
215
+ case 185 /* SyntaxKind.TypeReference */:
216
+ case 190 /* SyntaxKind.ArrayType */:
217
+ case 191 /* SyntaxKind.TupleType */:
218
+ case 194 /* SyntaxKind.UnionType */:
219
+ case 195 /* SyntaxKind.IntersectionType */:
220
+ case 198 /* SyntaxKind.ParenthesizedType */:
221
+ case 204 /* SyntaxKind.NamedTupleMember */:
223
222
  return this.isDeclarationVisible(node.parent);
224
223
  // Imports are visible only once something refers to them.
225
- case 274 /* SyntaxKind.ImportClause */:
226
- case 275 /* SyntaxKind.NamespaceImport */:
227
- case 277 /* SyntaxKind.ImportSpecifier */:
224
+ case 275 /* SyntaxKind.ImportClause */:
225
+ case 276 /* SyntaxKind.NamespaceImport */:
226
+ case 278 /* SyntaxKind.ImportSpecifier */:
228
227
  return false;
229
- case 169 /* SyntaxKind.TypeParameter */:
230
- case 307 /* SyntaxKind.SourceFile */:
231
- case 271 /* SyntaxKind.NamespaceExportDeclaration */:
228
+ case 170 /* SyntaxKind.TypeParameter */:
229
+ case 308 /* SyntaxKind.SourceFile */:
230
+ case 272 /* SyntaxKind.NamespaceExportDeclaration */:
232
231
  return true;
233
- case 278 /* SyntaxKind.ExportAssignment */:
232
+ case 279 /* SyntaxKind.ExportAssignment */:
234
233
  return false;
235
- case 282 /* SyntaxKind.ExportSpecifier */: {
234
+ case 283 /* SyntaxKind.ExportSpecifier */: {
236
235
  const declaration = node.parent.parent;
237
236
  if (declaration instanceof ExportDeclaration && declaration.moduleSpecifier === undefined)
238
237
  return this.isDeclarationVisible(declaration.parent);
@@ -281,7 +280,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
281
280
  this.isDeclarationVisible(anyImport.parent))
282
281
  statement = anyImport;
283
282
  else if (declaration instanceof VariableDeclaration &&
284
- declaration.parent.parent.kind === 244 /* SyntaxKind.VariableStatement */ &&
283
+ declaration.parent.parent.kind === 245 /* SyntaxKind.VariableStatement */ &&
285
284
  !hasSyntacticModifier(declaration.parent.parent, 32 /* ModifierFlags.Export */) &&
286
285
  this.isDeclarationVisible(declaration.parent.parent.parent))
287
286
  statement = declaration.parent.parent;
@@ -291,10 +290,10 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
291
290
  statement = declaration;
292
291
  else if (declaration instanceof BindingElement && (symbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) !== 0) {
293
292
  const root = getRootDeclaration(declaration);
294
- if (root.kind === 170 /* SyntaxKind.Parameter */)
293
+ if (root.kind === 171 /* SyntaxKind.Parameter */)
295
294
  return undefined;
296
295
  const variableStatement = root.parent?.parent;
297
- if (variableStatement === undefined || variableStatement.kind !== 244 /* SyntaxKind.VariableStatement */)
296
+ if (variableStatement === undefined || variableStatement.kind !== 245 /* SyntaxKind.VariableStatement */)
298
297
  return undefined;
299
298
  // Already exported: nothing to keep.
300
299
  if (hasSyntacticModifier(variableStatement, 32 /* ModifierFlags.Export */))
@@ -326,15 +325,15 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
326
325
  const parent = node.parent;
327
326
  // Class and interface members are never implicitly exported or ambient.
328
327
  if (parent !== undefined &&
329
- parent.kind !== 265 /* SyntaxKind.InterfaceDeclaration */ &&
330
- parent.kind !== 264 /* SyntaxKind.ClassDeclaration */ &&
331
- parent.kind !== 232 /* SyntaxKind.ClassExpression */ &&
328
+ parent.kind !== 266 /* SyntaxKind.InterfaceDeclaration */ &&
329
+ parent.kind !== 265 /* SyntaxKind.ClassDeclaration */ &&
330
+ parent.kind !== 233 /* SyntaxKind.ClassExpression */ &&
332
331
  (node.flags & 8388608 /* NodeFlags.Ambient */) !== 0) {
333
332
  const container = getEnclosingContainer(node);
334
333
  if (container !== undefined &&
335
334
  (container.flags & 64 /* NodeFlags.ExportContext */) !== 0 &&
336
335
  (result & 128 /* ModifierFlags.Ambient */) === 0 &&
337
- !(parent.kind === 269 /* SyntaxKind.ModuleBlock */ && isGlobalScopeAugmentation(parent.parent)))
336
+ !(parent.kind === 270 /* SyntaxKind.ModuleBlock */ && isGlobalScopeAugmentation(parent.parent)))
338
337
  result |= 32 /* ModifierFlags.Export */;
339
338
  result |= 128 /* ModifierFlags.Ambient */;
340
339
  }
@@ -343,7 +342,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
343
342
  isImplementationOfOverload(node) {
344
343
  if ((node.flags & 16 /* NodeFlags.Synthesized */) !== 0 || !nodeIsPresent(getBody(node)))
345
344
  return false;
346
- if (node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */)
345
+ if (node.kind === 179 /* SyntaxKind.GetAccessor */ || node.kind === 180 /* SyntaxKind.SetAccessor */)
347
346
  return false;
348
347
  const symbol = this.getSymbolOfDeclaration(node);
349
348
  if (symbol === undefined)
@@ -394,7 +393,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
394
393
  return undefined;
395
394
  const name = node.name.text;
396
395
  const left = node.expression;
397
- if (left.kind === 79 /* SyntaxKind.Identifier */ || left.kind === 212 /* SyntaxKind.PropertyAccessExpression */) {
396
+ if (left.kind === 79 /* SyntaxKind.Identifier */ || left.kind === 213 /* SyntaxKind.PropertyAccessExpression */) {
398
397
  const symbol = this.resolveEntityNameExpression(left, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */);
399
398
  if (symbol !== undefined && (symbol.flags & 2097152 /* SymbolFlags.Alias */) === 0) {
400
399
  const member = (symbol.exports ?? emptyTable).get(name);
@@ -489,14 +488,14 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
489
488
  case 132 /* SyntaxKind.AnyKeyword */:
490
489
  case 159 /* SyntaxKind.UnknownKeyword */:
491
490
  return true;
492
- case 197 /* SyntaxKind.ParenthesizedType */:
491
+ case 198 /* SyntaxKind.ParenthesizedType */:
493
492
  return this.typeContainsUndefined(getType(type), location);
494
- case 193 /* SyntaxKind.UnionType */:
493
+ case 194 /* SyntaxKind.UnionType */:
495
494
  for (const member of typesOf(type))
496
495
  if (this.typeContainsUndefined(member, location))
497
496
  return true;
498
497
  return false;
499
- case 184 /* SyntaxKind.TypeReference */: {
498
+ case 185 /* SyntaxKind.TypeReference */: {
500
499
  // An unresolved name or import is an error type, which counts as containing `undefined`.
501
500
  const symbol = this.resolveName(location, getIdentifierText(getFirstIdentifier(type.typeName)), 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */);
502
501
  return symbol === undefined || (symbol.flags & 2097152 /* SymbolFlags.Alias */) !== 0;
@@ -513,7 +512,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
513
512
  // Properties assigned to a function-valued variable are bound to the function.
514
513
  if (node instanceof VariableDeclaration)
515
514
  host = node.initializer;
516
- else if (node.kind !== 263 /* SyntaxKind.FunctionDeclaration */)
515
+ else if (node.kind !== 264 /* SyntaxKind.FunctionDeclaration */)
517
516
  host = undefined;
518
517
  if (host === undefined || !isFunctionLike(host))
519
518
  return result;
@@ -556,27 +555,6 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
556
555
  getTypeReferenceSerializationKind(typeName, location) {
557
556
  return this.emitResolver.getTypeReferenceSerializationKind(typeName, location);
558
557
  }
559
- getResolutionModeOverride(node) {
560
- if (!(node instanceof ImportAttributes))
561
- return undefined;
562
- for (const element of node.attributes.nodes) {
563
- if (!(element instanceof ImportAttribute))
564
- continue;
565
- const name = element.name;
566
- if (name === undefined || (name.kind !== 10 /* SyntaxKind.StringLiteral */ && name.kind !== 79 /* SyntaxKind.Identifier */))
567
- continue;
568
- if (getText(name) !== 'resolution-mode')
569
- continue;
570
- const value = element.value;
571
- if (!(value instanceof StringLiteral))
572
- return undefined;
573
- if (value.text === 'import')
574
- return ModuleKinds.ESNext;
575
- if (value.text === 'require')
576
- return ModuleKinds.CommonJS;
577
- }
578
- return undefined;
579
- }
580
558
  getSourceFileFromReference(file, reference) {
581
559
  const path = normalizePath(combinePaths(getDirectoryPath(file.fileName), reference.fileName));
582
560
  for (const candidate of [path, path + '.ts', path + '.tsx', path + '.d.ts']) {
@@ -605,10 +583,10 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
605
583
  if ((declaration.flags & 16 /* NodeFlags.Synthesized */) !== 0)
606
584
  return undefined;
607
585
  const writer = new PseudoTypeWriter(this, context, tracker, enclosingDeclaration, flags);
608
- const isAccessor = declaration.kind === 178 /* SyntaxKind.GetAccessor */ || declaration.kind === 179 /* SyntaxKind.SetAccessor */;
586
+ const isAccessor = declaration.kind === 179 /* SyntaxKind.GetAccessor */ || declaration.kind === 180 /* SyntaxKind.SetAccessor */;
609
587
  this.pseudo.uncertain = 0;
610
588
  let type = isAccessor ? this.pseudo.getTypeOfAccessor(declaration) : this.pseudo.getTypeOfDeclaration(declaration);
611
- if (declaration.kind === 170 /* SyntaxKind.Parameter */ &&
589
+ if (declaration.kind === 171 /* SyntaxKind.Parameter */ &&
612
590
  this.requiresAddingImplicitUndefined(declaration, enclosingDeclaration) &&
613
591
  !this.pseudoContainsUndefined(type))
614
592
  type = new UnionType([type, undefinedType]);
@@ -631,7 +609,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
631
609
  return false;
632
610
  }
633
611
  if (type instanceof DirectType)
634
- return couldAlreadyReferToUndefined(type) && type.typeNode.kind !== 184 /* SyntaxKind.TypeReference */;
612
+ return couldAlreadyReferToUndefined(type) && type.typeNode.kind !== 185 /* SyntaxKind.TypeReference */;
635
613
  return type.kind === 5 /* PseudoTypeKind.Undefined */;
636
614
  }
637
615
  createReturnTypeOfSignatureDeclaration(context, signature, enclosingDeclaration, flags, tracker) {
@@ -647,7 +625,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
647
625
  return context.factory.created(new KeywordTypeNode(115 /* SyntaxKind.VoidKeyword */));
648
626
  }
649
627
  }
650
- if (type instanceof NoResultType && getBody(signature) === undefined && signature.kind !== 178 /* SyntaxKind.GetAccessor */) {
628
+ if (type instanceof NoResultType && getBody(signature) === undefined && signature.kind !== 179 /* SyntaxKind.GetAccessor */) {
651
629
  // A signature without a body or annotation returns `any`.
652
630
  writer.reportFallback(type, false);
653
631
  return undefined;
@@ -659,7 +637,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
659
637
  return undefined;
660
638
  }
661
639
  createLiteralConstValue(context, node, _tracker) {
662
- const initializer = node.kind === 278 /* SyntaxKind.ExportAssignment */ ? getExpression(node) : getInitializer(node);
640
+ const initializer = node.kind === 279 /* SyntaxKind.ExportAssignment */ ? getExpression(node) : getInitializer(node);
663
641
  if (initializer === undefined)
664
642
  return undefined;
665
643
  const literal = literalOf(skipParentheses(initializer));
@@ -679,7 +657,7 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
679
657
  return factory.created(new BigIntLiteral(literal.text, 0 /* TokenFlags.None */));
680
658
  case 8 /* SyntaxKind.NumericLiteral */:
681
659
  return createNumberExpression(context, Number(literal.text));
682
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
660
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
683
661
  const unary = literal;
684
662
  const operand = unary.operand;
685
663
  if (operand instanceof BigIntLiteral)
@@ -711,9 +689,9 @@ export class SyntacticDeclarationEmitResolver extends DeclarationEmitResolver {
711
689
  if (this.isLateBindableExpression(name.expression))
712
690
  continue;
713
691
  this.countFallback(member, true);
714
- if (isFunctionLike(member) && getType(member) === undefined && member.kind !== 179 /* SyntaxKind.SetAccessor */)
692
+ if (isFunctionLike(member) && getType(member) === undefined && member.kind !== 180 /* SyntaxKind.SetAccessor */)
715
693
  writer.write(this.pseudo.getReturnTypeOfSignature(member));
716
- else if (member.kind === 173 /* SyntaxKind.PropertyDeclaration */ && getType(member) === undefined)
694
+ else if (member.kind === 174 /* SyntaxKind.PropertyDeclaration */ && getType(member) === undefined)
717
695
  writer.write(this.pseudo.getTypeOfDeclaration(member));
718
696
  }
719
697
  return [];
@@ -940,7 +918,7 @@ class PseudoTypeWriter {
940
918
  return undefined;
941
919
  const result = factory.created(new ParameterDeclaration(undefined, parameter.rest ? factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined, this.cloneParameterName(parameter.name), parameter.optional ? factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, type, undefined));
942
920
  const original = parameter.name.parent;
943
- if (original !== undefined && original.kind === 170 /* SyntaxKind.Parameter */)
921
+ if (original !== undefined && original.kind === 171 /* SyntaxKind.Parameter */)
944
922
  this.context.assignCommentRange(result, original);
945
923
  return result;
946
924
  }
@@ -1094,7 +1072,7 @@ class PseudoTypeWriter {
1094
1072
  }
1095
1073
  /** JSDoc types such as `?T` can't be reused as written. */
1096
1074
  markJSDocType(node) {
1097
- if (node.kind >= 308 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 343 /* SyntaxKind.LastJSDocNode */)
1075
+ if (node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 344 /* SyntaxKind.LastJSDocNode */)
1098
1076
  this.reuseFailed = true;
1099
1077
  return true;
1100
1078
  }
@@ -1104,7 +1082,7 @@ class PseudoTypeWriter {
1104
1082
  name = node.typeName;
1105
1083
  else if (node instanceof TypeQueryNode)
1106
1084
  name = node.exprName;
1107
- else if (node.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */)
1085
+ else if (node.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */)
1108
1086
  name = node.expression;
1109
1087
  if (name === undefined || !(isEntityNameExpression(name, false) || name instanceof QualifiedName))
1110
1088
  return false;
@@ -1137,7 +1115,7 @@ class PseudoTypeWriter {
1137
1115
  function isSignatureLocal(symbol) {
1138
1116
  const declaration = symbol.valueDeclaration ?? (declarationCount(symbol) > 0 ? symbol.declaration : undefined);
1139
1117
  return (declaration !== undefined &&
1140
- (declaration.kind === 170 /* SyntaxKind.Parameter */ || declaration.kind === 169 /* SyntaxKind.TypeParameter */));
1118
+ (declaration.kind === 171 /* SyntaxKind.Parameter */ || declaration.kind === 170 /* SyntaxKind.TypeParameter */));
1141
1119
  }
1142
1120
  class EntityNameTracker extends NodeVisitor {
1143
1121
  writer;
@@ -1154,7 +1132,7 @@ class EntityNameTracker extends NodeVisitor {
1154
1132
  /** Single-line tuples and mapped types, and string literals without escapes, as tsgo's node reuse. */
1155
1133
  function styleReusedNodes(context, node) {
1156
1134
  const kind = node.kind;
1157
- if (kind === 190 /* SyntaxKind.TupleType */ || kind === 201 /* SyntaxKind.MappedType */)
1135
+ if (kind === 191 /* SyntaxKind.TupleType */ || kind === 202 /* SyntaxKind.MappedType */)
1158
1136
  context.addEmitFlags(node, 1 /* EmitFlags.SingleLine */);
1159
1137
  else if (kind === 10 /* SyntaxKind.StringLiteral */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */)
1160
1138
  context.addEmitFlags(node, 131072 /* EmitFlags.NoAsciiEscaping */);
@@ -1224,7 +1202,7 @@ export function tryGetTextOfPropertyName(name) {
1224
1202
  case 8 /* SyntaxKind.NumericLiteral */:
1225
1203
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
1226
1204
  return literalText(name);
1227
- case 168 /* SyntaxKind.ComputedPropertyName */: {
1205
+ case 169 /* SyntaxKind.ComputedPropertyName */: {
1228
1206
  const expression = name.expression;
1229
1207
  return isStringOrNumericLiteralLike(expression) ? literalText(expression) : undefined;
1230
1208
  }
@@ -1233,12 +1211,12 @@ export function tryGetTextOfPropertyName(name) {
1233
1211
  }
1234
1212
  /** Whether a declaration's type is a literal or `unique symbol`: a computed name it names is late-bound. */
1235
1213
  function hasLiteralOrUniqueSymbolType(declaration) {
1236
- if (declaration.kind === 306 /* SyntaxKind.EnumMember */)
1214
+ if (declaration.kind === 307 /* SyntaxKind.EnumMember */)
1237
1215
  return true;
1238
1216
  const type = getType(declaration);
1239
1217
  if (type !== undefined)
1240
1218
  return ((type instanceof TypeOperatorNode && type.operator === 158 /* SyntaxKind.UniqueKeyword */) ||
1241
- type.kind === 202 /* SyntaxKind.LiteralType */);
1219
+ type.kind === 203 /* SyntaxKind.LiteralType */);
1242
1220
  const initializer = getInitializer(declaration);
1243
1221
  if (initializer === undefined)
1244
1222
  return false;
@@ -1250,13 +1228,13 @@ function hasLiteralOrUniqueSymbolType(declaration) {
1250
1228
  if ((getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */) === 0)
1251
1229
  return false;
1252
1230
  // `const sym = Symbol()` is a unique symbol.
1253
- if (value.kind === 214 /* SyntaxKind.CallExpression */ && isIdentifierNamed(getExpression(value), 'Symbol'))
1231
+ if (value.kind === 215 /* SyntaxKind.CallExpression */ && isIdentifierNamed(getExpression(value), 'Symbol'))
1254
1232
  return true;
1255
1233
  return isStringOrNumericLiteralLike(value);
1256
1234
  }
1257
- if (declaration.kind === 173 /* SyntaxKind.PropertyDeclaration */)
1235
+ if (declaration.kind === 174 /* SyntaxKind.PropertyDeclaration */)
1258
1236
  return hasSyntacticModifier(declaration, 8 /* ModifierFlags.Readonly */) && isStringOrNumericLiteralLike(value);
1259
- if (declaration.kind === 303 /* SyntaxKind.PropertyAssignment */)
1237
+ if (declaration.kind === 304 /* SyntaxKind.PropertyAssignment */)
1260
1238
  return isInConstContext(value) && isStringOrNumericLiteralLike(value);
1261
1239
  return false;
1262
1240
  }
@@ -1270,7 +1248,7 @@ function objectLiteralProperties(node) {
1270
1248
  /** Whether a function's body returns no values, so its inferred return type is `void`. */
1271
1249
  function isTriviallyVoid(fn) {
1272
1250
  const body = getBody(fn);
1273
- if (body === undefined || body.kind !== 242 /* SyntaxKind.Block */)
1251
+ if (body === undefined || body.kind !== 243 /* SyntaxKind.Block */)
1274
1252
  return false;
1275
1253
  if (hasSyntacticModifier(fn, 1024 /* ModifierFlags.Async */) || getAsteriskToken(fn) !== undefined)
1276
1254
  return false;
@@ -1278,11 +1256,11 @@ function isTriviallyVoid(fn) {
1278
1256
  if (statement.expression !== undefined)
1279
1257
  return false;
1280
1258
  switch (fn.kind) {
1281
- case 263 /* SyntaxKind.FunctionDeclaration */:
1282
- case 175 /* SyntaxKind.MethodDeclaration */:
1259
+ case 264 /* SyntaxKind.FunctionDeclaration */:
1260
+ case 176 /* SyntaxKind.MethodDeclaration */:
1283
1261
  return true;
1284
- case 219 /* SyntaxKind.FunctionExpression */:
1285
- case 220 /* SyntaxKind.ArrowFunction */:
1262
+ case 220 /* SyntaxKind.FunctionExpression */:
1263
+ case 221 /* SyntaxKind.ArrowFunction */:
1286
1264
  // Without an implicit return, function expressions return `never`.
1287
1265
  return (fn.flags & 256 /* NodeFlags.HasImplicitReturn */) !== 0;
1288
1266
  }
@@ -1310,7 +1288,7 @@ function literalOf(node) {
1310
1288
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
1311
1289
  case 9 /* SyntaxKind.BigIntLiteral */:
1312
1290
  return node;
1313
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
1291
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
1314
1292
  const unary = node;
1315
1293
  const operand = unary.operand.kind;
1316
1294
  if (unary.operator === 40 /* SyntaxKind.MinusToken */ &&
@@ -1359,15 +1337,15 @@ function getFirstIdentifier(node) {
1359
1337
  /** What a reference to an entity name means: a value, a namespace or a type. */
1360
1338
  export function getMeaningOfEntityNameReference(entityName) {
1361
1339
  const parent = entityName.parent;
1362
- if (parent.kind === 187 /* SyntaxKind.TypeQuery */ ||
1363
- (parent.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */ && !isPartOfTypeNode(parent)) ||
1364
- parent.kind === 168 /* SyntaxKind.ComputedPropertyName */ ||
1365
- (parent.kind === 183 /* SyntaxKind.TypePredicate */ && getTypePredicateParameterName(parent) === entityName) ||
1366
- parent.kind === 227 /* SyntaxKind.BinaryExpression */)
1340
+ if (parent.kind === 188 /* SyntaxKind.TypeQuery */ ||
1341
+ (parent.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */ && !isPartOfTypeNode(parent)) ||
1342
+ parent.kind === 169 /* SyntaxKind.ComputedPropertyName */ ||
1343
+ (parent.kind === 184 /* SyntaxKind.TypePredicate */ && getTypePredicateParameterName(parent) === entityName) ||
1344
+ parent.kind === 228 /* SyntaxKind.BinaryExpression */)
1367
1345
  return 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */;
1368
- if (entityName.kind === 167 /* SyntaxKind.QualifiedName */ ||
1369
- entityName.kind === 212 /* SyntaxKind.PropertyAccessExpression */ ||
1370
- parent.kind === 272 /* SyntaxKind.ImportEqualsDeclaration */ ||
1346
+ if (entityName.kind === 168 /* SyntaxKind.QualifiedName */ ||
1347
+ entityName.kind === 213 /* SyntaxKind.PropertyAccessExpression */ ||
1348
+ parent.kind === 273 /* SyntaxKind.ImportEqualsDeclaration */ ||
1371
1349
  (parent instanceof QualifiedName && parent.left === entityName) ||
1372
1350
  (parent instanceof PropertyAccessExpression && parent.expression === entityName) ||
1373
1351
  (parent instanceof ElementAccessExpression && parent.expression === entityName))
@@ -1383,52 +1361,52 @@ function isPartOfTypeNode(node) {
1383
1361
  if (parent === undefined)
1384
1362
  return false;
1385
1363
  if (parent instanceof HeritageClause)
1386
- return (!(parent.parent.kind === 264 /* SyntaxKind.ClassDeclaration */ || parent.parent.kind === 232 /* SyntaxKind.ClassExpression */) ||
1364
+ return (!(parent.parent.kind === 265 /* SyntaxKind.ClassDeclaration */ || parent.parent.kind === 233 /* SyntaxKind.ClassExpression */) ||
1387
1365
  parent.token === 118 /* SyntaxKind.ImplementsKeyword */);
1388
1366
  return (parent !== undefined &&
1389
- (parent.kind === 324 /* SyntaxKind.JSDocImplementsTag */ || parent.kind === 323 /* SyntaxKind.JSDocAugmentsTag */));
1367
+ (parent.kind === 325 /* SyntaxKind.JSDocImplementsTag */ || parent.kind === 324 /* SyntaxKind.JSDocAugmentsTag */));
1390
1368
  }
1391
1369
  function isDeclarationKind(kind) {
1392
1370
  switch (kind) {
1393
- case 261 /* SyntaxKind.VariableDeclaration */:
1394
- case 170 /* SyntaxKind.Parameter */:
1395
- case 173 /* SyntaxKind.PropertyDeclaration */:
1396
- case 172 /* SyntaxKind.PropertySignature */:
1397
- case 303 /* SyntaxKind.PropertyAssignment */:
1398
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
1399
- case 209 /* SyntaxKind.BindingElement */:
1400
- case 278 /* SyntaxKind.ExportAssignment */:
1401
- case 306 /* SyntaxKind.EnumMember */:
1371
+ case 262 /* SyntaxKind.VariableDeclaration */:
1372
+ case 171 /* SyntaxKind.Parameter */:
1373
+ case 174 /* SyntaxKind.PropertyDeclaration */:
1374
+ case 173 /* SyntaxKind.PropertySignature */:
1375
+ case 304 /* SyntaxKind.PropertyAssignment */:
1376
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
1377
+ case 210 /* SyntaxKind.BindingElement */:
1378
+ case 279 /* SyntaxKind.ExportAssignment */:
1379
+ case 307 /* SyntaxKind.EnumMember */:
1402
1380
  return true;
1403
1381
  }
1404
1382
  return false;
1405
1383
  }
1406
1384
  export function getAnyImportSyntax(node) {
1407
1385
  switch (node.kind) {
1408
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
1386
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
1409
1387
  return node;
1410
- case 274 /* SyntaxKind.ImportClause */:
1388
+ case 275 /* SyntaxKind.ImportClause */:
1411
1389
  return node.parent;
1412
- case 275 /* SyntaxKind.NamespaceImport */:
1390
+ case 276 /* SyntaxKind.NamespaceImport */:
1413
1391
  return node.parent?.parent;
1414
- case 277 /* SyntaxKind.ImportSpecifier */:
1392
+ case 278 /* SyntaxKind.ImportSpecifier */:
1415
1393
  return node.parent?.parent?.parent;
1416
1394
  }
1417
1395
  return undefined;
1418
1396
  }
1419
1397
  export function isLateVisibilityPaintedStatement(node) {
1420
1398
  switch (node.kind) {
1421
- case 273 /* SyntaxKind.ImportDeclaration */:
1422
- case 346 /* SyntaxKind.JSImportDeclaration */:
1423
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
1424
- case 244 /* SyntaxKind.VariableStatement */:
1425
- case 264 /* SyntaxKind.ClassDeclaration */:
1426
- case 263 /* SyntaxKind.FunctionDeclaration */:
1427
- case 268 /* SyntaxKind.ModuleDeclaration */:
1428
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
1429
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
1430
- case 265 /* SyntaxKind.InterfaceDeclaration */:
1431
- case 267 /* SyntaxKind.EnumDeclaration */:
1399
+ case 274 /* SyntaxKind.ImportDeclaration */:
1400
+ case 347 /* SyntaxKind.JSImportDeclaration */:
1401
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
1402
+ case 245 /* SyntaxKind.VariableStatement */:
1403
+ case 265 /* SyntaxKind.ClassDeclaration */:
1404
+ case 264 /* SyntaxKind.FunctionDeclaration */:
1405
+ case 269 /* SyntaxKind.ModuleDeclaration */:
1406
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
1407
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
1408
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
1409
+ case 268 /* SyntaxKind.EnumDeclaration */:
1432
1410
  return true;
1433
1411
  }
1434
1412
  return false;
@@ -1438,12 +1416,12 @@ export function getDeclarationContainer(node) {
1438
1416
  let current = getRootDeclaration(node);
1439
1417
  while (current !== undefined) {
1440
1418
  switch (current.kind) {
1441
- case 261 /* SyntaxKind.VariableDeclaration */:
1442
- case 262 /* SyntaxKind.VariableDeclarationList */:
1443
- case 277 /* SyntaxKind.ImportSpecifier */:
1444
- case 276 /* SyntaxKind.NamedImports */:
1445
- case 275 /* SyntaxKind.NamespaceImport */:
1446
- case 274 /* SyntaxKind.ImportClause */:
1419
+ case 262 /* SyntaxKind.VariableDeclaration */:
1420
+ case 263 /* SyntaxKind.VariableDeclarationList */:
1421
+ case 278 /* SyntaxKind.ImportSpecifier */:
1422
+ case 277 /* SyntaxKind.NamedImports */:
1423
+ case 276 /* SyntaxKind.NamespaceImport */:
1424
+ case 275 /* SyntaxKind.ImportClause */:
1447
1425
  current = current.parent;
1448
1426
  continue;
1449
1427
  }
@@ -1465,13 +1443,13 @@ export function isExternalModuleAugmentation(node) {
1465
1443
  }
1466
1444
  function isImplicitlyExportedJSDocDeclaration(node) {
1467
1445
  const parent = node.parent;
1468
- if (parent === undefined || parent.kind !== 307 /* SyntaxKind.SourceFile */)
1446
+ if (parent === undefined || parent.kind !== 308 /* SyntaxKind.SourceFile */)
1469
1447
  return false;
1470
1448
  if (!isExternalOrCommonJSModule(parent))
1471
1449
  return false;
1472
- if (node.kind === 345 /* SyntaxKind.JSTypeAliasDeclaration */)
1450
+ if (node.kind === 346 /* SyntaxKind.JSTypeAliasDeclaration */)
1473
1451
  return true;
1474
- return node.kind === 268 /* SyntaxKind.ModuleDeclaration */ && (node.flags & 8 /* NodeFlags.Reparsed */) !== 0;
1452
+ return node.kind === 269 /* SyntaxKind.ModuleDeclaration */ && (node.flags & 8 /* NodeFlags.Reparsed */) !== 0;
1475
1453
  }
1476
1454
  /** Merges global symbol tables as the checker does; conflicting declarations stay apart. */
1477
1455
  function mergeInto(target, source, mergedSymbols) {
@@ -1560,21 +1538,21 @@ class AliasMarker extends NodeVisitor {
1560
1538
  }
1561
1539
  visitNode(node) {
1562
1540
  switch (node.kind) {
1563
- case 278 /* SyntaxKind.ExportAssignment */: {
1541
+ case 279 /* SyntaxKind.ExportAssignment */: {
1564
1542
  const expression = getExpression(node);
1565
1543
  if (expression instanceof Identifier)
1566
1544
  this.resolver.markLinkedAliases(expression);
1567
1545
  return false;
1568
1546
  }
1569
- case 282 /* SyntaxKind.ExportSpecifier */:
1547
+ case 283 /* SyntaxKind.ExportSpecifier */:
1570
1548
  if (node instanceof ExportSpecifier)
1571
1549
  this.resolver.markLinkedAliases(node.propertyName ?? node.name);
1572
1550
  return false;
1573
1551
  // Exports are statements of files and namespaces.
1574
- case 268 /* SyntaxKind.ModuleDeclaration */:
1575
- case 269 /* SyntaxKind.ModuleBlock */:
1576
- case 279 /* SyntaxKind.ExportDeclaration */:
1577
- case 280 /* SyntaxKind.NamedExports */:
1552
+ case 269 /* SyntaxKind.ModuleDeclaration */:
1553
+ case 270 /* SyntaxKind.ModuleBlock */:
1554
+ case 280 /* SyntaxKind.ExportDeclaration */:
1555
+ case 281 /* SyntaxKind.NamedExports */:
1578
1556
  return node.forEachChild(this);
1579
1557
  }
1580
1558
  return false;