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
@@ -17,12 +17,13 @@ import { getInferredTypeParameterConstraint } from './checker-inference.js';
17
17
  import { getGlobalIterableIteratorType, getGlobalIterableType, isReferenceToType } from './checker-iteration.js';
18
18
  import { getDeclarationModifierFlagsFromSymbol, getPropertiesOfObjectType, getReducedType, getSignaturesOfType, getTargetSymbol, membersHolder, resolveStructuredTypeMembers, } from './checker-members.js';
19
19
  import { getOrCreateTypeFromSignature, getReturnTypeOfSignature, getSignatureFromDeclaration, getTypeParametersFromDeclaration, getTypePredicateOfSignature, instantiateTypePredicate, } from './checker-signatures.js';
20
- import { getBaseTypeVariableOfClass, getNonMissingTypeOfSymbol, getOptionalType, getTypeOfSymbol, getWriteTypeOfSymbol, isReadonlySymbol, removeMissingType, } from './checker-symbol-types.js';
20
+ import { getBaseTypeVariableOfClass, getNonMissingTypeOfSymbol, getOptionalType, getTypeForVariableLikeDeclaration, getTypeOfSymbol, getWriteTypeOfSymbol, isReadonlySymbol, removeMissingType, } from './checker-symbol-types.js';
21
+ import { isVariableLike } from './checker-declarations.js';
21
22
  import { getFirstIdentifier, getGlobalTypeAliasSymbol, getMergedSymbol, getParentOfSymbol, getSymbolOfDeclaration, resolveName, } from './checker-symbols.js';
22
- import { createArrayType, filterType, getIntersectionType, getTypeArguments, getTypeReferenceArity, getWidenedLiteralType, isErrorType, isTupleType, inDeclarationOrder, newAnonymousType, } from './checker-type-factory.js';
23
+ import { createArrayType, createTypeReference, filterType, getIntersectionType, getTypeArguments, getTypeReferenceArity, getWidenedLiteralType, isArrayOrTupleType, isErrorType, isTupleType, inDeclarationOrder, newAnonymousType, typeListKey, } from './checker-type-factory.js';
23
24
  import { getTypeFromTypeNode } from './checker-type-nodes.js';
24
25
  import { getConstraintTypeFromMappedType, getFalseTypeFromConditionalType, getHomomorphicTypeVariable, getMappedTypeModifiers, getModifiersTypeFromMappedType, getNameTypeFromMappedType, getTemplateTypeFromMappedType, getTrueTypeFromConditionalType, getTypeParameterFromMappedType, isGenericMappedType, isMappedTypeWithKeyofConstraintDeclaration, isNoInferType, } from './checker-type-operators.js';
25
- import { newTypeMapper, prependTypeMapping, } from './checker-types.js';
26
+ import { newTypeMapper, prependTypeMapping, getNonDistributedTypeParameter, } from './checker-types.js';
26
27
  import { hasLateBindableIndexSignature, hasLateBindableName, isLateBindableName, isLateBoundName, } from './checker-utilities.js';
27
28
  import { instantiateSignature, instantiateType } from './instantiation.js';
28
29
  import { EmitContext } from './printer/emit-context.js';
@@ -53,6 +54,18 @@ export class TrackedSymbol {
53
54
  this.meaning = meaning;
54
55
  }
55
56
  }
57
+ /**
58
+ * The caches of tsgo's node builder that outlive one request: an emit resolver keeps one node builder, so the types
59
+ * serialized for one declaration are reused, as copies without positions, by the next ones in the file.
60
+ */
61
+ export class NodeBuilderCaches {
62
+ serializedTypes;
63
+ fakeScopes;
64
+ constructor() {
65
+ this.serializedTypes = new Map();
66
+ this.fakeScopes = new Map();
67
+ }
68
+ }
56
69
  class SerializedTypeEntry {
57
70
  node;
58
71
  truncating;
@@ -201,6 +214,8 @@ export class NodeBuilder {
201
214
  pseudo = undefined;
202
215
  /** Set for declaration emit, which writes unions in an order that doesn't depend on the checker's history. */
203
216
  declarationOrder = false;
217
+ /** When set, the symbol each identifier naming a symbol refers to. */
218
+ idToSymbol = undefined;
204
219
  constructor(c, enclosingDeclaration, flags, internalFlags, tracker, context = undefined) {
205
220
  this.c = c;
206
221
  this.context = context ?? new EmitContext();
@@ -249,6 +264,11 @@ export class NodeBuilder {
249
264
  get fakeScopes() {
250
265
  return (this.fakeScopesStore ??= new Map());
251
266
  }
267
+ /** Uses `caches` for the types this builder serializes and its fake scopes, sharing them with other builders. */
268
+ useCaches(caches) {
269
+ this.serializedTypesStore = caches.serializedTypes;
270
+ this.fakeScopesStore = caches.fakeScopes;
271
+ }
252
272
  /** `result`, or undefined if serialization failed. */
253
273
  finish(result) {
254
274
  if (this.truncating && (this.flags & 1 /* NodeBuilderFlags.NoTruncation */) !== 0)
@@ -290,6 +310,12 @@ export class NodeBuilder {
290
310
  identifier(text) {
291
311
  return this.factory.createIdentifier(text);
292
312
  }
313
+ /** An identifier naming `symbol`, recorded in `idToSymbol`. */
314
+ symbolIdentifier(text, symbol) {
315
+ const identifier = this.factory.createIdentifier(text);
316
+ this.idToSymbol?.set(identifier, symbol);
317
+ return identifier;
318
+ }
293
319
  stringLiteral(text, isSingleQuote) {
294
320
  const flags = isSingleQuote || (this.flags & 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */) !== 0
295
321
  ? 65536 /* TokenFlags.SingleQuote */
@@ -390,7 +416,7 @@ export class NodeBuilder {
390
416
  /** Adds the names bound by a destructured parameter; false if `param` isn't one. */
391
417
  addBindingPatternParameters(param, table) {
392
418
  for (const d of getDeclarations(param)) {
393
- if (d.kind !== 170 /* SyntaxKind.Parameter */)
419
+ if (d.kind !== 171 /* SyntaxKind.Parameter */)
394
420
  continue;
395
421
  const name = asBindingPattern(getName(d));
396
422
  if (name !== undefined) {
@@ -555,7 +581,8 @@ export class NodeBuilder {
555
581
  this.approximateLength += 3;
556
582
  return this.keyword(132 /* SyntaxKind.AnyKeyword */);
557
583
  }
558
- let t = type;
584
+ // A distributed type parameter prints as the type parameter it was made from.
585
+ let t = getNonDistributedTypeParameter(type);
559
586
  if ((this.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */) === 0)
560
587
  t = getReducedType(c, t);
561
588
  const flags = t.flags;
@@ -691,7 +718,8 @@ export class NodeBuilder {
691
718
  }
692
719
  const objectFlags = t.objectFlags;
693
720
  if ((objectFlags & 4 /* ObjectFlags.Reference */) !== 0) {
694
- if (t.node !== undefined)
721
+ // Arrays and tuples are checked for cycles, as their element types can refer back to them.
722
+ if (isArrayOrTupleType(c, t) || t.node !== undefined)
695
723
  return this.visitAndTransformType(t, 1 /* TransformKind.TypeReference */);
696
724
  return this.typeReferenceToTypeNode(t);
697
725
  }
@@ -799,20 +827,38 @@ export class NodeBuilder {
799
827
  }
800
828
  /** Writes `t` with `transform`, eliding its circular references; cached per enclosing declaration. */
801
829
  visitAndTransformType(t, transform) {
802
- const typeId = t.id;
830
+ if (this.checkTruncationLength())
831
+ return this.createElidedInformationPlaceholder();
832
+ const c = this.c;
833
+ let typeId = t.id;
834
+ const isArrayOrTuple = isArrayOrTupleType(c, t);
835
+ // A deferred reference and the regular reference to the same array or tuple are one cycle identity.
836
+ if (isArrayOrTuple)
837
+ typeId = createTypeReference(c, t.target, getTypeArguments(c, t)).id;
838
+ if (this.visitedTypes.has(typeId))
839
+ return this.createCyclicStructurePlaceholder();
803
840
  const isConstructorObject = (t.objectFlags & 16 /* ObjectFlags.Anonymous */) !== 0 &&
804
841
  t.symbol !== undefined &&
805
842
  (t.symbol.flags & 32 /* SymbolFlags.Class */) !== 0;
806
843
  // Instantiations of one anonymous type share a symbol, so tracking symbols rather than
807
- // types catches circular references through them.
844
+ // types catches circular references through them. Nesting of arrays and tuples, which share the Array
845
+ // symbol or a tuple target, is not bounded by it. A deferred array or tuple reference is bounded by its
846
+ // node, which stops a recursive alias whose type arguments grow at each level (`type R<T> = R<T[]>[]`).
808
847
  let id = undefined;
809
- if ((t.objectFlags & 4 /* ObjectFlags.Reference */) !== 0 && t.node !== undefined)
848
+ if (isArrayOrTuple) {
849
+ const node = t.node;
850
+ if (node !== undefined)
851
+ id = 'n' + getNodeId(node);
852
+ }
853
+ else if ((t.objectFlags & 4 /* ObjectFlags.Reference */) !== 0 && t.node !== undefined)
810
854
  id = 'n' + getNodeId(t.node);
811
855
  else if ((t.flags & 67108864 /* TypeFlags.Conditional */) !== 0)
812
856
  id = 'n' + getNodeId(t.root.node);
813
857
  else if (t.symbol !== undefined)
814
858
  id = (isConstructorObject ? 'c' : 's') + getSymbolId(t.symbol);
815
- const key = typeId + ':' + this.flags + ':' + this.internalFlags;
859
+ let key = typeId + ':' + this.flags + ':' + this.internalFlags;
860
+ if (this.inferTypeParameters.length !== 0)
861
+ key += ':' + typeListKey(this.inferTypeParameters);
816
862
  if (this.enclosingDeclaration !== undefined) {
817
863
  const cached = this.serializedTypes.get(getNodeId(this.enclosingDeclaration))?.get(key);
818
864
  if (cached !== undefined) {
@@ -824,11 +870,28 @@ export class NodeBuilder {
824
870
  return this.deepCloneNode(cached.node);
825
871
  }
826
872
  }
873
+ // Growing type arguments can keep a reverse mapped type from repeating, so its expansion is also bounded by
874
+ // its mapped type's declaration.
875
+ let origin = undefined;
876
+ let originDepth = 0;
877
+ if ((t.objectFlags & 1024 /* ObjectFlags.ReverseMapped */) !== 0) {
878
+ origin = 'n' + getNodeId(t.mappedType.declaration);
879
+ originDepth = this.symbolDepth.get(origin) ?? 0;
880
+ if (originDepth >= 100) {
881
+ this.truncating = true;
882
+ return this.createElidedInformationPlaceholder();
883
+ }
884
+ this.symbolDepth.set(origin, originDepth + 1);
885
+ }
827
886
  let depth = 0;
828
887
  if (id !== undefined) {
829
888
  depth = this.symbolDepth.get(id) ?? 0;
830
- if (depth > 10)
889
+ if (depth > 10) {
890
+ this.truncating = true;
891
+ if (origin !== undefined)
892
+ this.symbolDepth.set(origin, originDepth);
831
893
  return this.createElidedInformationPlaceholder();
894
+ }
832
895
  this.symbolDepth.set(id, depth + 1);
833
896
  }
834
897
  this.visitedTypes.add(typeId);
@@ -866,22 +929,27 @@ export class NodeBuilder {
866
929
  this.visitedTypes.delete(typeId);
867
930
  if (id !== undefined)
868
931
  this.symbolDepth.set(id, depth);
932
+ if (origin !== undefined)
933
+ this.symbolDepth.set(origin, originDepth);
869
934
  this.trackedSymbols = prevTrackedSymbols;
870
935
  return result;
871
936
  }
872
937
  typeToTypeNodeOrCircularityElision(t) {
873
938
  if ((t.flags & 134217728 /* TypeFlags.Union */) !== 0) {
874
- if (this.visitedTypes.has(t.id)) {
875
- if ((this.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */) === 0) {
876
- this.encounteredError = true;
877
- this.tracker.reportCyclicStructureError();
878
- }
879
- return this.createElidedInformationPlaceholder();
880
- }
939
+ if (this.visitedTypes.has(t.id))
940
+ return this.createCyclicStructurePlaceholder();
881
941
  return this.visitAndTransformType(t, 0 /* TransformKind.Type */);
882
942
  }
883
943
  return this.typeToTypeNode(t);
884
944
  }
945
+ /** The placeholder for a circular reference; outside of display, it is an error. */
946
+ createCyclicStructurePlaceholder() {
947
+ if ((this.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */) === 0) {
948
+ this.encounteredError = true;
949
+ this.tracker.reportCyclicStructureError();
950
+ }
951
+ return this.createElidedInformationPlaceholder();
952
+ }
885
953
  conditionalTypeToTypeNode(t) {
886
954
  const c = this.c;
887
955
  if (this.checkTruncationLength())
@@ -921,7 +989,7 @@ export class NodeBuilder {
921
989
  return this.created(new ConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode));
922
990
  }
923
991
  getParentSymbolOfTypeParameter(typeParameter) {
924
- const tp = getDeclarationOfKind(typeParameter.symbol, 169 /* SyntaxKind.TypeParameter */);
992
+ const tp = getDeclarationOfKind(typeParameter.symbol, 170 /* SyntaxKind.TypeParameter */);
925
993
  const host = tp?.parent;
926
994
  if (host === undefined)
927
995
  return undefined;
@@ -1050,7 +1118,8 @@ export class NodeBuilder {
1050
1118
  shouldWriteTypeOfFunctionSymbol(symbol, typeId) {
1051
1119
  const c = this.c;
1052
1120
  let isStaticMethodSymbol = false;
1053
- if ((symbol.flags & 8192 /* SymbolFlags.Method */) !== 0)
1121
+ // `typeof C.name` can only be written when the member's name is an identifier.
1122
+ if ((symbol.flags & 8192 /* SymbolFlags.Method */) !== 0 && isIdentifierText(symbol.name))
1054
1123
  for (const d of getDeclarations(symbol))
1055
1124
  if (isStatic(d) && !hasLateBindableIndexSignature(c, d))
1056
1125
  isStaticMethodSymbol = true;
@@ -1062,19 +1131,19 @@ export class NodeBuilder {
1062
1131
  else
1063
1132
  for (const d of getDeclarations(symbol)) {
1064
1133
  const parent = d.parent;
1065
- if (parent.kind === 307 /* SyntaxKind.SourceFile */ || parent.kind === 269 /* SyntaxKind.ModuleBlock */) {
1134
+ if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 270 /* SyntaxKind.ModuleBlock */) {
1066
1135
  isNonLocalFunctionSymbol = true;
1067
1136
  break;
1068
1137
  }
1069
1138
  const statement = parent.parent?.parent;
1070
1139
  const container = statement?.parent;
1071
- if ((d.kind === 219 /* SyntaxKind.FunctionExpression */ || d.kind === 220 /* SyntaxKind.ArrowFunction */) &&
1072
- parent.kind === 261 /* SyntaxKind.VariableDeclaration */ &&
1073
- parent.parent.kind === 262 /* SyntaxKind.VariableDeclarationList */ &&
1140
+ if ((d.kind === 220 /* SyntaxKind.FunctionExpression */ || d.kind === 221 /* SyntaxKind.ArrowFunction */) &&
1141
+ parent.kind === 262 /* SyntaxKind.VariableDeclaration */ &&
1142
+ parent.parent.kind === 263 /* SyntaxKind.VariableDeclarationList */ &&
1074
1143
  statement !== undefined &&
1075
- statement.kind === 244 /* SyntaxKind.VariableStatement */ &&
1144
+ statement.kind === 245 /* SyntaxKind.VariableStatement */ &&
1076
1145
  container !== undefined &&
1077
- (container.kind === 307 /* SyntaxKind.SourceFile */ || container.kind === 269 /* SyntaxKind.ModuleBlock */)) {
1146
+ (container.kind === 308 /* SyntaxKind.SourceFile */ || container.kind === 270 /* SyntaxKind.ModuleBlock */)) {
1078
1147
  isNonLocalFunctionSymbol = true;
1079
1148
  isFunctionExpressionSymbol = true;
1080
1149
  break;
@@ -1113,7 +1182,7 @@ export class NodeBuilder {
1113
1182
  !(valueDeclaration !== undefined &&
1114
1183
  isClassLike(valueDeclaration) &&
1115
1184
  (this.flags & 2048 /* NodeBuilderFlags.WriteClassExpressionAsTypeLiteral */) !== 0 &&
1116
- (valueDeclaration.kind !== 264 /* SyntaxKind.ClassDeclaration */ ||
1185
+ (valueDeclaration.kind !== 265 /* SyntaxKind.ClassDeclaration */ ||
1117
1186
  isSymbolAccessible(c, symbol, this.enclosingDeclaration, isInstanceType, false).accessibility !==
1118
1187
  0 /* SymbolAccessibility.Accessible */))) ||
1119
1188
  (symbol.flags & (384 /* SymbolFlags.Enum */ | 512 /* SymbolFlags.ValueModule */)) !== 0)
@@ -1124,17 +1193,25 @@ export class NodeBuilder {
1124
1193
  const c = this.c;
1125
1194
  const typeId = t.id;
1126
1195
  const symbol = t.symbol;
1127
- // Anonymous types without a symbol are never circular.
1128
- if (symbol === undefined)
1196
+ if (symbol === undefined) {
1197
+ // In declaration emit a reverse mapped type is written out, so it can be circular; for display, its
1198
+ // properties and index signatures use placeholders.
1199
+ if ((t.objectFlags & 1024 /* ObjectFlags.ReverseMapped */) !== 0 &&
1200
+ (this.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */) === 0) {
1201
+ if (this.visitedTypes.has(typeId))
1202
+ return this.createCyclicStructurePlaceholder();
1203
+ return this.visitAndTransformType(t, 3 /* TransformKind.ObjectType */);
1204
+ }
1129
1205
  return this.createTypeNodeFromObjectType(t);
1206
+ }
1130
1207
  if ((t.objectFlags & 16777216 /* ObjectFlags.InstantiationExpressionType */) !== 0) {
1131
1208
  const existing = t.node;
1132
1209
  // The node is unreliable for members of unions and intersections, so it's checked.
1133
1210
  if (existing !== undefined &&
1134
- existing.kind === 187 /* SyntaxKind.TypeQuery */ &&
1211
+ existing.kind === 188 /* SyntaxKind.TypeQuery */ &&
1135
1212
  this.getTypeFromTypeNode(existing, false) === t) {
1136
1213
  if (this.visitedTypes.has(typeId))
1137
- return this.createElidedInformationPlaceholder();
1214
+ return this.createCyclicStructurePlaceholder();
1138
1215
  this.visitedTypes.add(typeId);
1139
1216
  const typeNode = this.tryReuseExistingNonParameterTypeNode(existing, t, undefined, undefined);
1140
1217
  this.visitedTypes.delete(typeId);
@@ -1142,7 +1219,7 @@ export class NodeBuilder {
1142
1219
  return typeNode;
1143
1220
  }
1144
1221
  if (this.visitedTypes.has(typeId))
1145
- return this.createElidedInformationPlaceholder();
1222
+ return this.createCyclicStructurePlaceholder();
1146
1223
  return this.visitAndTransformType(t, 3 /* TransformKind.ObjectType */);
1147
1224
  }
1148
1225
  const isInstanceType = isClassInstanceSide(c, t) ? 788968 /* SymbolFlags.Type */ : 111551 /* SymbolFlags.Value */;
@@ -1154,7 +1231,7 @@ export class NodeBuilder {
1154
1231
  const typeAlias = getTypeAliasForTypeLiteral(c, t);
1155
1232
  if (typeAlias !== undefined)
1156
1233
  return symbolToTypeNode(this, typeAlias, 788968 /* SymbolFlags.Type */, undefined);
1157
- return this.createElidedInformationPlaceholder();
1234
+ return this.createCyclicStructurePlaceholder();
1158
1235
  }
1159
1236
  return this.visitAndTransformType(t, 3 /* TransformKind.ObjectType */);
1160
1237
  }
@@ -1174,9 +1251,9 @@ export class NodeBuilder {
1174
1251
  return result;
1175
1252
  }
1176
1253
  if (callSignatures.length === 1 && constructSignatures.length === 0)
1177
- return this.signatureToSignatureDeclaration(callSignatures[0], 185 /* SyntaxKind.FunctionType */, undefined);
1254
+ return this.signatureToSignatureDeclaration(callSignatures[0], 186 /* SyntaxKind.FunctionType */, undefined);
1178
1255
  if (constructSignatures.length === 1 && callSignatures.length === 0)
1179
- return this.signatureToSignatureDeclaration(constructSignatures[0], 186 /* SyntaxKind.ConstructorType */, undefined);
1256
+ return this.signatureToSignatureDeclaration(constructSignatures[0], 187 /* SyntaxKind.ConstructorType */, undefined);
1180
1257
  }
1181
1258
  const abstractSignatures = constructSignatures.filter((s) => (s.flags & 8 /* SignatureFlags.Abstract */) !== 0);
1182
1259
  if (abstractSignatures.length > 0) {
@@ -1223,16 +1300,17 @@ export class NodeBuilder {
1223
1300
  }
1224
1301
  const typeElements = [];
1225
1302
  for (const signature of resolved.callSignatures)
1226
- typeElements.push(this.signatureToSignatureDeclaration(signature, 180 /* SyntaxKind.CallSignature */, undefined));
1303
+ typeElements.push(this.signatureToSignatureDeclaration(signature, 181 /* SyntaxKind.CallSignature */, undefined));
1227
1304
  for (const signature of resolved.constructSignatures) {
1228
1305
  if ((signature.flags & 8 /* SignatureFlags.Abstract */) !== 0)
1229
1306
  continue;
1230
- typeElements.push(this.signatureToSignatureDeclaration(signature, 181 /* SyntaxKind.ConstructSignature */, undefined));
1307
+ typeElements.push(this.signatureToSignatureDeclaration(signature, 182 /* SyntaxKind.ConstructSignature */, undefined));
1231
1308
  }
1232
1309
  for (const info of resolved.indexInfos) {
1233
- // tsgo creates the placeholder for every index signature, and its length counts toward truncation.
1234
- const placeholder = this.createElidedInformationPlaceholder();
1235
- const typeNode = (t.objectFlags & 1024 /* ObjectFlags.ReverseMapped */) !== 0 ? placeholder : undefined;
1310
+ const typeNode = (t.objectFlags & 1024 /* ObjectFlags.ReverseMapped */) !== 0 &&
1311
+ (this.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */) !== 0
1312
+ ? this.createElidedInformationPlaceholder()
1313
+ : undefined;
1236
1314
  for (const element of this.indexInfoToObjectComputedNamesOrSignatureDeclaration(info, typeNode))
1237
1315
  typeElements.push(element);
1238
1316
  }
@@ -1268,8 +1346,11 @@ export class NodeBuilder {
1268
1346
  }
1269
1347
  shouldUsePlaceholderForProperty(propertySymbol) {
1270
1348
  // Placeholders for reverse mapped types (1) already being written, (2) nested in a mapping
1271
- // over a non-anonymous type, or (3) nested deeply in the same mapped type.
1272
- if ((propertySymbol.checkFlags & 8192 /* CheckFlags.ReverseMapped */) === 0)
1349
+ // over a non-anonymous type, or (3) nested deeply in the same mapped type. They are for display only:
1350
+ // declaration emit writes the types.
1351
+ if ((this.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */) === 0)
1352
+ return false;
1353
+ if ((propertySymbol.checkFlags & 65536 /* CheckFlags.ReverseMapped */) === 0)
1273
1354
  return false;
1274
1355
  const stack = this.reverseMappedStack;
1275
1356
  if (stack.indexOf(propertySymbol) >= 0)
@@ -1308,7 +1389,7 @@ export class NodeBuilder {
1308
1389
  }
1309
1390
  addPropertyToElementList(propertySymbol, typeElements) {
1310
1391
  const c = this.c;
1311
- const propertyIsReverseMapped = (propertySymbol.checkFlags & 8192 /* CheckFlags.ReverseMapped */) !== 0;
1392
+ const propertyIsReverseMapped = (propertySymbol.checkFlags & 65536 /* CheckFlags.ReverseMapped */) !== 0;
1312
1393
  const propertyType = this.shouldUsePlaceholderForProperty(propertySymbol)
1313
1394
  ? c.anyType
1314
1395
  : getNonMissingTypeOfSymbol(c, propertySymbol);
@@ -1334,31 +1415,31 @@ export class NodeBuilder {
1334
1415
  this.enclosingDeclaration =
1335
1416
  propertySymbol.valueDeclaration ??
1336
1417
  (declarationCount(propertySymbol) > 0 ? propertySymbol.declaration : saveEnclosingDeclaration);
1337
- const propertyName = getPropertyNameNodeForSymbol(this, propertySymbol);
1418
+ const propertyName = getPropertyNameNodeForSymbol(this, propertySymbol, saveEnclosingDeclaration);
1338
1419
  this.enclosingDeclaration = saveEnclosingDeclaration;
1339
1420
  this.approximateLength += symbolName(propertySymbol).length + 1;
1340
1421
  if ((propertySymbol.flags & 98304 /* SymbolFlags.Accessor */) !== 0) {
1341
1422
  const writeType = getWriteTypeOfSymbol(c, propertySymbol);
1342
1423
  if (!isErrorType(c, propertyType) && !isErrorType(c, writeType)) {
1343
- const propDeclaration = getDeclarationOfKind(propertySymbol, 173 /* SyntaxKind.PropertyDeclaration */);
1424
+ const propDeclaration = getDeclarationOfKind(propertySymbol, 174 /* SyntaxKind.PropertyDeclaration */);
1344
1425
  const parentIsClass = propertySymbol.parent !== undefined && (propertySymbol.parent.flags & 32 /* SymbolFlags.Class */) !== 0;
1345
1426
  if (propertyType !== writeType || (parentIsClass && propDeclaration === undefined)) {
1346
1427
  const symbolMapper = c.symbolMappers.get(getSymbolId(propertySymbol));
1347
- const getterDeclaration = getDeclarationOfKind(propertySymbol, 178 /* SyntaxKind.GetAccessor */);
1428
+ const getterDeclaration = getDeclarationOfKind(propertySymbol, 179 /* SyntaxKind.GetAccessor */);
1348
1429
  if (getterDeclaration !== undefined) {
1349
1430
  let getterSignature = getSignatureFromDeclaration(c, getterDeclaration);
1350
1431
  if (symbolMapper !== undefined)
1351
1432
  getterSignature = instantiateSignature(c, getterSignature, symbolMapper);
1352
- const getter = this.signatureToSignatureDeclaration(getterSignature, 178 /* SyntaxKind.GetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1433
+ const getter = this.signatureToSignatureDeclaration(getterSignature, 179 /* SyntaxKind.GetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1353
1434
  this.setCommentRange(getter, getterDeclaration);
1354
1435
  typeElements.push(getter);
1355
1436
  }
1356
- const setterDeclaration = getDeclarationOfKind(propertySymbol, 179 /* SyntaxKind.SetAccessor */);
1437
+ const setterDeclaration = getDeclarationOfKind(propertySymbol, 180 /* SyntaxKind.SetAccessor */);
1357
1438
  if (setterDeclaration !== undefined) {
1358
1439
  let setterSignature = getSignatureFromDeclaration(c, setterDeclaration);
1359
1440
  if (symbolMapper !== undefined)
1360
1441
  setterSignature = instantiateSignature(c, setterSignature, symbolMapper);
1361
- const setter = this.signatureToSignatureDeclaration(setterSignature, 179 /* SyntaxKind.SetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1442
+ const setter = this.signatureToSignatureDeclaration(setterSignature, 180 /* SyntaxKind.SetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1362
1443
  this.setCommentRange(setter, setterDeclaration);
1363
1444
  typeElements.push(setter);
1364
1445
  }
@@ -1366,13 +1447,13 @@ export class NodeBuilder {
1366
1447
  }
1367
1448
  if (parentIsClass && propDeclaration !== undefined && hasAccessorKeyword(propDeclaration)) {
1368
1449
  const fakeGetterSignature = c.newSignature(0 /* SignatureFlags.None */, undefined, [], undefined, [], propertyType, 0);
1369
- const fakeGetter = this.signatureToSignatureDeclaration(fakeGetterSignature, 178 /* SyntaxKind.GetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1450
+ const fakeGetter = this.signatureToSignatureDeclaration(fakeGetterSignature, 179 /* SyntaxKind.GetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined));
1370
1451
  this.setCommentRange(fakeGetter, propDeclaration);
1371
1452
  typeElements.push(fakeGetter);
1372
1453
  const setterParam = c.newSymbol(1 /* SymbolFlags.FunctionScopedVariable */, 'arg');
1373
1454
  c.symbolTypes.set(getSymbolId(setterParam), writeType);
1374
1455
  const fakeSetterSignature = c.newSignature(0 /* SignatureFlags.None */, undefined, [], undefined, [setterParam], c.voidType, 0);
1375
- typeElements.push(this.signatureToSignatureDeclaration(fakeSetterSignature, 179 /* SyntaxKind.SetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined)));
1456
+ typeElements.push(this.signatureToSignatureDeclaration(fakeSetterSignature, 180 /* SyntaxKind.SetAccessor */, new SignatureDeclarationOptions([], propertyName, undefined)));
1376
1457
  return;
1377
1458
  }
1378
1459
  }
@@ -1383,7 +1464,7 @@ export class NodeBuilder {
1383
1464
  !isReadonlySymbol(c, propertySymbol)) {
1384
1465
  const signatures = getSignaturesOfType(c, filterType(c, propertyType, (u) => (u.flags & 4 /* TypeFlags.Undefined */) === 0), 0 /* SignatureKind.Call */);
1385
1466
  for (const signature of signatures) {
1386
- const methodDeclaration = this.signatureToSignatureDeclaration(signature, 174 /* SyntaxKind.MethodSignature */, new SignatureDeclarationOptions([], propertyName, optionalToken));
1467
+ const methodDeclaration = this.signatureToSignatureDeclaration(signature, 175 /* SyntaxKind.MethodSignature */, new SignatureDeclarationOptions([], propertyName, optionalToken));
1387
1468
  this.setCommentRange(methodDeclaration, signature.declaration ?? propertySymbol.valueDeclaration);
1388
1469
  typeElements.push(methodDeclaration);
1389
1470
  }
@@ -1428,7 +1509,7 @@ export class NodeBuilder {
1428
1509
  }
1429
1510
  isTriviallySerializableComputedName(e) {
1430
1511
  const name = getName(e);
1431
- if (name === undefined || name.kind !== 168 /* SyntaxKind.ComputedPropertyName */)
1512
+ if (name === undefined || name.kind !== 169 /* SyntaxKind.ComputedPropertyName */)
1432
1513
  return false;
1433
1514
  const expression = getExpression(name);
1434
1515
  if (!isEntityNameExpression(expression, false))
@@ -1577,7 +1658,7 @@ export class NodeBuilder {
1577
1658
  const symbol = typeParameter.symbol;
1578
1659
  if (symbol !== undefined && declarationCount(symbol) > 0) {
1579
1660
  const decl = symbol.declaration;
1580
- if (decl.kind === 169 /* SyntaxKind.TypeParameter */)
1661
+ if (decl.kind === 170 /* SyntaxKind.TypeParameter */)
1581
1662
  result = this.setTextRange(result, getName(decl));
1582
1663
  }
1583
1664
  if (generateNames) {
@@ -1681,7 +1762,7 @@ export class NodeBuilder {
1681
1762
  // An expanded parameter list with a variadic before its end isn't used.
1682
1763
  let useOriginal = false;
1683
1764
  for (const p of expandedParams)
1684
- if (p !== expandedParams[expandedParams.length - 1] && (p.checkFlags & 32768 /* CheckFlags.RestParameter */) !== 0)
1765
+ if (p !== expandedParams[expandedParams.length - 1] && (p.checkFlags & 262144 /* CheckFlags.RestParameter */) !== 0)
1685
1766
  useOriginal = true;
1686
1767
  const parameters = [];
1687
1768
  const thisParameter = (this.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */) !== 0
@@ -1690,11 +1771,11 @@ export class NodeBuilder {
1690
1771
  if (thisParameter !== undefined)
1691
1772
  parameters.push(thisParameter);
1692
1773
  for (const parameter of useOriginal ? signature.parameters : expandedParams)
1693
- parameters.push(this.symbolToParameterDeclaration(parameter, kind === 177 /* SyntaxKind.Constructor */));
1774
+ parameters.push(this.symbolToParameterDeclaration(parameter, kind === 178 /* SyntaxKind.Constructor */));
1694
1775
  this.flags = savedFlags;
1695
1776
  let returnTypeNode = this.serializeReturnTypeForSignature(signature);
1696
1777
  let modifiers = options !== undefined ? options.modifiers : [];
1697
- if (kind === 186 /* SyntaxKind.ConstructorType */ && (signature.flags & 8 /* SignatureFlags.Abstract */) !== 0) {
1778
+ if (kind === 187 /* SyntaxKind.ConstructorType */ && (signature.flags & 8 /* SignatureFlags.Abstract */) !== 0) {
1698
1779
  let flags = 64 /* ModifierFlags.Abstract */;
1699
1780
  for (const m of modifiers)
1700
1781
  flags |= modifierToFlag(m.kind);
@@ -1706,47 +1787,47 @@ export class NodeBuilder {
1706
1787
  const name = (options !== undefined ? options.name : undefined) ?? this.identifier('');
1707
1788
  let node;
1708
1789
  switch (kind) {
1709
- case 180 /* SyntaxKind.CallSignature */:
1790
+ case 181 /* SyntaxKind.CallSignature */:
1710
1791
  node = this.created(new CallSignatureDeclaration(typeParamList, paramList, returnTypeNode));
1711
1792
  break;
1712
- case 181 /* SyntaxKind.ConstructSignature */:
1793
+ case 182 /* SyntaxKind.ConstructSignature */:
1713
1794
  node = this.created(new ConstructSignatureDeclaration(typeParamList, paramList, returnTypeNode));
1714
1795
  break;
1715
- case 174 /* SyntaxKind.MethodSignature */:
1796
+ case 175 /* SyntaxKind.MethodSignature */:
1716
1797
  node = this.created(new MethodSignatureDeclaration(modifierList, name, options !== undefined ? options.questionToken : undefined, typeParamList, paramList, returnTypeNode));
1717
1798
  break;
1718
- case 175 /* SyntaxKind.MethodDeclaration */:
1799
+ case 176 /* SyntaxKind.MethodDeclaration */:
1719
1800
  node = this.created(new MethodDeclaration(modifierList, undefined, name, undefined, typeParamList, paramList, returnTypeNode, undefined, undefined));
1720
1801
  break;
1721
- case 177 /* SyntaxKind.Constructor */:
1802
+ case 178 /* SyntaxKind.Constructor */:
1722
1803
  node = this.created(new ConstructorDeclaration(modifierList, undefined, paramList, undefined, undefined, undefined));
1723
1804
  break;
1724
- case 178 /* SyntaxKind.GetAccessor */:
1805
+ case 179 /* SyntaxKind.GetAccessor */:
1725
1806
  node = this.created(new GetAccessorDeclaration(modifierList, name, undefined, paramList, returnTypeNode, undefined, undefined));
1726
1807
  break;
1727
- case 179 /* SyntaxKind.SetAccessor */:
1808
+ case 180 /* SyntaxKind.SetAccessor */:
1728
1809
  node = this.created(new SetAccessorDeclaration(modifierList, name, undefined, paramList, undefined, undefined, undefined));
1729
1810
  break;
1730
- case 182 /* SyntaxKind.IndexSignature */:
1811
+ case 183 /* SyntaxKind.IndexSignature */:
1731
1812
  node = this.created(new IndexSignatureDeclaration(modifierList, paramList, returnTypeNode));
1732
1813
  break;
1733
- case 185 /* SyntaxKind.FunctionType */:
1814
+ case 186 /* SyntaxKind.FunctionType */:
1734
1815
  if (returnTypeNode === undefined)
1735
1816
  returnTypeNode = this.typeReference(this.identifier(''), undefined);
1736
1817
  node = this.created(new FunctionTypeNode(typeParamList, paramList, returnTypeNode));
1737
1818
  break;
1738
- case 186 /* SyntaxKind.ConstructorType */:
1819
+ case 187 /* SyntaxKind.ConstructorType */:
1739
1820
  if (returnTypeNode === undefined)
1740
1821
  returnTypeNode = this.typeReference(this.identifier(''), undefined);
1741
1822
  node = this.created(new ConstructorTypeNode(modifierList, typeParamList, paramList, returnTypeNode));
1742
1823
  break;
1743
- case 263 /* SyntaxKind.FunctionDeclaration */:
1824
+ case 264 /* SyntaxKind.FunctionDeclaration */:
1744
1825
  node = this.created(new FunctionDeclaration(modifierList, undefined, name, typeParamList, paramList, returnTypeNode, undefined, undefined));
1745
1826
  break;
1746
- case 219 /* SyntaxKind.FunctionExpression */:
1827
+ case 220 /* SyntaxKind.FunctionExpression */:
1747
1828
  node = this.created(new FunctionExpression(modifierList, undefined, name, typeParamList, paramList, returnTypeNode, undefined, this.created(new Block(this.list([]), false))));
1748
1829
  break;
1749
- case 220 /* SyntaxKind.ArrowFunction */:
1830
+ case 221 /* SyntaxKind.ArrowFunction */:
1750
1831
  node = this.created(new ArrowFunction(modifierList, typeParamList, paramList, returnTypeNode, undefined, undefined, this.created(new Block(this.list([]), false))));
1751
1832
  break;
1752
1833
  default:
@@ -1786,10 +1867,10 @@ export class NodeBuilder {
1786
1867
  }
1787
1868
  }
1788
1869
  const isRest = (parameterDeclaration instanceof ParameterDeclaration && parameterDeclaration.dotDotDotToken !== undefined) ||
1789
- (parameterSymbol.checkFlags & 32768 /* CheckFlags.RestParameter */) !== 0;
1870
+ (parameterSymbol.checkFlags & 262144 /* CheckFlags.RestParameter */) !== 0;
1790
1871
  const name = this.parameterToParameterDeclarationName(parameterSymbol, parameterDeclaration);
1791
1872
  const isOptional = (parameterDeclaration !== undefined && isOptionalParameter(c, parameterDeclaration)) ||
1792
- (parameterSymbol.checkFlags & 16384 /* CheckFlags.OptionalParameter */) !== 0;
1873
+ (parameterSymbol.checkFlags & 131072 /* CheckFlags.OptionalParameter */) !== 0;
1793
1874
  const parameterNode = this.created(new ParameterDeclaration(modifiers, isRest ? this.token(25 /* SyntaxKind.DotDotDotToken */) : undefined, name, isOptional ? this.token(57 /* SyntaxKind.QuestionToken */) : undefined, parameterTypeNode, undefined));
1794
1875
  this.approximateLength += parameterSymbol.name.length + 3;
1795
1876
  return parameterNode;
@@ -1804,7 +1885,7 @@ export class NodeBuilder {
1804
1885
  this.context.setEmitFlags(cloned, 131072 /* EmitFlags.NoAsciiEscaping */);
1805
1886
  return cloned;
1806
1887
  }
1807
- case 167 /* SyntaxKind.QualifiedName */: {
1888
+ case 168 /* SyntaxKind.QualifiedName */: {
1808
1889
  const cloned = this.cloneSynthesized(name.right);
1809
1890
  this.context.setEmitFlags(cloned, 131072 /* EmitFlags.NoAsciiEscaping */);
1810
1891
  return cloned;
@@ -1839,12 +1920,15 @@ export class NodeBuilder {
1839
1920
  if (symbol === undefined && declaration !== undefined)
1840
1921
  symbol = getSymbolOfDeclaration(c, declaration);
1841
1922
  let t = type;
1923
+ // A variable named by a binding pattern has no symbol.
1924
+ if (t === undefined && symbol === undefined && declaration !== undefined && isVariableLike(declaration))
1925
+ t = getTypeForVariableLikeDeclaration(c, declaration, false);
1842
1926
  if (t === undefined && symbol !== undefined) {
1843
1927
  t = this.enclosingSymbolTypes.get(getSymbolId(symbol));
1844
1928
  if (t === undefined) {
1845
1929
  if ((symbol.flags & 98304 /* SymbolFlags.Accessor */) !== 0 &&
1846
1930
  declaration !== undefined &&
1847
- declaration.kind === 179 /* SyntaxKind.SetAccessor */)
1931
+ declaration.kind === 180 /* SyntaxKind.SetAccessor */)
1848
1932
  t = instantiateType(c, getWriteTypeOfSymbol(c, symbol), this.mapper);
1849
1933
  else if ((symbol.flags & (2048 /* SymbolFlags.TypeLiteral */ | 131072 /* SymbolFlags.Signature */)) === 0)
1850
1934
  t = instantiateType(c, getWidenedLiteralType(c, getTypeOfSymbol(c, symbol)), this.mapper);
@@ -1857,7 +1941,7 @@ export class NodeBuilder {
1857
1941
  if (this.pseudo !== undefined)
1858
1942
  return this.serializeTypeForDeclarationReusing(declaration, t, symbol, tryReuse);
1859
1943
  if (declaration !== undefined &&
1860
- declaration.kind === 170 /* SyntaxKind.Parameter */ &&
1944
+ declaration.kind === 171 /* SyntaxKind.Parameter */ &&
1861
1945
  requiresAddingImplicitUndefined(c, declaration, this.enclosingDeclaration))
1862
1946
  t = getOptionalType(c, t, false);
1863
1947
  const savedFlags = this.flags;
@@ -1876,12 +1960,12 @@ export class NodeBuilder {
1876
1960
  const pseudo = this.pseudo;
1877
1961
  let t = typeIn;
1878
1962
  const isPropertyLike = declaration !== undefined &&
1879
- (declaration.kind === 170 /* SyntaxKind.Parameter */ ||
1880
- declaration.kind === 172 /* SyntaxKind.PropertySignature */ ||
1881
- declaration.kind === 173 /* SyntaxKind.PropertyDeclaration */);
1963
+ (declaration.kind === 171 /* SyntaxKind.Parameter */ ||
1964
+ declaration.kind === 173 /* SyntaxKind.PropertySignature */ ||
1965
+ declaration.kind === 174 /* SyntaxKind.PropertyDeclaration */);
1882
1966
  const requiresAddingUndefined = isPropertyLike &&
1883
1967
  requiresAddingImplicitUndefinedForDeclaration(c, declaration, symbol, this.enclosingDeclaration);
1884
- if (requiresAddingUndefined && declaration.kind === 170 /* SyntaxKind.Parameter */)
1968
+ if (requiresAddingUndefined && declaration.kind === 171 /* SyntaxKind.Parameter */)
1885
1969
  t = getOptionalType(c, t, false);
1886
1970
  const savedFlags = this.flags;
1887
1971
  if ((t.flags & 16384 /* TypeFlags.UniqueESSymbol */) !== 0 &&
@@ -1894,19 +1978,22 @@ export class NodeBuilder {
1894
1978
  if (tryReuse &&
1895
1979
  this.enclosingDeclaration !== undefined &&
1896
1980
  declaration !== undefined &&
1897
- symbol !== undefined &&
1898
1981
  (isAccessorKind(declaration) ||
1899
1982
  (hasInferredTypeKind(declaration) &&
1900
1983
  (declaration.flags & 16 /* NodeFlags.Synthesized */) === 0 &&
1901
1984
  (t.objectFlags & 196608 /* ObjectFlags.RequiresWidening */) === 0))) {
1902
- const remove = this.addSymbolTypeToContext(symbol, t);
1985
+ const remove = symbol !== undefined ? this.addSymbolTypeToContext(symbol, t) : undefined;
1903
1986
  let pt = isAccessorKind(declaration)
1904
1987
  ? pseudo.getTypeOfAccessor(declaration)
1905
1988
  : pseudo.getTypeOfDeclaration(declaration);
1906
- if (pt.kind === 2 /* PseudoTypeKind.NoResult */ && declaration.kind === 227 /* SyntaxKind.BinaryExpression */) {
1907
- // The first annotated assignment declares the type for the rest.
1989
+ if (pt.kind === 2 /* PseudoTypeKind.NoResult */ &&
1990
+ declaration.kind === 228 /* SyntaxKind.BinaryExpression */ &&
1991
+ symbol !== undefined) {
1992
+ // The first annotated assignment declares the type for the rest. A type alias's type isn't an annotation.
1908
1993
  for (const d of getDeclarations(symbol))
1909
- if (getType(d) !== undefined) {
1994
+ if (getType(d) !== undefined &&
1995
+ d.kind !== 267 /* SyntaxKind.TypeAliasDeclaration */ &&
1996
+ d.kind !== 346 /* SyntaxKind.JSTypeAliasDeclaration */) {
1910
1997
  pt = pseudo.getTypeOfDeclaration(d);
1911
1998
  break;
1912
1999
  }
@@ -1938,7 +2025,8 @@ export class NodeBuilder {
1938
2025
  }
1939
2026
  }
1940
2027
  }
1941
- remove();
2028
+ if (remove !== undefined)
2029
+ remove();
1942
2030
  }
1943
2031
  if (result === undefined) {
1944
2032
  if (reportedInferenceFallback) {
@@ -2126,9 +2214,9 @@ function getTypeAliasForTypeLiteral(c, t) {
2126
2214
  if (symbol === undefined || (symbol.flags & 2048 /* SymbolFlags.TypeLiteral */) === 0 || declarationCount(symbol) === 0)
2127
2215
  return undefined;
2128
2216
  let node = symbol.declaration.parent;
2129
- while (node !== undefined && node.kind === 197 /* SyntaxKind.ParenthesizedType */)
2217
+ while (node !== undefined && node.kind === 198 /* SyntaxKind.ParenthesizedType */)
2130
2218
  node = node.parent;
2131
- if (node !== undefined && node.kind === 266 /* SyntaxKind.TypeAliasDeclaration */)
2219
+ if (node !== undefined && node.kind === 267 /* SyntaxKind.TypeAliasDeclaration */)
2132
2220
  return getSymbolOfDeclaration(c, node);
2133
2221
  return undefined;
2134
2222
  }
@@ -2179,15 +2267,15 @@ function getTypeParameterModifiers(tp) {
2179
2267
  return flags & (8192 /* ModifierFlags.In */ | 16384 /* ModifierFlags.Out */ | 4096 /* ModifierFlags.Const */);
2180
2268
  }
2181
2269
  function getEffectiveParameterDeclaration(symbol) {
2182
- const parameter = getDeclarationOfKind(symbol, 170 /* SyntaxKind.Parameter */);
2270
+ const parameter = getDeclarationOfKind(symbol, 171 /* SyntaxKind.Parameter */);
2183
2271
  if (parameter !== undefined)
2184
2272
  return parameter;
2185
2273
  if ((symbol.flags & 33554432 /* SymbolFlags.Transient */) === 0)
2186
- return getDeclarationOfKind(symbol, 333 /* SyntaxKind.JSDocParameterTag */);
2274
+ return getDeclarationOfKind(symbol, 334 /* SyntaxKind.JSDocParameterTag */);
2187
2275
  return undefined;
2188
2276
  }
2189
2277
  function isPropertyAccessEntityNameExpression(node) {
2190
- return node.kind === 212 /* SyntaxKind.PropertyAccessExpression */ && isEntityNameExpression(node, false);
2278
+ return node.kind === 213 /* SyntaxKind.PropertyAccessExpression */ && isEntityNameExpression(node, false);
2191
2279
  }
2192
2280
  /** Whether an existing type reference node can stand for `t`: JS `Foo` meaning `Foo<any>` can't. */
2193
2281
  export function canReuseExistingJSTypeNode(b, existing, t) {
@@ -2308,7 +2396,7 @@ class ComputedNameTracker extends NodeVisitor {
2308
2396
  this.b = b;
2309
2397
  }
2310
2398
  visitNode(node) {
2311
- if (node.kind === 168 /* SyntaxKind.ComputedPropertyName */ && isLateBindableName(this.b.c, node))
2399
+ if (node.kind === 169 /* SyntaxKind.ComputedPropertyName */ && isLateBindableName(this.b.c, node))
2312
2400
  this.b.trackComputedName(getExpression(node), this.b.enclosingDeclaration);
2313
2401
  return node.forEachChild(this);
2314
2402
  }
@@ -2394,13 +2482,13 @@ function containsUndefinedType(c, t) {
2394
2482
  }
2395
2483
  function isFunctionLikeDeclaration(node) {
2396
2484
  switch (node.kind) {
2397
- case 263 /* SyntaxKind.FunctionDeclaration */:
2398
- case 175 /* SyntaxKind.MethodDeclaration */:
2399
- case 177 /* SyntaxKind.Constructor */:
2400
- case 178 /* SyntaxKind.GetAccessor */:
2401
- case 179 /* SyntaxKind.SetAccessor */:
2402
- case 219 /* SyntaxKind.FunctionExpression */:
2403
- case 220 /* SyntaxKind.ArrowFunction */:
2485
+ case 264 /* SyntaxKind.FunctionDeclaration */:
2486
+ case 176 /* SyntaxKind.MethodDeclaration */:
2487
+ case 178 /* SyntaxKind.Constructor */:
2488
+ case 179 /* SyntaxKind.GetAccessor */:
2489
+ case 180 /* SyntaxKind.SetAccessor */:
2490
+ case 220 /* SyntaxKind.FunctionExpression */:
2491
+ case 221 /* SyntaxKind.ArrowFunction */:
2404
2492
  return true;
2405
2493
  }
2406
2494
  return false;
@@ -2461,9 +2549,9 @@ function expandSignatureParametersWithTupleMembers(c, signature, restType, restI
2461
2549
  const flags = tuple.elementInfos[i].flags;
2462
2550
  let checkFlags = 0 /* CheckFlags.None */;
2463
2551
  if ((flags & 12 /* ElementFlags.Variable */) !== 0)
2464
- checkFlags = 32768 /* CheckFlags.RestParameter */;
2552
+ checkFlags = 262144 /* CheckFlags.RestParameter */;
2465
2553
  else if ((flags & 2 /* ElementFlags.Optional */) !== 0)
2466
- checkFlags = 16384 /* CheckFlags.OptionalParameter */;
2554
+ checkFlags = 131072 /* CheckFlags.OptionalParameter */;
2467
2555
  const symbol = c.newSymbolWithCheckFlags(1 /* SymbolFlags.FunctionScopedVariable */, names[i], checkFlags);
2468
2556
  const elementType = elementTypes[i];
2469
2557
  c.symbolTypes.set(getSymbolId(symbol), (flags & 4 /* ElementFlags.Rest */) !== 0 ? createArrayType(c, elementType) : elementType);
@@ -2527,7 +2615,7 @@ function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
2527
2615
  return (elementFlags & 12 /* ElementFlags.Variable */) !== 0 ? text : text + '_' + index;
2528
2616
  return (elementFlags & 3 /* ElementFlags.Fixed */) !== 0 ? text : text + '_n';
2529
2617
  }
2530
- if (name.kind === 208 /* SyntaxKind.ArrayBindingPattern */ && hasDotDotDot) {
2618
+ if (name.kind === 209 /* SyntaxKind.ArrayBindingPattern */ && hasDotDotDot) {
2531
2619
  const elements = name.elements.nodes;
2532
2620
  const lastElement = elements.length > 0 ? elements[elements.length - 1] : undefined;
2533
2621
  const lastIsRest = lastElement instanceof BindingElement && lastElement.dotDotDotToken !== undefined;
@@ -2548,9 +2636,10 @@ function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
2548
2636
  * The type node TypeScript would write for `type`. As in tsgo, the builder has a pseudochecker, so types
2549
2637
  * of declarations are written from what the source wrote where that denotes the type.
2550
2638
  */
2551
- export function typeToTypeNode(c, type, enclosingDeclaration, flags, internalFlags = 0 /* NodeBuilderInternalFlags.None */, tracker = undefined) {
2639
+ export function typeToTypeNode(c, type, enclosingDeclaration, flags, internalFlags = 0 /* NodeBuilderInternalFlags.None */, tracker = undefined, idToSymbol = undefined) {
2552
2640
  const b = new NodeBuilder(c, enclosingDeclaration, flags, internalFlags, tracker);
2553
2641
  b.pseudo = newPseudoChecker(c);
2642
+ b.idToSymbol = idToSymbol;
2554
2643
  return b.finish(b.typeToTypeNode(type));
2555
2644
  }
2556
2645
  /** The declaration of kind `kind` TypeScript would write for `signature`, with a pseudochecker as `typeToTypeNode`. */