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
@@ -53,10 +53,10 @@ export function checkPrefixUnaryExpression(c, node) {
53
53
  case 54 /* SyntaxKind.TildeToken */:
54
54
  checkNonNullType(c, operandType, node.operand);
55
55
  if (maybeTypeOfKindConsideringBaseConstraint(c, operandType, 16896 /* TypeFlags.ESSymbolLike */))
56
- c.error(node.operand, 635 /* Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol */, tokenToString(node.operator));
56
+ c.error(node.operand, 642 /* Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol */, tokenToString(node.operator));
57
57
  if (node.operator === 39 /* SyntaxKind.PlusToken */) {
58
58
  if (maybeTypeOfKindConsideringBaseConstraint(c, operandType, 4224 /* TypeFlags.BigIntLike */))
59
- c.error(node.operand, 868 /* Diagnostics.Operator_0_cannot_be_applied_to_type_1 */, tokenToString(node.operator), typeToString(c, getBaseTypeOfLiteralType(c, operandType)));
59
+ c.error(node.operand, 875 /* Diagnostics.Operator_0_cannot_be_applied_to_type_1 */, tokenToString(node.operator), typeToString(c, getBaseTypeOfLiteralType(c, operandType)));
60
60
  return c.numberType;
61
61
  }
62
62
  return getUnaryResultType(c, operandType);
@@ -84,10 +84,10 @@ export function checkPostfixUnaryExpression(c, node) {
84
84
  return getUnaryResultType(c, operandType);
85
85
  }
86
86
  function checkIncrementOperand(c, operand, operandType) {
87
- const ok = checkArithmeticOperandType(c, operand, checkNonNullType(c, operandType, operand), 532 /* Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type */, false);
87
+ const ok = checkArithmeticOperandType(c, operand, checkNonNullType(c, operandType, operand), 539 /* Diagnostics.An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type */, false);
88
88
  // Only checked when the operand type is fine, to avoid cascading errors.
89
89
  if (ok)
90
- checkReferenceExpression(c, operand, 533 /* Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access */, 909 /* Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access */);
90
+ checkReferenceExpression(c, operand, 540 /* Diagnostics.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access */, 916 /* Diagnostics.The_operand_of_an_increment_or_decrement_operator_may_not_be_an_optional_property_access */);
91
91
  }
92
92
  function getUnaryResultType(c, operandType) {
93
93
  if (maybeTypeOfKind(operandType, 4224 /* TypeFlags.BigIntLike */)) {
@@ -102,17 +102,17 @@ export function checkDeleteExpression(c, node) {
102
102
  checkExpression(c, getExpression(node));
103
103
  const expr = skipParentheses(getExpression(node));
104
104
  if (!isAccessExpression(expr)) {
105
- c.error(expr, 835 /* Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference */);
105
+ c.error(expr, 842 /* Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference */);
106
106
  return c.booleanType;
107
107
  }
108
- if (expr.kind === 212 /* SyntaxKind.PropertyAccessExpression */ &&
108
+ if (expr.kind === 213 /* SyntaxKind.PropertyAccessExpression */ &&
109
109
  expr.name.kind === 80 /* SyntaxKind.PrivateIdentifier */)
110
- c.error(expr, 1833 /* Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier */);
110
+ c.error(expr, 1853 /* Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_private_identifier */);
111
111
  const resolved = c.resolvedSymbols.get(expr.id);
112
112
  if (resolved !== undefined) {
113
113
  const symbol = getExportSymbolOfValueSymbolIfExported(c, resolved);
114
114
  if (isReadonlySymbol(c, symbol))
115
- c.error(expr, 836 /* Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property */);
115
+ c.error(expr, 843 /* Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property */);
116
116
  else
117
117
  checkDeleteExpressionMustBeOptional(c, expr, symbol);
118
118
  }
@@ -126,7 +126,7 @@ function checkDeleteExpressionMustBeOptional(c, expr, symbol) {
126
126
  ? (symbol.flags & 16777216 /* SymbolFlags.Optional */) !== 0
127
127
  : hasTypeFacts(c, t, 16777216 /* TypeFacts.IsUndefined */);
128
128
  if (!isOptional)
129
- c.error(expr, 922 /* Diagnostics.The_operand_of_a_delete_operator_must_be_optional */);
129
+ c.error(expr, 929 /* Diagnostics.The_operand_of_a_delete_operator_must_be_optional */);
130
130
  }
131
131
  /** Reports a grammar error unless the file already has syntax errors. */
132
132
  export function grammarErrorOnNode(c, node, message, ...args) {
@@ -155,10 +155,11 @@ function isTypeAny(t) {
155
155
  return (t.flags & 1 /* TypeFlags.Any */) !== 0;
156
156
  }
157
157
  export function errorAndMaybeSuggestAwait(c, location, maybeMissingAwait, message, args) {
158
- const diagnostic = createDiagnosticForNode(location, message, args);
158
+ // The related information goes on the reported diagnostic after it is added, as tsgo attaches it,
159
+ // so a later equal report compares unequal to it and is kept.
160
+ const diagnostic = c.error(location, message, ...args);
159
161
  if (maybeMissingAwait)
160
- diagnostic.addRelatedInfo(createDiagnosticForNode(location, 905 /* Diagnostics.Did_you_forget_to_use_await */, []));
161
- c.addDiagnostic(diagnostic);
162
+ diagnostic.addRelatedInfo(createDiagnosticForNode(location, 912 /* Diagnostics.Did_you_forget_to_use_await */, []));
162
163
  return diagnostic;
163
164
  }
164
165
  function checkArithmeticOperandType(c, operand, t, message, isAwaitValid) {
@@ -183,24 +184,24 @@ export function checkReferenceExpression(c, expr, invalidReference, invalidOptio
183
184
  }
184
185
  function skipAssertionsAndParentheses(nodeIn) {
185
186
  let node = nodeIn;
186
- while (node.kind === 218 /* SyntaxKind.ParenthesizedExpression */ ||
187
- node.kind === 217 /* SyntaxKind.TypeAssertionExpression */ ||
188
- node.kind === 235 /* SyntaxKind.AsExpression */ ||
189
- node.kind === 239 /* SyntaxKind.SatisfiesExpression */ ||
190
- node.kind === 236 /* SyntaxKind.NonNullExpression */)
187
+ while (node.kind === 219 /* SyntaxKind.ParenthesizedExpression */ ||
188
+ node.kind === 218 /* SyntaxKind.TypeAssertionExpression */ ||
189
+ node.kind === 236 /* SyntaxKind.AsExpression */ ||
190
+ node.kind === 240 /* SyntaxKind.SatisfiesExpression */ ||
191
+ node.kind === 237 /* SyntaxKind.NonNullExpression */)
191
192
  node = getExpression(node);
192
193
  return node;
193
194
  }
194
195
  /** `node` without parentheses, type assertions, `satisfies` and non-null assertions. */
195
196
  export function skipOuterExpressions(nodeIn) {
196
197
  let node = nodeIn;
197
- while (node.kind === 218 /* SyntaxKind.ParenthesizedExpression */ ||
198
- node.kind === 217 /* SyntaxKind.TypeAssertionExpression */ ||
199
- node.kind === 235 /* SyntaxKind.AsExpression */ ||
200
- node.kind === 239 /* SyntaxKind.SatisfiesExpression */ ||
201
- node.kind === 236 /* SyntaxKind.NonNullExpression */ ||
202
- node.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */ ||
203
- node.kind === 348 /* SyntaxKind.PartiallyEmittedExpression */)
198
+ while (node.kind === 219 /* SyntaxKind.ParenthesizedExpression */ ||
199
+ node.kind === 218 /* SyntaxKind.TypeAssertionExpression */ ||
200
+ node.kind === 236 /* SyntaxKind.AsExpression */ ||
201
+ node.kind === 240 /* SyntaxKind.SatisfiesExpression */ ||
202
+ node.kind === 237 /* SyntaxKind.NonNullExpression */ ||
203
+ node.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */ ||
204
+ node.kind === 349 /* SyntaxKind.PartiallyEmittedExpression */)
204
205
  node = getExpression(node);
205
206
  return node;
206
207
  }
@@ -210,18 +211,18 @@ export function checkBinaryExpression(c, node, checkMode) {
210
211
  const right = node.right;
211
212
  const operator = node.operatorToken.kind;
212
213
  if (operator === 63 /* SyntaxKind.EqualsToken */ &&
213
- (left.kind === 211 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 210 /* SyntaxKind.ArrayLiteralExpression */))
214
+ (left.kind === 212 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 211 /* SyntaxKind.ArrayLiteralExpression */))
214
215
  return checkDestructuringAssignment(c, left, checkExpressionEx(c, right, checkMode), checkMode, right.kind === 109 /* SyntaxKind.ThisKeyword */);
215
216
  const leftType = checkExpressionEx(c, left, checkMode);
216
217
  const rightType = checkExpressionEx(c, right, checkMode);
217
218
  if (isLogicalOrCoalescingOperator(operator)) {
218
219
  let parent = node.parent;
219
- while (parent.kind === 218 /* SyntaxKind.ParenthesizedExpression */ ||
220
- (parent.kind === 227 /* SyntaxKind.BinaryExpression */ &&
220
+ while (parent.kind === 219 /* SyntaxKind.ParenthesizedExpression */ ||
221
+ (parent.kind === 228 /* SyntaxKind.BinaryExpression */ &&
221
222
  isLogicalOrCoalescingOperator(parent.operatorToken.kind)))
222
223
  parent = parent.parent;
223
- if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.kind === 246 /* SyntaxKind.IfStatement */)
224
- checkTestingKnownTruthyType(c, left, leftType, parent.kind === 246 /* SyntaxKind.IfStatement */ ? parent.thenStatement : undefined);
224
+ if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.kind === 247 /* SyntaxKind.IfStatement */)
225
+ checkTestingKnownTruthyType(c, left, leftType, parent.kind === 247 /* SyntaxKind.IfStatement */ ? parent.thenStatement : undefined);
225
226
  if (operator !== 60 /* SyntaxKind.QuestionQuestionToken */)
226
227
  checkTruthinessOfType(c, leftType, left);
227
228
  }
@@ -266,12 +267,12 @@ function checkBinaryLikeExpressionWorker(c, errorNode, left, operator, right, le
266
267
  if ((leftType.flags & 8448 /* TypeFlags.BooleanLike */) !== 0 && (rightType.flags & 8448 /* TypeFlags.BooleanLike */) !== 0) {
267
268
  const suggested = getSuggestedBooleanOperator(operator);
268
269
  if (suggested !== 0 /* SyntaxKind.Unknown */) {
269
- c.error(errorNode.operatorToken, 615 /* Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead */, tokenToString(operator), tokenToString(suggested));
270
+ c.error(errorNode.operatorToken, 622 /* Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead */, tokenToString(operator), tokenToString(suggested));
270
271
  return c.numberType;
271
272
  }
272
273
  }
273
- const leftOk = checkArithmeticOperandType(c, left, leftType, 536 /* Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type */, true);
274
- const rightOk = checkArithmeticOperandType(c, right, rightType, 537 /* Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type */, true);
274
+ const leftOk = checkArithmeticOperandType(c, left, leftType, 543 /* Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type */, true);
275
+ const rightOk = checkArithmeticOperandType(c, right, rightType, 544 /* Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type */, true);
275
276
  let resultType;
276
277
  if ((isTypeAssignableToKind(c, leftType, 3 /* TypeFlags.AnyOrUnknown */) &&
277
278
  isTypeAssignableToKind(c, rightType, 3 /* TypeFlags.AnyOrUnknown */)) ||
@@ -283,7 +284,7 @@ function checkBinaryLikeExpressionWorker(c, errorNode, left, operator, right, le
283
284
  reportOperatorError(c, leftType, operator, rightType, errorNode, 0 /* RelatedCheck.None */);
284
285
  else if ((operator === 42 /* SyntaxKind.AsteriskAsteriskToken */ || operator === 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */) &&
285
286
  c.languageVersion < ScriptTarget.ES2016)
286
- c.error(errorNode, 923 /* Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later */);
287
+ c.error(errorNode, 930 /* Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later */);
287
288
  resultType = c.bigintType;
288
289
  }
289
290
  else {
@@ -351,7 +352,7 @@ function checkBinaryLikeExpressionWorker(c, errorNode, left, operator, right, le
351
352
  operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ ||
352
353
  operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) {
353
354
  const eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
354
- c.error(errorNode, 961 /* Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value */, eqType ? 'false' : 'true');
355
+ c.error(errorNode, 968 /* Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value */, eqType ? 'false' : 'true');
355
356
  }
356
357
  checkNaNEquality(c, errorNode, operator, left, right);
357
358
  if (!isRelated(c, 4 /* RelatedCheck.EqualityComparable */, leftType, rightType))
@@ -402,7 +403,7 @@ function checkBinaryLikeExpressionWorker(c, errorNode, left, operator, right, le
402
403
  isSideEffectFree(left) &&
403
404
  !isIndirectCall(left.parent) &&
404
405
  !isInMultipleJsxRootsError(left))
405
- c.error(left, 827 /* Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects */);
406
+ c.error(left, 834 /* Diagnostics.Left_side_of_comma_operator_is_unused_and_has_no_side_effects */);
406
407
  return rightType;
407
408
  }
408
409
  return c.errorType;
@@ -412,7 +413,7 @@ function isInMultipleJsxRootsError(left) {
412
413
  const file = getSourceFileOfNode(left);
413
414
  const start = skipTrivia(file.text, left.pos);
414
415
  for (const d of file.diagnostics)
415
- if (d.message === 791 /* Diagnostics.JSX_expressions_must_have_one_parent_element */ && d.pos <= start && start < d.end)
416
+ if (d.message === 798 /* Diagnostics.JSX_expressions_must_have_one_parent_element */ && d.pos <= start && start < d.end)
416
417
  return true;
417
418
  return false;
418
419
  }
@@ -442,7 +443,7 @@ function checkForDisallowedESSymbolOperand(c, left, right, leftType, rightType,
442
443
  offending = right;
443
444
  if (offending === undefined)
444
445
  return true;
445
- c.error(offending, 635 /* Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol */, tokenToString(operator));
446
+ c.error(offending, 642 /* Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol */, tokenToString(operator));
446
447
  return false;
447
448
  }
448
449
  function isRelated(c, check, left, right) {
@@ -496,10 +497,10 @@ function reportOperatorError(c, leftType, operator, rightType, errorNode, check)
496
497
  case 34 /* SyntaxKind.EqualsEqualsToken */:
497
498
  case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */:
498
499
  case 35 /* SyntaxKind.ExclamationEqualsToken */:
499
- errorAndMaybeSuggestAwait(c, errorNode, wouldWorkWithAwait, 541 /* Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap */, [leftStr, rightStr]);
500
+ errorAndMaybeSuggestAwait(c, errorNode, wouldWorkWithAwait, 548 /* Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap */, [leftStr, rightStr]);
500
501
  return;
501
502
  }
502
- errorAndMaybeSuggestAwait(c, errorNode, wouldWorkWithAwait, 539 /* Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2 */, [tokenToString(operator), leftStr, rightStr]);
503
+ errorAndMaybeSuggestAwait(c, errorNode, wouldWorkWithAwait, 546 /* Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2 */, [tokenToString(operator), leftStr, rightStr]);
503
504
  }
504
505
  function checkAssignmentOperator(c, left, operator, right, leftType, rightType) {
505
506
  if (!isAssignmentOperator(operator))
@@ -510,30 +511,30 @@ function checkAssignmentOperator(c, left, operator, right, leftType, rightType)
510
511
  let targetType = leftType;
511
512
  if (operator >= 64 /* SyntaxKind.FirstCompoundAssignment */ &&
512
513
  operator <= 78 /* SyntaxKind.LastCompoundAssignment */ &&
513
- left.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
514
+ left.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
514
515
  targetType = checkPropertyAccessExpression(c, left, true);
515
516
  // Assignability is only checked when the target is a reference, to avoid cascading errors.
516
- if (checkReferenceExpression(c, left, 538 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access */, 911 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access */)) {
517
+ if (checkReferenceExpression(c, left, 545 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access */, 918 /* Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access */)) {
517
518
  let headMessage = undefined;
518
519
  if (c.exactOptionalPropertyTypes &&
519
- left.kind === 212 /* SyntaxKind.PropertyAccessExpression */ &&
520
+ left.kind === 213 /* SyntaxKind.PropertyAccessExpression */ &&
520
521
  maybeTypeOfKind(rightType, 4 /* TypeFlags.Undefined */)) {
521
522
  const access = left;
522
523
  const target = getTypeOfPropertyOfType(c, getTypeOfExpression(c, access.expression), getText(access.name));
523
524
  if (isExactOptionalPropertyMismatch(c, rightType, target))
524
525
  headMessage =
525
- 583 /* Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target */;
526
+ 590 /* Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target */;
526
527
  }
527
528
  checkTypeRelatedToAndOptionallyElaborate(c, rightType, targetType, c.assignableRelation, left, right, headMessage, undefined);
528
529
  }
529
530
  }
530
531
  function isLiteralExpressionOfObject(node) {
531
532
  switch (node.kind) {
532
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
533
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
533
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
534
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
534
535
  case 13 /* SyntaxKind.RegularExpressionLiteral */:
535
- case 232 /* SyntaxKind.ClassExpression */:
536
- case 219 /* SyntaxKind.FunctionExpression */:
536
+ case 233 /* SyntaxKind.ClassExpression */:
537
+ case 220 /* SyntaxKind.FunctionExpression */:
537
538
  return true;
538
539
  }
539
540
  return false;
@@ -543,7 +544,7 @@ function checkNaNEquality(c, errorNode, operator, left, right) {
543
544
  const isRightNaN = isGlobalNaN(c, skipParentheses(right));
544
545
  if (!isLeftNaN && !isRightNaN)
545
546
  return;
546
- const err = c.error(errorNode, 966 /* Diagnostics.This_condition_will_always_return_0 */, operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 'false' : 'true');
547
+ const err = c.error(errorNode, 973 /* Diagnostics.This_condition_will_always_return_0 */, operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 'false' : 'true');
547
548
  if (isLeftNaN && isRightNaN)
548
549
  return;
549
550
  const operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? '!' : '';
@@ -578,10 +579,10 @@ function checkShiftAmount(c, left, operator, right, errorNode) {
578
579
  if (result.kind !== 1 /* EvaluatedKind.Number */ || Math.abs(result.numberValue) < 32)
579
580
  return;
580
581
  let container = right.parent.parent;
581
- while (container.kind === 218 /* SyntaxKind.ParenthesizedExpression */)
582
+ while (container.kind === 219 /* SyntaxKind.ParenthesizedExpression */)
582
583
  container = container.parent;
583
584
  const file = getSourceFileOfNode(left);
584
- c.addErrorOrSuggestion(container.kind === 306 /* SyntaxKind.EnumMember */, createDiagnosticForNode(errorNode, 1644 /* Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2 */, [
585
+ c.addErrorOrSuggestion(container.kind === 307 /* SyntaxKind.EnumMember */, createDiagnosticForNode(errorNode, 1655 /* Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2 */, [
585
586
  getSourceTextOfNode(file, left),
586
587
  tokenToString(operator),
587
588
  String(result.numberValue % 32),
@@ -592,12 +593,12 @@ function checkInstanceOfExpression(c, left, right, leftType, rightType, checkMod
592
593
  return c.silentNeverType;
593
594
  // Unknown left operands already reported an error.
594
595
  if (!isTypeAny(leftType) && allTypesAssignableToKind(c, leftType, 12713980 /* TypeFlags.Primitive */))
595
- c.error(left, 534 /* Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter */);
596
+ c.error(left, 541 /* Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter */);
596
597
  // `x instanceof C` is checked as the call `C[Symbol.hasInstance](x)`.
597
598
  const signature = getResolvedSignature(c, left.parent, checkMode);
598
599
  if (signature === c.resolvingSignature)
599
600
  return c.silentNeverType;
600
- checkTypeAssignableTo(c, getReturnTypeOfSignature(c, signature), c.booleanType, right, 981 /* Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression */);
601
+ checkTypeAssignableTo(c, getReturnTypeOfSignature(c, signature), c.booleanType, right, 988 /* Diagnostics.An_object_s_Symbol_hasInstance_method_must_return_a_boolean_value_for_it_to_be_used_on_the_right_hand_side_of_an_instanceof_expression */);
601
602
  return c.booleanType;
602
603
  }
603
604
  /** The signature of `right[Symbol.hasInstance]` that `left instanceof right` calls, if any. */
@@ -616,11 +617,11 @@ export function resolveInstanceofExpression(c, node, checkMode) {
616
617
  return resolveUntypedCall(c, node);
617
618
  // Argument errors explain how `left instanceof right` became `right[Symbol.hasInstance](left)`.
618
619
  if (callSignatures.length !== 0)
619
- return resolveCall(c, node, callSignatures, checkMode, 0 /* SignatureFlags.None */, 980 /* Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method */);
620
+ return resolveCall(c, node, callSignatures, checkMode, 0 /* SignatureFlags.None */, 987 /* Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method */);
620
621
  }
621
622
  else if (!typeHasCallOrConstructSignatures(c, rightType) &&
622
623
  !isTypeSubtypeOf(c, rightType, c.globalFunctionType)) {
623
- c.error(right, 535 /* Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method */);
624
+ c.error(right, 542 /* Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_be_either_of_type_any_a_class_function_or_other_type_assignable_to_the_Function_interface_type_or_an_object_type_with_a_Symbol_hasInstance_method */);
624
625
  return resolveErrorCall(c, node);
625
626
  }
626
627
  }
@@ -664,7 +665,7 @@ function checkInExpression(c, left, right, leftType, rightType) {
664
665
  if (checkTypeAssignableTo(c, checkNonNullType(c, rightType, right), c.nonPrimitiveType, right, undefined)) {
665
666
  // `{}` is assignable to `object` but may stand for a primitive, as when narrowed from `unknown`.
666
667
  if (hasEmptyObjectIntersection(c, rightType))
667
- c.error(right, 781 /* Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator */, typeToString(c, rightType));
668
+ c.error(right, 788 /* Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator */, typeToString(c, rightType));
668
669
  }
669
670
  return c.booleanType;
670
671
  }
@@ -712,8 +713,8 @@ export function checkTruthinessOfType(c, t, node) {
712
713
  const semantics = getSyntacticTruthySemantics(c, node);
713
714
  if (semantics !== 3 /* PredicateSemantics.Sometimes */)
714
715
  c.error(node, semantics === 1 /* PredicateSemantics.Always */
715
- ? 992 /* Diagnostics.This_kind_of_expression_is_always_truthy */
716
- : 993 /* Diagnostics.This_kind_of_expression_is_always_falsy */);
716
+ ? 999 /* Diagnostics.This_kind_of_expression_is_always_truthy */
717
+ : 1000 /* Diagnostics.This_kind_of_expression_is_always_falsy */);
717
718
  return t;
718
719
  }
719
720
  function getSyntacticTruthySemantics(c, nodeIn) {
@@ -724,23 +725,23 @@ function getSyntacticTruthySemantics(c, nodeIn) {
724
725
  const text = getText(node);
725
726
  return text === '0' || text === '1' ? 3 /* PredicateSemantics.Sometimes */ : 1 /* PredicateSemantics.Always */;
726
727
  }
727
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
728
- case 220 /* SyntaxKind.ArrowFunction */:
728
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
729
+ case 221 /* SyntaxKind.ArrowFunction */:
729
730
  case 9 /* SyntaxKind.BigIntLiteral */:
730
- case 232 /* SyntaxKind.ClassExpression */:
731
- case 219 /* SyntaxKind.FunctionExpression */:
732
- case 285 /* SyntaxKind.JsxElement */:
733
- case 286 /* SyntaxKind.JsxSelfClosingElement */:
734
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
731
+ case 233 /* SyntaxKind.ClassExpression */:
732
+ case 220 /* SyntaxKind.FunctionExpression */:
733
+ case 286 /* SyntaxKind.JsxElement */:
734
+ case 287 /* SyntaxKind.JsxSelfClosingElement */:
735
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
735
736
  case 13 /* SyntaxKind.RegularExpressionLiteral */:
736
737
  return 1 /* PredicateSemantics.Always */;
737
- case 223 /* SyntaxKind.VoidExpression */:
738
+ case 224 /* SyntaxKind.VoidExpression */:
738
739
  case 105 /* SyntaxKind.NullKeyword */:
739
740
  return 2 /* PredicateSemantics.Never */;
740
741
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
741
742
  case 10 /* SyntaxKind.StringLiteral */:
742
743
  return getText(node) !== '' ? 1 /* PredicateSemantics.Always */ : 2 /* PredicateSemantics.Never */;
743
- case 228 /* SyntaxKind.ConditionalExpression */: {
744
+ case 229 /* SyntaxKind.ConditionalExpression */: {
744
745
  const cond = node;
745
746
  return getSyntacticTruthySemantics(c, cond.whenTrue) | getSyntacticTruthySemantics(c, cond.whenFalse);
746
747
  }
@@ -753,42 +754,42 @@ function getSyntacticTruthySemantics(c, nodeIn) {
753
754
  }
754
755
  function checkNullishCoalesceOperands(c, left, right) {
755
756
  const grandparent = left.parent.parent;
756
- if (grandparent.kind === 227 /* SyntaxKind.BinaryExpression */) {
757
+ if (grandparent.kind === 228 /* SyntaxKind.BinaryExpression */) {
757
758
  const outer = grandparent;
758
- if (outer.left.kind === 227 /* SyntaxKind.BinaryExpression */ && outer.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)
759
- grammarErrorOnNode(c, outer.left, 1151 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(60 /* SyntaxKind.QuestionQuestionToken */), tokenToString(outer.operatorToken.kind));
759
+ if (outer.left.kind === 228 /* SyntaxKind.BinaryExpression */ && outer.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)
760
+ grammarErrorOnNode(c, outer.left, 1158 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(60 /* SyntaxKind.QuestionQuestionToken */), tokenToString(outer.operatorToken.kind));
760
761
  }
761
- else if (left.kind === 227 /* SyntaxKind.BinaryExpression */) {
762
+ else if (left.kind === 228 /* SyntaxKind.BinaryExpression */) {
762
763
  const operator = left.operatorToken.kind;
763
764
  if (operator === 56 /* SyntaxKind.BarBarToken */ || operator === 55 /* SyntaxKind.AmpersandAmpersandToken */)
764
- grammarErrorOnNode(c, left, 1151 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(operator), tokenToString(60 /* SyntaxKind.QuestionQuestionToken */));
765
+ grammarErrorOnNode(c, left, 1158 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(operator), tokenToString(60 /* SyntaxKind.QuestionQuestionToken */));
765
766
  }
766
- else if (right.kind === 227 /* SyntaxKind.BinaryExpression */) {
767
+ else if (right.kind === 228 /* SyntaxKind.BinaryExpression */) {
767
768
  const operator = right.operatorToken.kind;
768
769
  if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */)
769
- grammarErrorOnNode(c, right, 1151 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(60 /* SyntaxKind.QuestionQuestionToken */), tokenToString(operator));
770
+ grammarErrorOnNode(c, right, 1158 /* Diagnostics.X_0_and_1_operations_cannot_be_mixed_without_parentheses */, tokenToString(60 /* SyntaxKind.QuestionQuestionToken */), tokenToString(operator));
770
771
  }
771
772
  const leftTarget = skipOuterExpressions(left);
772
773
  const semantics = getSyntacticNullishnessSemantics(c, leftTarget);
773
774
  if (semantics === 1 /* PredicateSemantics.Always */)
774
- c.error(leftTarget, 991 /* Diagnostics.This_expression_is_always_nullish */);
775
+ c.error(leftTarget, 998 /* Diagnostics.This_expression_is_always_nullish */);
775
776
  else if (semantics !== 3 /* PredicateSemantics.Sometimes */)
776
- c.error(leftTarget, 989 /* Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish */);
777
+ c.error(leftTarget, 996 /* Diagnostics.Right_operand_of_is_unreachable_because_the_left_operand_is_never_nullish */);
777
778
  }
778
779
  function getSyntacticNullishnessSemantics(c, nodeIn) {
779
780
  const node = skipOuterExpressions(nodeIn);
780
781
  switch (node.kind) {
781
- case 224 /* SyntaxKind.AwaitExpression */:
782
- case 214 /* SyntaxKind.CallExpression */:
783
- case 216 /* SyntaxKind.TaggedTemplateExpression */:
784
- case 213 /* SyntaxKind.ElementAccessExpression */:
785
- case 237 /* SyntaxKind.MetaProperty */:
786
- case 215 /* SyntaxKind.NewExpression */:
787
- case 212 /* SyntaxKind.PropertyAccessExpression */:
788
- case 230 /* SyntaxKind.YieldExpression */:
782
+ case 225 /* SyntaxKind.AwaitExpression */:
783
+ case 215 /* SyntaxKind.CallExpression */:
784
+ case 217 /* SyntaxKind.TaggedTemplateExpression */:
785
+ case 214 /* SyntaxKind.ElementAccessExpression */:
786
+ case 238 /* SyntaxKind.MetaProperty */:
787
+ case 216 /* SyntaxKind.NewExpression */:
788
+ case 213 /* SyntaxKind.PropertyAccessExpression */:
789
+ case 231 /* SyntaxKind.YieldExpression */:
789
790
  case 109 /* SyntaxKind.ThisKeyword */:
790
791
  return 3 /* PredicateSemantics.Sometimes */;
791
- case 227 /* SyntaxKind.BinaryExpression */: {
792
+ case 228 /* SyntaxKind.BinaryExpression */: {
792
793
  const binary = node;
793
794
  switch (binary.operatorToken.kind) {
794
795
  case 56 /* SyntaxKind.BarBarToken */:
@@ -799,13 +800,20 @@ function getSyntacticNullishnessSemantics(c, nodeIn) {
799
800
  // The right operand decides.
800
801
  case 27 /* SyntaxKind.CommaToken */:
801
802
  case 63 /* SyntaxKind.EqualsToken */:
802
- case 60 /* SyntaxKind.QuestionQuestionToken */:
803
- case 77 /* SyntaxKind.QuestionQuestionEqualsToken */:
804
803
  return getSyntacticNullishnessSemantics(c, binary.right);
804
+ // The left operand when it isn't nullish, otherwise the right operand.
805
+ case 60 /* SyntaxKind.QuestionQuestionToken */:
806
+ case 77 /* SyntaxKind.QuestionQuestionEqualsToken */: {
807
+ const left = getSyntacticNullishnessSemantics(c, binary.left);
808
+ let result = left & 2 /* PredicateSemantics.Never */;
809
+ if ((left & 1 /* PredicateSemantics.Always */) !== 0)
810
+ result |= getSyntacticNullishnessSemantics(c, binary.right);
811
+ return result;
812
+ }
805
813
  }
806
814
  return 2 /* PredicateSemantics.Never */;
807
815
  }
808
- case 228 /* SyntaxKind.ConditionalExpression */: {
816
+ case 229 /* SyntaxKind.ConditionalExpression */: {
809
817
  const cond = node;
810
818
  return getSyntacticNullishnessSemantics(c, cond.whenTrue) | getSyntacticNullishnessSemantics(c, cond.whenFalse);
811
819
  }
@@ -838,7 +846,7 @@ export function checkTestingKnownTruthyType(c, condExpr, condType, body) {
838
846
  return;
839
847
  let expr = skipParentheses(condExpr);
840
848
  checkTestingKnownTruthyTypeWorker(c, expr, condType, body);
841
- while (expr.kind === 227 /* SyntaxKind.BinaryExpression */ &&
849
+ while (expr.kind === 228 /* SyntaxKind.BinaryExpression */ &&
842
850
  (expr.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ ||
843
851
  expr.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */)) {
844
852
  expr = skipParentheses(expr.left);
@@ -846,7 +854,7 @@ export function checkTestingKnownTruthyType(c, condExpr, condType, body) {
846
854
  }
847
855
  }
848
856
  function isLogicalOrCoalescingExpression(node) {
849
- return (node.kind === 227 /* SyntaxKind.BinaryExpression */ &&
857
+ return (node.kind === 228 /* SyntaxKind.BinaryExpression */ &&
850
858
  isLogicalOrCoalescingOperator(node.operatorToken.kind));
851
859
  }
852
860
  function checkTestingKnownTruthyTypeWorker(c, condExpr, condType, body) {
@@ -858,17 +866,17 @@ function checkTestingKnownTruthyTypeWorker(c, condExpr, condType, body) {
858
866
  return;
859
867
  }
860
868
  const t = location !== condExpr ? checkExpression(c, location) : condType;
861
- if ((t.flags & 32768 /* TypeFlags.EnumLiteral */) !== 0 && location.kind === 212 /* SyntaxKind.PropertyAccessExpression */) {
869
+ if ((t.flags & 32768 /* TypeFlags.EnumLiteral */) !== 0 && location.kind === 213 /* SyntaxKind.PropertyAccessExpression */) {
862
870
  const leftSymbol = c.resolvedSymbols.get(location.expression.id);
863
871
  if (leftSymbol !== undefined && (leftSymbol.flags & 384 /* SymbolFlags.Enum */) !== 0) {
864
872
  // An enum member with a known value is always truthy or always falsy.
865
873
  const value = t;
866
874
  const truthy = (t.flags & 1024 /* TypeFlags.StringLiteral */) !== 0 ? value.stringValue !== '' : value.numberValue !== 0;
867
- c.error(location, 966 /* Diagnostics.This_condition_will_always_return_0 */, truthy ? 'true' : 'false');
875
+ c.error(location, 973 /* Diagnostics.This_condition_will_always_return_0 */, truthy ? 'true' : 'false');
868
876
  return;
869
877
  }
870
878
  }
871
- const isPropertyExpressionCast = location.kind === 212 /* SyntaxKind.PropertyAccessExpression */ &&
879
+ const isPropertyExpressionCast = location.kind === 213 /* SyntaxKind.PropertyAccessExpression */ &&
872
880
  isTypeAssertion(location.expression);
873
881
  if (!hasTypeFacts(c, t, 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast)
874
882
  return;
@@ -880,29 +888,29 @@ function checkTestingKnownTruthyTypeWorker(c, condExpr, condType, body) {
880
888
  let testedNode = undefined;
881
889
  if (location.kind === 79 /* SyntaxKind.Identifier */)
882
890
  testedNode = location;
883
- else if (location.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
891
+ else if (location.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
884
892
  testedNode = location.name;
885
893
  const testedSymbol = testedNode !== undefined ? getSymbolAtLocationWorker(c, testedNode, false) : undefined;
886
894
  if (testedSymbol === undefined && !isPromise)
887
895
  return;
888
896
  const isUsed = testedSymbol !== undefined &&
889
- ((condExpr.parent.kind === 227 /* SyntaxKind.BinaryExpression */ &&
897
+ ((condExpr.parent.kind === 228 /* SyntaxKind.BinaryExpression */ &&
890
898
  isSymbolUsedInBinaryExpressionChain(c, condExpr.parent, testedSymbol)) ||
891
899
  (body !== undefined && isSymbolUsedInConditionBody(c, condExpr, body, testedNode, testedSymbol)));
892
900
  if (isUsed)
893
901
  return;
894
902
  if (isPromise)
895
- errorAndMaybeSuggestAwait(c, location, true, 933 /* Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined */, [typeToString(c, t, undefined, 64 /* TypeFormatFlags.UseFullyQualifiedType */)]);
903
+ errorAndMaybeSuggestAwait(c, location, true, 940 /* Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined */, [typeToString(c, t, undefined, 64 /* TypeFormatFlags.UseFullyQualifiedType */)]);
896
904
  else
897
- c.error(location, 906 /* Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead */);
905
+ c.error(location, 913 /* Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead */);
898
906
  }
899
907
  export function isTypeAssertion(node) {
900
908
  const n = skipParentheses(node);
901
- return n.kind === 217 /* SyntaxKind.TypeAssertionExpression */ || n.kind === 235 /* SyntaxKind.AsExpression */;
909
+ return n.kind === 218 /* SyntaxKind.TypeAssertionExpression */ || n.kind === 236 /* SyntaxKind.AsExpression */;
902
910
  }
903
911
  function isSymbolUsedInBinaryExpressionChain(c, nodeIn, testedSymbol) {
904
912
  let node = nodeIn;
905
- while (node.kind === 227 /* SyntaxKind.BinaryExpression */ &&
913
+ while (node.kind === 228 /* SyntaxKind.BinaryExpression */ &&
906
914
  node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) {
907
915
  if (node.right.forEachChild(new SymbolUseFinder(c, testedSymbol)))
908
916
  return true;
@@ -945,7 +953,7 @@ class ConditionBodyUseFinder extends NodeVisitor {
945
953
  if (node.kind === 79 /* SyntaxKind.Identifier */ && getSymbolAtLocationWorker(this.c, node, false) === this.testedSymbol) {
946
954
  // A simple identifier test needs no target comparison.
947
955
  if (this.expr.kind === 79 /* SyntaxKind.Identifier */ ||
948
- (this.testedNode.kind === 79 /* SyntaxKind.Identifier */ && this.testedNode.parent.kind === 227 /* SyntaxKind.BinaryExpression */))
956
+ (this.testedNode.kind === 79 /* SyntaxKind.Identifier */ && this.testedNode.parent.kind === 228 /* SyntaxKind.BinaryExpression */))
949
957
  return true;
950
958
  let tested = this.testedNode.parent;
951
959
  let child = node.parent;
@@ -954,14 +962,14 @@ class ConditionBodyUseFinder extends NodeVisitor {
954
962
  return getSymbolAtLocationWorker(this.c, tested, false) === getSymbolAtLocationWorker(this.c, child, false);
955
963
  if (tested.kind === 109 /* SyntaxKind.ThisKeyword */ && child.kind === 109 /* SyntaxKind.ThisKeyword */)
956
964
  return true;
957
- if (tested.kind === 212 /* SyntaxKind.PropertyAccessExpression */ && child.kind === 212 /* SyntaxKind.PropertyAccessExpression */) {
965
+ if (tested.kind === 213 /* SyntaxKind.PropertyAccessExpression */ && child.kind === 213 /* SyntaxKind.PropertyAccessExpression */) {
958
966
  if (getSymbolAtLocationWorker(this.c, tested.name, false) !==
959
967
  getSymbolAtLocationWorker(this.c, child.name, false))
960
968
  return false;
961
969
  child = getExpression(child);
962
970
  tested = getExpression(tested);
963
971
  }
964
- else if (tested.kind === 214 /* SyntaxKind.CallExpression */ && child.kind === 214 /* SyntaxKind.CallExpression */) {
972
+ else if (tested.kind === 215 /* SyntaxKind.CallExpression */ && child.kind === 215 /* SyntaxKind.CallExpression */) {
965
973
  child = getExpression(child);
966
974
  tested = getExpression(tested);
967
975
  }
@@ -983,8 +991,8 @@ function isSideEffectFree(expr) {
983
991
  case 79 /* SyntaxKind.Identifier */:
984
992
  case 10 /* SyntaxKind.StringLiteral */:
985
993
  case 13 /* SyntaxKind.RegularExpressionLiteral */:
986
- case 216 /* SyntaxKind.TaggedTemplateExpression */:
987
- case 229 /* SyntaxKind.TemplateExpression */:
994
+ case 217 /* SyntaxKind.TaggedTemplateExpression */:
995
+ case 230 /* SyntaxKind.TemplateExpression */:
988
996
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
989
997
  case 8 /* SyntaxKind.NumericLiteral */:
990
998
  case 9 /* SyntaxKind.BigIntLiteral */:
@@ -992,27 +1000,27 @@ function isSideEffectFree(expr) {
992
1000
  case 96 /* SyntaxKind.FalseKeyword */:
993
1001
  case 105 /* SyntaxKind.NullKeyword */:
994
1002
  case 157 /* SyntaxKind.UndefinedKeyword */:
995
- case 219 /* SyntaxKind.FunctionExpression */:
996
- case 232 /* SyntaxKind.ClassExpression */:
997
- case 220 /* SyntaxKind.ArrowFunction */:
998
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
999
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
1000
- case 222 /* SyntaxKind.TypeOfExpression */:
1001
- case 236 /* SyntaxKind.NonNullExpression */:
1002
- case 286 /* SyntaxKind.JsxSelfClosingElement */:
1003
- case 285 /* SyntaxKind.JsxElement */:
1003
+ case 220 /* SyntaxKind.FunctionExpression */:
1004
+ case 233 /* SyntaxKind.ClassExpression */:
1005
+ case 221 /* SyntaxKind.ArrowFunction */:
1006
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
1007
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
1008
+ case 223 /* SyntaxKind.TypeOfExpression */:
1009
+ case 237 /* SyntaxKind.NonNullExpression */:
1010
+ case 287 /* SyntaxKind.JsxSelfClosingElement */:
1011
+ case 286 /* SyntaxKind.JsxElement */:
1004
1012
  return true;
1005
- case 228 /* SyntaxKind.ConditionalExpression */: {
1013
+ case 229 /* SyntaxKind.ConditionalExpression */: {
1006
1014
  const cond = node;
1007
1015
  return isSideEffectFree(cond.whenTrue) && isSideEffectFree(cond.whenFalse);
1008
1016
  }
1009
- case 227 /* SyntaxKind.BinaryExpression */: {
1017
+ case 228 /* SyntaxKind.BinaryExpression */: {
1010
1018
  const binary = node;
1011
1019
  if (isAssignmentOperator(binary.operatorToken.kind))
1012
1020
  return false;
1013
1021
  return isSideEffectFree(binary.left) && isSideEffectFree(binary.right);
1014
1022
  }
1015
- case 225 /* SyntaxKind.PrefixUnaryExpression */:
1023
+ case 226 /* SyntaxKind.PrefixUnaryExpression */:
1016
1024
  switch (node.operator) {
1017
1025
  case 53 /* SyntaxKind.ExclamationToken */:
1018
1026
  case 39 /* SyntaxKind.PlusToken */:
@@ -1029,12 +1037,12 @@ function isIndirectCall(node) {
1029
1037
  const left = node.left;
1030
1038
  const right = node.right;
1031
1039
  const parent = node.parent;
1032
- if (parent.kind !== 218 /* SyntaxKind.ParenthesizedExpression */ ||
1040
+ if (parent.kind !== 219 /* SyntaxKind.ParenthesizedExpression */ ||
1033
1041
  left.kind !== 8 /* SyntaxKind.NumericLiteral */ ||
1034
1042
  getText(left) !== '0')
1035
1043
  return false;
1036
1044
  const grand = parent.parent;
1037
- const called = (grand.kind === 214 /* SyntaxKind.CallExpression */ && getExpression(grand) === parent) ||
1038
- grand.kind === 216 /* SyntaxKind.TaggedTemplateExpression */;
1045
+ const called = (grand.kind === 215 /* SyntaxKind.CallExpression */ && getExpression(grand) === parent) ||
1046
+ grand.kind === 217 /* SyntaxKind.TaggedTemplateExpression */;
1039
1047
  return called && (isAccessExpression(right) || (right.kind === 79 /* SyntaxKind.Identifier */ && getText(right) === 'eval'));
1040
1048
  }