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
@@ -3,11 +3,12 @@
3
3
  // to, except where a property access of a const enum (or an enum member in an enum
4
4
  // initializer) is inlined. Without types, a property access through anything but an alias of a
5
5
  // namespace, enum or module counts as a use.
6
- import { BinaryExpression, ConditionalTypeNode, ExportAssignment, ExportDeclaration, ExportSpecifier, ForInOrOfStatement, ForStatement, HeritageClause, Identifier, ImportEqualsDeclaration, ImportTypeNode, LiteralTypeNode, MetaProperty, NodeVisitor, PropertyAccessExpression, QualifiedName, ShorthandPropertyAssignment, TypeParameterDeclaration, TypeReferenceNode, VariableDeclarationList, IntersectionTypeNode, UnionTypeNode, getDotDotDotToken, getExpression, getInitializer, getParameters, getTagName, getType, getTypeArguments, } from '../ast.js';
6
+ import { BinaryExpression, ComputedPropertyName, ConditionalTypeNode, ExportAssignment, ExportDeclaration, ExportSpecifier, ForInOrOfStatement, ForStatement, HeritageClause, Identifier, ImportEqualsDeclaration, ImportTypeNode, LiteralTypeNode, MetaProperty, NodeVisitor, PropertyAccessExpression, QualifiedName, ShorthandPropertyAssignment, TypeParameterDeclaration, TypeReferenceNode, VariableDeclarationList, IntersectionTypeNode, UnionTypeNode, getDotDotDotToken, getExpression, getHeritageClauses, getInitializer, getName, getParameters, getTagName, getType, getTypeArguments, } from '../ast.js';
7
7
  import { canHaveDecorators, isImportCall } from '../ast-utilities.js';
8
+ import { isAssignmentTarget, isClassLike } from '../binder-utilities.js';
8
9
  import { JsxEmit, getIsolatedModules, getStrictOptionValue, shouldPreserveConstEnums, } from '../options.js';
9
10
  import { getDeclarationOfAliasSymbol } from './reference-resolver.js';
10
- import { getFirstConstructorWithBody, getRestParameterElementType, getSetAccessorValueParameter, nodeCanBeDecorated, } from './decorator-utilities.js';
11
+ import { getFirstConstructorWithBody, getRestParameterElementType, getSetAccessorValueParameter, isAccessor, nodeCanBeDecorated, } from './decorator-utilities.js';
11
12
  import { hasDecorators, hasSyntacticModifier } from './utilities.js';
12
13
  import { getDeclarations } from '../symbol.js';
13
14
  export class AliasReferences extends NodeVisitor {
@@ -36,7 +37,7 @@ export class AliasReferences extends NodeVisitor {
36
37
  // Imports are marked by their uses.
37
38
  if (node instanceof ImportEqualsDeclaration && !hasSyntacticModifier(node, 32 /* ModifierFlags.Export */))
38
39
  return false;
39
- if (node.kind === 273 /* SyntaxKind.ImportDeclaration */ || node.kind === 346 /* SyntaxKind.JSImportDeclaration */)
40
+ if (node.kind === 274 /* SyntaxKind.ImportDeclaration */ || node.kind === 347 /* SyntaxKind.JSImportDeclaration */)
40
41
  return false;
41
42
  this.mark(node);
42
43
  node.forEachChild(this);
@@ -45,15 +46,20 @@ export class AliasReferences extends NodeVisitor {
45
46
  mark(node) {
46
47
  // Types and declaration files don't use imports, except decorated properties.
47
48
  if ((node.flags & 8388608 /* NodeFlags.Ambient */) !== 0 &&
48
- node.kind !== 172 /* SyntaxKind.PropertySignature */ &&
49
- node.kind !== 173 /* SyntaxKind.PropertyDeclaration */)
49
+ node.kind !== 173 /* SyntaxKind.PropertySignature */ &&
50
+ node.kind !== 174 /* SyntaxKind.PropertyDeclaration */)
51
+ return false;
52
+ // tsgo doesn't answer semantic questions inside a `with` statement.
53
+ if ((node.flags & 16777216 /* NodeFlags.InWithStatement */) !== 0)
50
54
  return false;
51
55
  if (node instanceof Identifier) {
52
56
  const parent = node.parent;
53
57
  if (parent === undefined ||
54
- !(isExpressionNode(node) ||
55
- parent instanceof ShorthandPropertyAssignment ||
56
- (parent instanceof ImportEqualsDeclaration && parent.moduleReference === node)) ||
58
+ isUnresolvedIdentifier(node, this.options.experimentalDecorators === true))
59
+ return false;
60
+ if (!(isExpressionNode(node) ||
61
+ parent instanceof ShorthandPropertyAssignment ||
62
+ (parent instanceof ImportEqualsDeclaration && parent.moduleReference === node)) ||
57
63
  !shouldMarkIdentifier(node))
58
64
  return false;
59
65
  // Only the left of a property access or qualified name; the right is a property lookup.
@@ -61,13 +67,13 @@ export class AliasReferences extends NodeVisitor {
61
67
  return false;
62
68
  if (parent instanceof QualifiedName && parent.left !== node)
63
69
  return false;
64
- if (isInsideMetaProperty(node))
65
- return false;
66
70
  return this.markIdentifier(node);
67
71
  }
68
- if (node.kind === 212 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 167 /* SyntaxKind.QualifiedName */) {
72
+ if (node.kind === 213 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.QualifiedName */) {
69
73
  for (let top = node; top !== undefined && isPropertyAccessOrQualifiedName(top); top = top.parent)
70
- if (isPartOfTypeNode(top))
74
+ // Names in an import type's qualifier, `ns.y` in `typeof import("./b").ns.y`, are exports of the
75
+ // imported module, not references to this file's imports.
76
+ if (isPartOfTypeNode(top) || isImportTypeQualifierPart(top))
71
77
  return false;
72
78
  return this.markProperty(node);
73
79
  }
@@ -81,9 +87,9 @@ export class AliasReferences extends NodeVisitor {
81
87
  return true;
82
88
  }
83
89
  switch (node.kind) {
84
- case 287 /* SyntaxKind.JsxOpeningElement */:
85
- case 286 /* SyntaxKind.JsxSelfClosingElement */:
86
- case 290 /* SyntaxKind.JsxOpeningFragment */:
90
+ case 288 /* SyntaxKind.JsxOpeningElement */:
91
+ case 287 /* SyntaxKind.JsxSelfClosingElement */:
92
+ case 291 /* SyntaxKind.JsxOpeningFragment */:
87
93
  return this.markJsx(node);
88
94
  }
89
95
  if (node instanceof ImportEqualsDeclaration) {
@@ -103,14 +109,14 @@ export class AliasReferences extends NodeVisitor {
103
109
  /** Type references that decorator metadata serializes as values use the aliases they name. */
104
110
  markDecoratorMetadata(node) {
105
111
  switch (node.kind) {
106
- case 264 /* SyntaxKind.ClassDeclaration */: {
112
+ case 265 /* SyntaxKind.ClassDeclaration */: {
107
113
  const constructor = getFirstConstructorWithBody(node);
108
114
  if (constructor !== undefined)
109
115
  this.markParameterTypes(constructor);
110
116
  break;
111
117
  }
112
- case 178 /* SyntaxKind.GetAccessor */:
113
- case 179 /* SyntaxKind.SetAccessor */: {
118
+ case 179 /* SyntaxKind.GetAccessor */:
119
+ case 180 /* SyntaxKind.SetAccessor */: {
114
120
  let annotation = getAnnotatedAccessorTypeNode(node);
115
121
  if (annotation === undefined) {
116
122
  const other = this.getOtherAccessor(node);
@@ -120,14 +126,14 @@ export class AliasReferences extends NodeVisitor {
120
126
  this.markMetadataTypeNode(annotation);
121
127
  break;
122
128
  }
123
- case 175 /* SyntaxKind.MethodDeclaration */:
129
+ case 176 /* SyntaxKind.MethodDeclaration */:
124
130
  this.markParameterTypes(node);
125
131
  this.markMetadataTypeNode(getType(node));
126
132
  break;
127
- case 173 /* SyntaxKind.PropertyDeclaration */:
133
+ case 174 /* SyntaxKind.PropertyDeclaration */:
128
134
  this.markMetadataTypeNode(getType(node));
129
135
  break;
130
- case 170 /* SyntaxKind.Parameter */:
136
+ case 171 /* SyntaxKind.Parameter */:
131
137
  this.markMetadataTypeNode(getParameterTypeNodeForDecoratorCheck(node));
132
138
  if (node.parent !== undefined) {
133
139
  this.markParameterTypes(node.parent);
@@ -149,7 +155,7 @@ export class AliasReferences extends NodeVisitor {
149
155
  const symbol = this.resolver.getSymbolOfDeclaration(node);
150
156
  if (symbol === undefined)
151
157
  return undefined;
152
- const kind = node.kind === 179 /* SyntaxKind.SetAccessor */ ? 178 /* SyntaxKind.GetAccessor */ : 179 /* SyntaxKind.SetAccessor */;
158
+ const kind = node.kind === 180 /* SyntaxKind.SetAccessor */ ? 179 /* SyntaxKind.GetAccessor */ : 180 /* SyntaxKind.SetAccessor */;
153
159
  for (const declaration of getDeclarations(symbol))
154
160
  if (declaration.kind === kind)
155
161
  return declaration;
@@ -176,17 +182,17 @@ export class AliasReferences extends NodeVisitor {
176
182
  if (node === undefined)
177
183
  return undefined;
178
184
  switch (node.kind) {
179
- case 194 /* SyntaxKind.IntersectionType */:
180
- case 193 /* SyntaxKind.UnionType */:
185
+ case 195 /* SyntaxKind.IntersectionType */:
186
+ case 194 /* SyntaxKind.UnionType */:
181
187
  return this.getEntityNameForDecoratorMetadataFromTypeList(getTypes(node));
182
- case 195 /* SyntaxKind.ConditionalType */:
188
+ case 196 /* SyntaxKind.ConditionalType */:
183
189
  if (node instanceof ConditionalTypeNode)
184
190
  return this.getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
185
191
  break;
186
- case 197 /* SyntaxKind.ParenthesizedType */:
187
- case 203 /* SyntaxKind.NamedTupleMember */:
192
+ case 198 /* SyntaxKind.ParenthesizedType */:
193
+ case 204 /* SyntaxKind.NamedTupleMember */:
188
194
  return this.getEntityNameForDecoratorMetadata(getType(node));
189
- case 184 /* SyntaxKind.TypeReference */:
195
+ case 185 /* SyntaxKind.TypeReference */:
190
196
  if (node instanceof TypeReferenceNode)
191
197
  return node.typeName;
192
198
  break;
@@ -244,7 +250,7 @@ export class AliasReferences extends NodeVisitor {
244
250
  this.referenced.add(symbol);
245
251
  const declaration = getDeclarationOfAliasSymbol(symbol);
246
252
  if (declaration instanceof ImportEqualsDeclaration &&
247
- declaration.moduleReference.kind !== 284 /* SyntaxKind.ExternalModuleReference */) {
253
+ declaration.moduleReference.kind !== 285 /* SyntaxKind.ExternalModuleReference */) {
248
254
  const target = this.resolver.resolveAlias(symbol);
249
255
  const flags = target === undefined ? 4 /* SymbolFlags.Property */ : this.resolver.getSymbolFlags(target, false, false);
250
256
  if ((flags & 111551 /* SymbolFlags.Value */) !== 0)
@@ -271,7 +277,7 @@ export class AliasReferences extends NodeVisitor {
271
277
  (isConstEnumOrConstEnumOnlyModule(property) ||
272
278
  ((property.flags & 8 /* SymbolFlags.EnumMember */) !== 0 &&
273
279
  node.parent !== undefined &&
274
- node.parent.kind === 306 /* SyntaxKind.EnumMember */)))
280
+ node.parent.kind === 307 /* SyntaxKind.EnumMember */)))
275
281
  return false;
276
282
  return this.markAlias(parentSymbol, node);
277
283
  }
@@ -288,7 +294,7 @@ export class AliasReferences extends NodeVisitor {
288
294
  markJsx(node) {
289
295
  if (this.jsxRuntimeResolved)
290
296
  return false;
291
- const fragment = node.kind === 290 /* SyntaxKind.JsxOpeningFragment */;
297
+ const fragment = node.kind === 291 /* SyntaxKind.JsxOpeningFragment */;
292
298
  const location = fragment ? node : jsxTagName(node);
293
299
  const namespace = fragment ? this.jsxFragmentNamespace : this.jsxNamespace;
294
300
  // `@jsxFrag null` has no fragment factory.
@@ -337,8 +343,18 @@ export class AliasReferences extends NodeVisitor {
337
343
  return true;
338
344
  }
339
345
  }
346
+ /** Whether `node` is the qualifier of an import type, or a part of one. */
347
+ function isImportTypeQualifierPart(node) {
348
+ let current = node;
349
+ let parent = current.parent;
350
+ while (parent !== undefined && parent.kind === 168 /* SyntaxKind.QualifiedName */) {
351
+ current = parent;
352
+ parent = parent.parent;
353
+ }
354
+ return parent instanceof ImportTypeNode && parent.qualifier === current;
355
+ }
340
356
  function isPropertyAccessOrQualifiedName(node) {
341
- return node.kind === 212 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 167 /* SyntaxKind.QualifiedName */;
357
+ return node.kind === 213 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.QualifiedName */;
342
358
  }
343
359
  function leftOf(node) {
344
360
  if (node instanceof PropertyAccessExpression)
@@ -372,17 +388,105 @@ function shouldMarkIdentifier(node) {
372
388
  const exportDeclaration = grandparent === undefined ? undefined : grandparent.parent;
373
389
  return !(exportDeclaration instanceof ExportDeclaration && exportDeclaration.isTypeOnly);
374
390
  }
375
- function isInsideMetaProperty(node) {
376
- for (let current = node; current !== undefined; current = current.parent)
391
+ /**
392
+ * Whether checking never resolves identifier `node`, so tsgo doesn't mark it: in a meta property, the name of a
393
+ * shorthand property with an initializer outside a destructuring assignment, in a decorator of a node that can't be
394
+ * decorated, in the expression of `for (var of x)`, in an invalid computed property name, in an interface's heritage
395
+ * clause, or in a class's `extends` types after the first.
396
+ */
397
+ function isUnresolvedIdentifier(node, legacyDecorators) {
398
+ const parent = node.parent;
399
+ if (parent instanceof ShorthandPropertyAssignment &&
400
+ parent.name === node &&
401
+ parent.objectAssignmentInitializer !== undefined &&
402
+ !isAssignmentTarget(parent.parent))
403
+ return true;
404
+ let decorator = undefined;
405
+ let forNode = undefined;
406
+ let computedName = undefined;
407
+ let heritageClause = undefined;
408
+ for (let current = node; current !== undefined; current = current.parent) {
377
409
  if (current instanceof MetaProperty)
378
410
  return true;
411
+ if (current.kind === 172 /* SyntaxKind.Decorator */) {
412
+ if (decorator === undefined)
413
+ decorator = current;
414
+ }
415
+ else if (current instanceof ForInOrOfStatement) {
416
+ if (forNode === undefined)
417
+ forNode = current;
418
+ }
419
+ else if (current instanceof ComputedPropertyName) {
420
+ if (computedName === undefined)
421
+ computedName = current;
422
+ }
423
+ else if (current instanceof HeritageClause) {
424
+ if (heritageClause === undefined)
425
+ heritageClause = current;
426
+ }
427
+ }
428
+ if (decorator !== undefined) {
429
+ const decorated = decorator.parent;
430
+ if (decorated !== undefined &&
431
+ !nodeCanBeDecorated(legacyDecorators, decorated, decorated.parent, decorated.parent === undefined ? undefined : decorated.parent.parent))
432
+ return true;
433
+ }
434
+ if (forNode !== undefined) {
435
+ const statement = forNode;
436
+ if (statement.initializer instanceof VariableDeclarationList &&
437
+ statement.initializer.declarations.nodes.length === 0 &&
438
+ (node === statement.expression || isNodeDescendantOf(node, statement.expression)))
439
+ return true;
440
+ }
441
+ if (computedName !== undefined) {
442
+ const grandparent = computedName.parent.parent;
443
+ if ((grandparent.kind === 189 /* SyntaxKind.TypeLiteral */ ||
444
+ isClassLike(grandparent) ||
445
+ grandparent.kind === 266 /* SyntaxKind.InterfaceDeclaration */) &&
446
+ computedName.expression instanceof BinaryExpression &&
447
+ computedName.expression.operatorToken.kind ===
448
+ 102 /* SyntaxKind.InKeyword */ &&
449
+ !isAccessor(computedName.parent))
450
+ return true;
451
+ }
452
+ if (heritageClause !== undefined) {
453
+ const declaration = heritageClause.parent;
454
+ // An interface's heritage clauses are types.
455
+ if (declaration.kind === 266 /* SyntaxKind.InterfaceDeclaration */)
456
+ return true;
457
+ // Only a class's first `extends` type is its base class; checking never resolves the others.
458
+ if (isClassLike(declaration) && heritageClause.token === 95 /* SyntaxKind.ExtendsKeyword */) {
459
+ const first = getClassExtendsHeritageElement(declaration);
460
+ if (first !== undefined && node !== first && !isNodeDescendantOf(node, first))
461
+ return true;
462
+ }
463
+ }
464
+ return false;
465
+ }
466
+ /** The first type of a class's first `extends` clause. */
467
+ function getClassExtendsHeritageElement(node) {
468
+ const clauses = getHeritageClauses(node);
469
+ if (clauses === undefined)
470
+ return undefined;
471
+ for (const clause of clauses.nodes)
472
+ if (clause.token === 95 /* SyntaxKind.ExtendsKeyword */) {
473
+ const types = clause.types.nodes;
474
+ return types.length > 0 ? types[0] : undefined;
475
+ }
476
+ return undefined;
477
+ }
478
+ /** Whether `node` is inside `ancestor`. */
479
+ function isNodeDescendantOf(node, ancestor) {
480
+ for (let current = node.parent; current !== undefined; current = current.parent)
481
+ if (current === ancestor)
482
+ return true;
379
483
  return false;
380
484
  }
381
485
  function isInTypeQuery(node) {
382
486
  for (let current = node; current !== undefined; current = current.parent) {
383
- if (current.kind === 187 /* SyntaxKind.TypeQuery */)
487
+ if (current.kind === 188 /* SyntaxKind.TypeQuery */)
384
488
  return true;
385
- if (current.kind !== 79 /* SyntaxKind.Identifier */ && current.kind !== 167 /* SyntaxKind.QualifiedName */)
489
+ if (current.kind !== 79 /* SyntaxKind.Identifier */ && current.kind !== 168 /* SyntaxKind.QualifiedName */)
386
490
  return false;
387
491
  }
388
492
  return false;
@@ -440,49 +544,49 @@ export function isExpressionNode(node) {
440
544
  case 111 /* SyntaxKind.TrueKeyword */:
441
545
  case 96 /* SyntaxKind.FalseKeyword */:
442
546
  case 13 /* SyntaxKind.RegularExpressionLiteral */:
443
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
444
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
445
- case 212 /* SyntaxKind.PropertyAccessExpression */:
446
- case 213 /* SyntaxKind.ElementAccessExpression */:
447
- case 214 /* SyntaxKind.CallExpression */:
448
- case 215 /* SyntaxKind.NewExpression */:
449
- case 216 /* SyntaxKind.TaggedTemplateExpression */:
450
- case 235 /* SyntaxKind.AsExpression */:
451
- case 217 /* SyntaxKind.TypeAssertionExpression */:
452
- case 239 /* SyntaxKind.SatisfiesExpression */:
453
- case 236 /* SyntaxKind.NonNullExpression */:
454
- case 218 /* SyntaxKind.ParenthesizedExpression */:
455
- case 219 /* SyntaxKind.FunctionExpression */:
456
- case 232 /* SyntaxKind.ClassExpression */:
457
- case 220 /* SyntaxKind.ArrowFunction */:
458
- case 223 /* SyntaxKind.VoidExpression */:
459
- case 221 /* SyntaxKind.DeleteExpression */:
460
- case 222 /* SyntaxKind.TypeOfExpression */:
461
- case 225 /* SyntaxKind.PrefixUnaryExpression */:
462
- case 226 /* SyntaxKind.PostfixUnaryExpression */:
463
- case 227 /* SyntaxKind.BinaryExpression */:
464
- case 228 /* SyntaxKind.ConditionalExpression */:
465
- case 231 /* SyntaxKind.SpreadElement */:
466
- case 229 /* SyntaxKind.TemplateExpression */:
467
- case 233 /* SyntaxKind.OmittedExpression */:
468
- case 285 /* SyntaxKind.JsxElement */:
469
- case 286 /* SyntaxKind.JsxSelfClosingElement */:
470
- case 289 /* SyntaxKind.JsxFragment */:
471
- case 230 /* SyntaxKind.YieldExpression */:
472
- case 224 /* SyntaxKind.AwaitExpression */:
547
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
548
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
549
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
550
+ case 214 /* SyntaxKind.ElementAccessExpression */:
551
+ case 215 /* SyntaxKind.CallExpression */:
552
+ case 216 /* SyntaxKind.NewExpression */:
553
+ case 217 /* SyntaxKind.TaggedTemplateExpression */:
554
+ case 236 /* SyntaxKind.AsExpression */:
555
+ case 218 /* SyntaxKind.TypeAssertionExpression */:
556
+ case 240 /* SyntaxKind.SatisfiesExpression */:
557
+ case 237 /* SyntaxKind.NonNullExpression */:
558
+ case 219 /* SyntaxKind.ParenthesizedExpression */:
559
+ case 220 /* SyntaxKind.FunctionExpression */:
560
+ case 233 /* SyntaxKind.ClassExpression */:
561
+ case 221 /* SyntaxKind.ArrowFunction */:
562
+ case 224 /* SyntaxKind.VoidExpression */:
563
+ case 222 /* SyntaxKind.DeleteExpression */:
564
+ case 223 /* SyntaxKind.TypeOfExpression */:
565
+ case 226 /* SyntaxKind.PrefixUnaryExpression */:
566
+ case 227 /* SyntaxKind.PostfixUnaryExpression */:
567
+ case 228 /* SyntaxKind.BinaryExpression */:
568
+ case 229 /* SyntaxKind.ConditionalExpression */:
569
+ case 232 /* SyntaxKind.SpreadElement */:
570
+ case 230 /* SyntaxKind.TemplateExpression */:
571
+ case 234 /* SyntaxKind.OmittedExpression */:
572
+ case 286 /* SyntaxKind.JsxElement */:
573
+ case 287 /* SyntaxKind.JsxSelfClosingElement */:
574
+ case 290 /* SyntaxKind.JsxFragment */:
575
+ case 231 /* SyntaxKind.YieldExpression */:
576
+ case 225 /* SyntaxKind.AwaitExpression */:
473
577
  return true;
474
- case 237 /* SyntaxKind.MetaProperty */: {
578
+ case 238 /* SyntaxKind.MetaProperty */: {
475
579
  const parent = node.parent;
476
580
  return !(parent !== undefined && isImportCall(parent) && getExpression(parent) === node);
477
581
  }
478
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
582
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
479
583
  return !(node.parent instanceof HeritageClause);
480
- case 167 /* SyntaxKind.QualifiedName */: {
584
+ case 168 /* SyntaxKind.QualifiedName */: {
481
585
  let current = node;
482
- while (current.parent !== undefined && current.parent.kind === 167 /* SyntaxKind.QualifiedName */)
586
+ while (current.parent !== undefined && current.parent.kind === 168 /* SyntaxKind.QualifiedName */)
483
587
  current = current.parent;
484
588
  const parent = current.parent;
485
- return parent !== undefined && (parent.kind === 187 /* SyntaxKind.TypeQuery */ || isJsxTagName(current));
589
+ return parent !== undefined && (parent.kind === 188 /* SyntaxKind.TypeQuery */ || isJsxTagName(current));
486
590
  }
487
591
  case 80 /* SyntaxKind.PrivateIdentifier */: {
488
592
  const parent = node.parent;
@@ -490,7 +594,7 @@ export function isExpressionNode(node) {
490
594
  }
491
595
  case 79 /* SyntaxKind.Identifier */: {
492
596
  const parent = node.parent;
493
- if (parent !== undefined && (parent.kind === 187 /* SyntaxKind.TypeQuery */ || isJsxTagName(node)))
597
+ if (parent !== undefined && (parent.kind === 188 /* SyntaxKind.TypeQuery */ || isJsxTagName(node)))
494
598
  return true;
495
599
  return isInExpressionContext(node);
496
600
  }
@@ -508,51 +612,55 @@ function isInExpressionContext(node) {
508
612
  if (parent === undefined)
509
613
  return false;
510
614
  switch (parent.kind) {
511
- case 261 /* SyntaxKind.VariableDeclaration */:
512
- case 170 /* SyntaxKind.Parameter */:
513
- case 173 /* SyntaxKind.PropertyDeclaration */:
514
- case 172 /* SyntaxKind.PropertySignature */:
515
- case 306 /* SyntaxKind.EnumMember */:
516
- case 303 /* SyntaxKind.PropertyAssignment */:
517
- case 209 /* SyntaxKind.BindingElement */:
615
+ case 262 /* SyntaxKind.VariableDeclaration */:
616
+ case 171 /* SyntaxKind.Parameter */:
617
+ case 174 /* SyntaxKind.PropertyDeclaration */:
618
+ case 173 /* SyntaxKind.PropertySignature */:
619
+ case 307 /* SyntaxKind.EnumMember */:
620
+ case 304 /* SyntaxKind.PropertyAssignment */:
621
+ case 210 /* SyntaxKind.BindingElement */:
518
622
  return getInitializer(parent) === node;
519
- case 245 /* SyntaxKind.ExpressionStatement */:
520
- case 246 /* SyntaxKind.IfStatement */:
521
- case 247 /* SyntaxKind.DoStatement */:
522
- case 248 /* SyntaxKind.WhileStatement */:
523
- case 254 /* SyntaxKind.ReturnStatement */:
524
- case 255 /* SyntaxKind.WithStatement */:
525
- case 256 /* SyntaxKind.SwitchStatement */:
526
- case 297 /* SyntaxKind.CaseClause */:
527
- case 298 /* SyntaxKind.DefaultClause */:
528
- case 258 /* SyntaxKind.ThrowStatement */:
529
- case 217 /* SyntaxKind.TypeAssertionExpression */:
530
- case 235 /* SyntaxKind.AsExpression */:
531
- case 240 /* SyntaxKind.TemplateSpan */:
532
- case 168 /* SyntaxKind.ComputedPropertyName */:
533
- case 239 /* SyntaxKind.SatisfiesExpression */:
623
+ case 246 /* SyntaxKind.ExpressionStatement */:
624
+ case 247 /* SyntaxKind.IfStatement */:
625
+ case 248 /* SyntaxKind.DoStatement */:
626
+ case 249 /* SyntaxKind.WhileStatement */:
627
+ case 255 /* SyntaxKind.ReturnStatement */:
628
+ case 256 /* SyntaxKind.WithStatement */:
629
+ case 257 /* SyntaxKind.SwitchStatement */:
630
+ case 298 /* SyntaxKind.CaseClause */:
631
+ case 299 /* SyntaxKind.DefaultClause */:
632
+ case 259 /* SyntaxKind.ThrowStatement */:
633
+ case 218 /* SyntaxKind.TypeAssertionExpression */:
634
+ case 236 /* SyntaxKind.AsExpression */:
635
+ case 241 /* SyntaxKind.TemplateSpan */:
636
+ case 169 /* SyntaxKind.ComputedPropertyName */:
637
+ case 240 /* SyntaxKind.SatisfiesExpression */:
534
638
  return getExpression(parent) === node;
535
- case 249 /* SyntaxKind.ForStatement */:
639
+ case 250 /* SyntaxKind.ForStatement */:
536
640
  if (!(parent instanceof ForStatement))
537
641
  return false;
538
642
  return ((parent.initializer === node && !(parent.initializer instanceof VariableDeclarationList)) ||
539
643
  parent.condition === node ||
540
644
  parent.incrementor === node);
541
- case 250 /* SyntaxKind.ForInStatement */:
542
- case 251 /* SyntaxKind.ForOfStatement */:
645
+ case 251 /* SyntaxKind.ForInStatement */:
646
+ case 252 /* SyntaxKind.ForOfStatement */:
543
647
  if (!(parent instanceof ForInOrOfStatement))
544
648
  return false;
545
649
  return ((parent.initializer === node && !(parent.initializer instanceof VariableDeclarationList)) ||
546
650
  parent.expression === node);
547
- case 171 /* SyntaxKind.Decorator */:
548
- case 295 /* SyntaxKind.JsxExpression */:
549
- case 294 /* SyntaxKind.JsxSpreadAttribute */:
550
- case 305 /* SyntaxKind.SpreadAssignment */:
651
+ case 172 /* SyntaxKind.Decorator */:
652
+ case 296 /* SyntaxKind.JsxExpression */:
653
+ case 295 /* SyntaxKind.JsxSpreadAttribute */:
654
+ case 306 /* SyntaxKind.SpreadAssignment */:
551
655
  return true;
552
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
656
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
553
657
  return getExpression(parent) === node && !isPartOfTypeNode(parent);
554
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
658
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
555
659
  return parent instanceof ShorthandPropertyAssignment && parent.objectAssignmentInitializer === node;
660
+ case 220 /* SyntaxKind.FunctionExpression */:
661
+ case 233 /* SyntaxKind.ClassExpression */:
662
+ // The name of a function or class expression is a declaration name, not an expression.
663
+ return getName(parent) !== node;
556
664
  }
557
665
  return isExpressionNode(parent);
558
666
  }
@@ -561,16 +669,16 @@ function isJsxTagName(node) {
561
669
  if (parent === undefined)
562
670
  return false;
563
671
  switch (parent.kind) {
564
- case 287 /* SyntaxKind.JsxOpeningElement */:
565
- case 286 /* SyntaxKind.JsxSelfClosingElement */:
566
- case 288 /* SyntaxKind.JsxClosingElement */:
672
+ case 288 /* SyntaxKind.JsxOpeningElement */:
673
+ case 287 /* SyntaxKind.JsxSelfClosingElement */:
674
+ case 289 /* SyntaxKind.JsxClosingElement */:
567
675
  return getTagName(parent) === node;
568
676
  }
569
677
  return false;
570
678
  }
571
679
  export function isPartOfTypeNode(node) {
572
680
  const kind = node.kind;
573
- if (kind >= 183 /* SyntaxKind.FirstTypeNode */ && kind <= 206 /* SyntaxKind.LastTypeNode */)
681
+ if (kind >= 184 /* SyntaxKind.FirstTypeNode */ && kind <= 207 /* SyntaxKind.LastTypeNode */)
574
682
  return true;
575
683
  switch (kind) {
576
684
  case 132 /* SyntaxKind.AnyKeyword */:
@@ -586,12 +694,12 @@ export function isPartOfTypeNode(node) {
586
694
  case 146 /* SyntaxKind.NeverKeyword */:
587
695
  return true;
588
696
  case 115 /* SyntaxKind.VoidKeyword */:
589
- return node.parent !== undefined && node.parent.kind !== 223 /* SyntaxKind.VoidExpression */;
590
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
697
+ return node.parent !== undefined && node.parent.kind !== 224 /* SyntaxKind.VoidExpression */;
698
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
591
699
  return isPartOfTypeExpressionWithTypeArguments(node);
592
- case 169 /* SyntaxKind.TypeParameter */:
700
+ case 170 /* SyntaxKind.TypeParameter */:
593
701
  return (node.parent !== undefined &&
594
- (node.parent.kind === 201 /* SyntaxKind.MappedType */ || node.parent.kind === 196 /* SyntaxKind.InferType */));
702
+ (node.parent.kind === 202 /* SyntaxKind.MappedType */ || node.parent.kind === 197 /* SyntaxKind.InferType */));
595
703
  case 79 /* SyntaxKind.Identifier */: {
596
704
  const parent = node.parent;
597
705
  if (parent instanceof QualifiedName && parent.right === node)
@@ -600,8 +708,8 @@ export function isPartOfTypeNode(node) {
600
708
  return isPartOfTypeNodeInParent(parent);
601
709
  return isPartOfTypeNodeInParent(node);
602
710
  }
603
- case 167 /* SyntaxKind.QualifiedName */:
604
- case 212 /* SyntaxKind.PropertyAccessExpression */:
711
+ case 168 /* SyntaxKind.QualifiedName */:
712
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
605
713
  case 109 /* SyntaxKind.ThisKeyword */:
606
714
  return isPartOfTypeNodeInParent(node);
607
715
  }
@@ -609,37 +717,37 @@ export function isPartOfTypeNode(node) {
609
717
  }
610
718
  function isPartOfTypeNodeInParent(node) {
611
719
  const parent = node.parent;
612
- if (parent === undefined || parent.kind === 187 /* SyntaxKind.TypeQuery */)
720
+ if (parent === undefined || parent.kind === 188 /* SyntaxKind.TypeQuery */)
613
721
  return false;
614
722
  if (parent instanceof ImportTypeNode)
615
723
  return !parent.isTypeOf;
616
- if (parent.kind >= 183 /* SyntaxKind.FirstTypeNode */ && parent.kind <= 206 /* SyntaxKind.LastTypeNode */)
724
+ if (parent.kind >= 184 /* SyntaxKind.FirstTypeNode */ && parent.kind <= 207 /* SyntaxKind.LastTypeNode */)
617
725
  return true;
618
726
  switch (parent.kind) {
619
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
727
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
620
728
  return isPartOfTypeExpressionWithTypeArguments(parent);
621
- case 169 /* SyntaxKind.TypeParameter */:
729
+ case 170 /* SyntaxKind.TypeParameter */:
622
730
  return parent instanceof TypeParameterDeclaration && parent.constraint === node;
623
- case 261 /* SyntaxKind.VariableDeclaration */:
624
- case 170 /* SyntaxKind.Parameter */:
625
- case 173 /* SyntaxKind.PropertyDeclaration */:
626
- case 172 /* SyntaxKind.PropertySignature */:
627
- case 263 /* SyntaxKind.FunctionDeclaration */:
628
- case 219 /* SyntaxKind.FunctionExpression */:
629
- case 220 /* SyntaxKind.ArrowFunction */:
630
- case 177 /* SyntaxKind.Constructor */:
631
- case 175 /* SyntaxKind.MethodDeclaration */:
632
- case 174 /* SyntaxKind.MethodSignature */:
633
- case 178 /* SyntaxKind.GetAccessor */:
634
- case 179 /* SyntaxKind.SetAccessor */:
635
- case 180 /* SyntaxKind.CallSignature */:
636
- case 181 /* SyntaxKind.ConstructSignature */:
637
- case 182 /* SyntaxKind.IndexSignature */:
638
- case 217 /* SyntaxKind.TypeAssertionExpression */:
731
+ case 262 /* SyntaxKind.VariableDeclaration */:
732
+ case 171 /* SyntaxKind.Parameter */:
733
+ case 174 /* SyntaxKind.PropertyDeclaration */:
734
+ case 173 /* SyntaxKind.PropertySignature */:
735
+ case 264 /* SyntaxKind.FunctionDeclaration */:
736
+ case 220 /* SyntaxKind.FunctionExpression */:
737
+ case 221 /* SyntaxKind.ArrowFunction */:
738
+ case 178 /* SyntaxKind.Constructor */:
739
+ case 176 /* SyntaxKind.MethodDeclaration */:
740
+ case 175 /* SyntaxKind.MethodSignature */:
741
+ case 179 /* SyntaxKind.GetAccessor */:
742
+ case 180 /* SyntaxKind.SetAccessor */:
743
+ case 181 /* SyntaxKind.CallSignature */:
744
+ case 182 /* SyntaxKind.ConstructSignature */:
745
+ case 183 /* SyntaxKind.IndexSignature */:
746
+ case 218 /* SyntaxKind.TypeAssertionExpression */:
639
747
  return getType(parent) === node;
640
- case 214 /* SyntaxKind.CallExpression */:
641
- case 215 /* SyntaxKind.NewExpression */:
642
- case 216 /* SyntaxKind.TaggedTemplateExpression */: {
748
+ case 215 /* SyntaxKind.CallExpression */:
749
+ case 216 /* SyntaxKind.NewExpression */:
750
+ case 217 /* SyntaxKind.TaggedTemplateExpression */: {
643
751
  const typeArguments = getTypeArguments(parent);
644
752
  return typeArguments !== undefined && typeArguments.nodes.indexOf(node) >= 0;
645
753
  }
@@ -651,11 +759,11 @@ function isPartOfTypeExpressionWithTypeArguments(node) {
651
759
  if (parent instanceof HeritageClause) {
652
760
  const container = parent.parent;
653
761
  const classLike = container !== undefined &&
654
- (container.kind === 264 /* SyntaxKind.ClassDeclaration */ || container.kind === 232 /* SyntaxKind.ClassExpression */);
762
+ (container.kind === 265 /* SyntaxKind.ClassDeclaration */ || container.kind === 233 /* SyntaxKind.ClassExpression */);
655
763
  return !classLike || parent.token === 118 /* SyntaxKind.ImplementsKeyword */;
656
764
  }
657
765
  return (parent !== undefined &&
658
- (parent.kind === 324 /* SyntaxKind.JSDocImplementsTag */ || parent.kind === 323 /* SyntaxKind.JSDocAugmentsTag */));
766
+ (parent.kind === 325 /* SyntaxKind.JSDocImplementsTag */ || parent.kind === 324 /* SyntaxKind.JSDocAugmentsTag */));
659
767
  }
660
768
  function getParameterTypeNodeForDecoratorCheck(node) {
661
769
  const type = getType(node);
@@ -663,7 +771,7 @@ function getParameterTypeNodeForDecoratorCheck(node) {
663
771
  }
664
772
  /** The type annotation of a getter, or of a setter's parameter. */
665
773
  function getAnnotatedAccessorTypeNode(node) {
666
- if (node.kind === 178 /* SyntaxKind.GetAccessor */)
774
+ if (node.kind === 179 /* SyntaxKind.GetAccessor */)
667
775
  return getType(node);
668
776
  const parameter = getSetAccessorValueParameter(node);
669
777
  return parameter === undefined ? undefined : getType(parameter);