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
@@ -4,7 +4,7 @@
4
4
  // of each node in the order tsgo's checker runs them. Checks that need types read the checker's
5
5
  // caches. Errors reported with `grammarError*` are dropped when the file has parse errors.
6
6
  import { ElementAccessExpression, Identifier, NodeVisitor, StringLiteral, getAsteriskToken, getBody, getElements, getExpression, getHeritageClauses, getInitializer, getLabel, getIsTypeOnly, getLocals, getMembers, getModifiers, getName, getNodeId, getParameters, getPostfixToken, getStatements, getText, getType, getTypeArguments, getTypeParameters, isDeclarationNode, callQuestionDotToken, callTypeArguments, } from './ast.js';
7
- import { canHaveDecorators, canHaveIllegalDecorators, getExternalModuleName, getTextOfNodeFromSourceText, isAmbientModule, isFunctionLike, isFunctionLikeDeclarationKind, isModifierKind, isStringLiteralLike, modifierToFlag, nodeIsPresent, isInJSFile, } from './ast-utilities.js';
7
+ import { canHaveDecorators, canHaveIllegalDecorators, getExternalModuleName, getTextOfNodeFromSourceText, isAmbientModule, isFunctionLike, isFunctionLikeDeclarationKind, isImportDeferMetaProperty, isImportPhaseMetaProperty, isImportSourceMetaProperty, isModifierKind, isSourcePhaseImportCall, isStringLiteralLike, modifierToFlag, nodeIsPresent, isInJSFile, } from './ast-utilities.js';
8
8
  import { getCombinedModifierFlags, getCombinedNodeFlags, getContainingClass, getRangeOfTokenAtPosition, getSourceFileOfNode, hasSyntacticModifier, isAutoAccessorPropertyDeclaration, isClassLike, isDynamicName, isEntityNameExpression, isExternalModule, isInTopLevelContext, isModuleAugmentationExternal, isPrivateIdentifierClassElementDeclaration, isStatic, skipParentheses, } from './binder-utilities.js';
9
9
  import { findUseStrictPrologue } from './binder.js';
10
10
  import { createDiagnosticForNode } from './checker.js';
@@ -17,12 +17,12 @@ import { isGenericType } from './checker-type-operators.js';
17
17
  import { getPropertyNameFromType, isTypeUsableAsPropertyName, isValidIndexKeyType } from './checker-utilities.js';
18
18
  import { getSymbolOfDeclaration, resolveAlias } from './checker-symbols.js';
19
19
  import { Diagnostic, messageCategory } from './diagnostics.js';
20
- import { ModuleKind, ScriptTarget, getEmitModuleKind } from './options.js';
20
+ import { ModuleKind, ScriptTarget, getEmitModuleKind, supportsDeferredImports, supportsSourcePhaseImports, } from './options.js';
21
+ import { getEmitSyntaxForModuleSpecifierExpression } from './checker-modules.js';
21
22
  import { fileExtensionIsOneOf, isExternalModuleNameRelative } from './path.js';
22
- import { SourceFileMetadata, getEmitModuleFormatOfFile, getImpliedNodeFormatForEmit } from './program-utilities.js';
23
+ import { SourceFileMetadata, getEmitModuleFormatOfFile, getImpliedNodeFormatForEmit, resolutionModeAttribute, } from './program-utilities.js';
23
24
  import { Scanner, ScannerErrorReporter, skipTrivia, tokenToString } from './scanner.js';
24
25
  import { typeToString } from './type-printer.js';
25
- import { findMismatchedAugmentsTag } from './checker-jsdoc.js';
26
26
  import { getDeclarations } from './symbol.js';
27
27
  /** Runs the grammar checks of every node of `file`. */
28
28
  export function checkGrammarSourceFile(c, file) {
@@ -52,7 +52,7 @@ export function checkGrammarRestTrailingComma(c, node, list) {
52
52
  /** Checks the grammar of a function expression or arrow function each time it is checked. */
53
53
  export function checkGrammarFunctionExpression(c, node) {
54
54
  const g = grammarCheckerOf(c, node);
55
- if (!checkGrammarFunctionLikeDeclaration(g, node) && node.kind === 219 /* SyntaxKind.FunctionExpression */)
55
+ if (!checkGrammarFunctionLikeDeclaration(g, node) && node.kind === 220 /* SyntaxKind.FunctionExpression */)
56
56
  checkGrammarForGenerator(g, node);
57
57
  }
58
58
  /** Checks the grammar of an `await` expression each time it is checked. */
@@ -135,42 +135,42 @@ function addRelated(diagnostic, node, message) {
135
135
  function checkGrammarNode(g, node) {
136
136
  switch (node.kind) {
137
137
  // Declarations and members
138
- case 169 /* SyntaxKind.TypeParameter */: {
138
+ case 170 /* SyntaxKind.TypeParameter */: {
139
139
  checkGrammarModifiers(g, node);
140
140
  const expression = node.expression;
141
141
  if (expression !== undefined)
142
142
  grammarErrorOnFirstToken(g, expression, 79 /* Diagnostics.Type_expected */);
143
143
  return true;
144
144
  }
145
- case 170 /* SyntaxKind.Parameter */:
145
+ case 171 /* SyntaxKind.Parameter */:
146
146
  checkGrammarModifiers(g, node);
147
147
  checkGrammarDecorators(g, node);
148
148
  return true;
149
- case 172 /* SyntaxKind.PropertySignature */:
149
+ case 173 /* SyntaxKind.PropertySignature */:
150
150
  checkGrammarPropertyDeclaration(g, node);
151
151
  return true;
152
- case 173 /* SyntaxKind.PropertyDeclaration */:
152
+ case 174 /* SyntaxKind.PropertyDeclaration */:
153
153
  checkGrammarPropertyDeclaration(g, node);
154
154
  checkGrammarDecorators(g, node);
155
155
  return true;
156
- case 186 /* SyntaxKind.ConstructorType */:
157
- case 185 /* SyntaxKind.FunctionType */:
158
- case 180 /* SyntaxKind.CallSignature */:
159
- case 181 /* SyntaxKind.ConstructSignature */:
156
+ case 187 /* SyntaxKind.ConstructorType */:
157
+ case 186 /* SyntaxKind.FunctionType */:
158
+ case 181 /* SyntaxKind.CallSignature */:
159
+ case 182 /* SyntaxKind.ConstructSignature */:
160
160
  checkGrammarFunctionLikeDeclaration(g, node);
161
161
  return true;
162
- case 182 /* SyntaxKind.IndexSignature */:
162
+ case 183 /* SyntaxKind.IndexSignature */:
163
163
  if (!checkGrammarModifiers(g, node))
164
164
  checkGrammarIndexSignatureParameters(g, node);
165
165
  return true;
166
- case 175 /* SyntaxKind.MethodDeclaration */:
167
- case 174 /* SyntaxKind.MethodSignature */:
166
+ case 176 /* SyntaxKind.MethodDeclaration */:
167
+ case 175 /* SyntaxKind.MethodSignature */:
168
168
  checkGrammarMethodDeclaration(g, node);
169
169
  return true;
170
- case 176 /* SyntaxKind.ClassStaticBlockDeclaration */:
170
+ case 177 /* SyntaxKind.ClassStaticBlockDeclaration */:
171
171
  checkGrammarModifiers(g, node);
172
172
  return true;
173
- case 177 /* SyntaxKind.Constructor */:
173
+ case 178 /* SyntaxKind.Constructor */:
174
174
  checkGrammarFunctionLikeDeclaration(g, node);
175
175
  if (!checkGrammarConstructorTypeParameters(g, node)) {
176
176
  const type = node.type;
@@ -178,100 +178,100 @@ function checkGrammarNode(g, node) {
178
178
  grammarErrorOnNode(g, type, 62 /* Diagnostics.Type_annotation_cannot_appear_on_a_constructor_declaration */);
179
179
  }
180
180
  return true;
181
- case 178 /* SyntaxKind.GetAccessor */:
182
- case 179 /* SyntaxKind.SetAccessor */:
181
+ case 179 /* SyntaxKind.GetAccessor */:
182
+ case 180 /* SyntaxKind.SetAccessor */:
183
183
  checkGrammarAccessorDeclaration(g, node);
184
184
  return true;
185
- case 263 /* SyntaxKind.FunctionDeclaration */:
185
+ case 264 /* SyntaxKind.FunctionDeclaration */:
186
186
  checkGrammarDecorators(g, node);
187
187
  checkGrammarFunctionLikeDeclaration(g, node);
188
188
  checkGrammarForGenerator(g, node);
189
189
  return true;
190
- case 264 /* SyntaxKind.ClassDeclaration */:
190
+ case 265 /* SyntaxKind.ClassDeclaration */:
191
191
  checkGrammarClassDeclaration(g, node);
192
192
  return true;
193
- case 232 /* SyntaxKind.ClassExpression */:
193
+ case 233 /* SyntaxKind.ClassExpression */:
194
194
  checkGrammarClassLikeDeclaration(g, node);
195
195
  return true;
196
- case 265 /* SyntaxKind.InterfaceDeclaration */:
196
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
197
197
  checkGrammarInterfaceDeclaration(g, node);
198
198
  return true;
199
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
199
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
200
200
  checkGrammarModifiers(g, node);
201
201
  if (!containerAllowsBlockScopedVariable(node.parent))
202
202
  grammarErrorOnNode(g, node, 116 /* Diagnostics.X_0_declarations_can_only_be_declared_inside_a_block */, 'type');
203
203
  return true;
204
- case 267 /* SyntaxKind.EnumDeclaration */:
204
+ case 268 /* SyntaxKind.EnumDeclaration */:
205
205
  checkGrammarModifiers(g, node);
206
206
  return true;
207
- case 268 /* SyntaxKind.ModuleDeclaration */:
207
+ case 269 /* SyntaxKind.ModuleDeclaration */:
208
208
  return checkGrammarModuleDeclaration(g, node);
209
- case 273 /* SyntaxKind.ImportDeclaration */:
210
- case 346 /* SyntaxKind.JSImportDeclaration */:
209
+ case 274 /* SyntaxKind.ImportDeclaration */:
210
+ case 347 /* SyntaxKind.JSImportDeclaration */:
211
211
  checkGrammarImportDeclaration(g, node);
212
212
  return false;
213
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
213
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
214
214
  checkGrammarImportEqualsDeclaration(g, node);
215
215
  return false;
216
- case 279 /* SyntaxKind.ExportDeclaration */:
216
+ case 280 /* SyntaxKind.ExportDeclaration */:
217
217
  checkGrammarExportDeclaration(g, node);
218
218
  return false;
219
- case 278 /* SyntaxKind.ExportAssignment */:
219
+ case 279 /* SyntaxKind.ExportAssignment */:
220
220
  return checkGrammarExportAssignment(g, node);
221
- case 261 /* SyntaxKind.VariableDeclaration */:
221
+ case 262 /* SyntaxKind.VariableDeclaration */:
222
222
  // Catch clause variables are checked with the clause.
223
- if (node.parent.kind !== 300 /* SyntaxKind.CatchClause */)
223
+ if (node.parent.kind !== 301 /* SyntaxKind.CatchClause */)
224
224
  checkGrammarVariableDeclaration(g, node);
225
225
  return true;
226
- case 209 /* SyntaxKind.BindingElement */:
226
+ case 210 /* SyntaxKind.BindingElement */:
227
227
  checkGrammarBindingElement(g, node);
228
228
  return true;
229
229
  // Statements
230
- case 242 /* SyntaxKind.Block */:
231
- case 243 /* SyntaxKind.EmptyStatement */:
232
- case 260 /* SyntaxKind.DebuggerStatement */:
233
- case 245 /* SyntaxKind.ExpressionStatement */:
234
- case 247 /* SyntaxKind.DoStatement */:
235
- case 248 /* SyntaxKind.WhileStatement */:
236
- case 259 /* SyntaxKind.TryStatement */:
230
+ case 243 /* SyntaxKind.Block */:
231
+ case 244 /* SyntaxKind.EmptyStatement */:
232
+ case 261 /* SyntaxKind.DebuggerStatement */:
233
+ case 246 /* SyntaxKind.ExpressionStatement */:
234
+ case 248 /* SyntaxKind.DoStatement */:
235
+ case 249 /* SyntaxKind.WhileStatement */:
236
+ case 260 /* SyntaxKind.TryStatement */:
237
237
  checkGrammarStatementInAmbientContext(g, node);
238
238
  return true;
239
- case 246 /* SyntaxKind.IfStatement */: {
239
+ case 247 /* SyntaxKind.IfStatement */: {
240
240
  checkGrammarStatementInAmbientContext(g, node);
241
241
  return true;
242
242
  }
243
- case 244 /* SyntaxKind.VariableStatement */:
243
+ case 245 /* SyntaxKind.VariableStatement */:
244
244
  checkGrammarVariableStatement(g, node);
245
245
  return true;
246
- case 249 /* SyntaxKind.ForStatement */: {
246
+ case 250 /* SyntaxKind.ForStatement */: {
247
247
  const initializer = node.initializer;
248
248
  if (!checkGrammarStatementInAmbientContext(g, node) &&
249
249
  initializer !== undefined &&
250
- initializer.kind === 262 /* SyntaxKind.VariableDeclarationList */)
250
+ initializer.kind === 263 /* SyntaxKind.VariableDeclarationList */)
251
251
  checkGrammarVariableDeclarationList(g, initializer);
252
252
  return true;
253
253
  }
254
- case 250 /* SyntaxKind.ForInStatement */:
255
- case 251 /* SyntaxKind.ForOfStatement */:
254
+ case 251 /* SyntaxKind.ForInStatement */:
255
+ case 252 /* SyntaxKind.ForOfStatement */:
256
256
  checkGrammarForInOrForOfStatement(g, node);
257
257
  return true;
258
- case 253 /* SyntaxKind.BreakStatement */:
259
- case 252 /* SyntaxKind.ContinueStatement */:
258
+ case 254 /* SyntaxKind.BreakStatement */:
259
+ case 253 /* SyntaxKind.ContinueStatement */:
260
260
  if (!checkGrammarStatementInAmbientContext(g, node))
261
261
  checkGrammarBreakOrContinueStatement(g, node);
262
262
  return true;
263
- case 254 /* SyntaxKind.ReturnStatement */:
263
+ case 255 /* SyntaxKind.ReturnStatement */:
264
264
  return checkGrammarReturnStatement(g, node);
265
- case 255 /* SyntaxKind.WithStatement */:
265
+ case 256 /* SyntaxKind.WithStatement */:
266
266
  checkGrammarWithStatement(g, node);
267
267
  return false;
268
- case 256 /* SyntaxKind.SwitchStatement */:
268
+ case 257 /* SyntaxKind.SwitchStatement */:
269
269
  checkGrammarSwitchStatement(g, node);
270
270
  return true;
271
- case 257 /* SyntaxKind.LabeledStatement */:
271
+ case 258 /* SyntaxKind.LabeledStatement */:
272
272
  checkGrammarLabeledStatement(g, node);
273
273
  return true;
274
- case 258 /* SyntaxKind.ThrowStatement */: {
274
+ case 259 /* SyntaxKind.ThrowStatement */: {
275
275
  const expression = node.expression;
276
276
  if (!checkGrammarStatementInAmbientContext(g, node) &&
277
277
  expression instanceof Identifier &&
@@ -279,75 +279,76 @@ function checkGrammarNode(g, node) {
279
279
  grammarErrorAtPos(g, expression.pos, 0, 108 /* Diagnostics.Line_break_not_permitted_here */);
280
280
  return true;
281
281
  }
282
- case 300 /* SyntaxKind.CatchClause */:
282
+ case 301 /* SyntaxKind.CatchClause */:
283
283
  checkGrammarCatchClause(g, node);
284
284
  return true;
285
285
  // Type nodes
286
- case 184 /* SyntaxKind.TypeReference */:
286
+ case 185 /* SyntaxKind.TypeReference */:
287
287
  checkGrammarTypeReference(g, node);
288
288
  return true;
289
- case 187 /* SyntaxKind.TypeQuery */:
289
+ case 188 /* SyntaxKind.TypeQuery */:
290
290
  checkGrammarTypeArguments(g, getTypeArguments(node));
291
291
  return true;
292
- case 199 /* SyntaxKind.TypeOperator */:
292
+ case 200 /* SyntaxKind.TypeOperator */:
293
293
  checkGrammarTypeOperatorNode(g, node);
294
294
  return true;
295
- case 196 /* SyntaxKind.InferType */:
295
+ case 197 /* SyntaxKind.InferType */:
296
296
  checkGrammarInferType(g, node);
297
297
  return true;
298
- case 206 /* SyntaxKind.ImportType */: {
298
+ case 207 /* SyntaxKind.ImportType */: {
299
299
  const attributes = node.attributes;
300
300
  if (attributes !== undefined)
301
- getResolutionModeOverride(g, attributes, true);
301
+ checkGrammarImportAttributeValues(g, attributes);
302
+ checkGrammarImportAttributes(g, node);
302
303
  return true;
303
304
  }
304
- case 190 /* SyntaxKind.TupleType */:
305
+ case 191 /* SyntaxKind.TupleType */:
305
306
  checkGrammarTupleType(g, node);
306
307
  return true;
307
- case 203 /* SyntaxKind.NamedTupleMember */:
308
+ case 204 /* SyntaxKind.NamedTupleMember */:
308
309
  checkGrammarNamedTupleMember(g, node);
309
310
  return true;
310
- case 312 /* SyntaxKind.JSDocNonNullableType */:
311
- case 311 /* SyntaxKind.JSDocNullableType */:
312
- case 310 /* SyntaxKind.JSDocAllType */:
313
- case 317 /* SyntaxKind.JSDocTypeLiteral */:
311
+ case 313 /* SyntaxKind.JSDocNonNullableType */:
312
+ case 312 /* SyntaxKind.JSDocNullableType */:
313
+ case 311 /* SyntaxKind.JSDocAllType */:
314
+ case 318 /* SyntaxKind.JSDocTypeLiteral */:
314
315
  checkGrammarJSDocTypeInTypeScript(g, node);
315
316
  return true;
316
- case 201 /* SyntaxKind.MappedType */: {
317
+ case 202 /* SyntaxKind.MappedType */: {
317
318
  const members = node.members;
318
319
  if (members !== undefined && members.nodes.length > 0)
319
- grammarErrorOnNode(g, members.nodes[0], 1732 /* Diagnostics.A_mapped_type_may_not_declare_properties_or_methods */);
320
+ grammarErrorOnNode(g, members.nodes[0], 1751 /* Diagnostics.A_mapped_type_may_not_declare_properties_or_methods */);
320
321
  return true;
321
322
  }
322
323
  // Expressions
323
- case 234 /* SyntaxKind.ExpressionWithTypeArguments */:
324
+ case 235 /* SyntaxKind.ExpressionWithTypeArguments */:
324
325
  // Heritage clause elements are checked with their class or interface.
325
- if (node.parent.kind !== 299 /* SyntaxKind.HeritageClause */)
326
+ if (node.parent.kind !== 300 /* SyntaxKind.HeritageClause */)
326
327
  checkGrammarExpressionWithTypeArguments(g, node);
327
328
  return true;
328
- case 219 /* SyntaxKind.FunctionExpression */:
329
- case 220 /* SyntaxKind.ArrowFunction */:
329
+ case 220 /* SyntaxKind.FunctionExpression */:
330
+ case 221 /* SyntaxKind.ArrowFunction */:
330
331
  // Checked by the checker each time the function is checked.
331
332
  return true;
332
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
333
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
333
334
  // Checked by the checker each time the literal is checked.
334
335
  return true;
335
- case 214 /* SyntaxKind.CallExpression */:
336
+ case 215 /* SyntaxKind.CallExpression */:
336
337
  checkGrammarCallExpression(g, node);
337
338
  return true;
338
- case 215 /* SyntaxKind.NewExpression */:
339
+ case 216 /* SyntaxKind.NewExpression */:
339
340
  checkGrammarTypeArguments(g, getTypeArguments(node));
340
341
  return true;
341
- case 216 /* SyntaxKind.TaggedTemplateExpression */:
342
+ case 217 /* SyntaxKind.TaggedTemplateExpression */:
342
343
  if (!checkGrammarTaggedTemplateChain(g, node))
343
344
  checkGrammarTypeArguments(g, getTypeArguments(node));
344
345
  return true;
345
- case 237 /* SyntaxKind.MetaProperty */:
346
+ case 238 /* SyntaxKind.MetaProperty */:
346
347
  checkGrammarMetaProperty(g, node);
347
348
  return true;
348
- case 224 /* SyntaxKind.AwaitExpression */:
349
- case 230 /* SyntaxKind.YieldExpression */:
350
- case 227 /* SyntaxKind.BinaryExpression */:
349
+ case 225 /* SyntaxKind.AwaitExpression */:
350
+ case 231 /* SyntaxKind.YieldExpression */:
351
+ case 228 /* SyntaxKind.BinaryExpression */:
351
352
  // Checked by the checker each time the expression is checked.
352
353
  return true;
353
354
  case 80 /* SyntaxKind.PrivateIdentifier */:
@@ -359,7 +360,7 @@ function checkGrammarNode(g, node) {
359
360
  case 13 /* SyntaxKind.RegularExpressionLiteral */:
360
361
  checkGrammarRegularExpressionLiteral(g, node);
361
362
  return false;
362
- case 171 /* SyntaxKind.Decorator */: {
363
+ case 172 /* SyntaxKind.Decorator */: {
363
364
  // Decorators are only checked on valid targets.
364
365
  const target = node.parent;
365
366
  return (canHaveDecorators(target) &&
@@ -377,7 +378,7 @@ function checkGrammarModifiers(g, node) {
377
378
  return true;
378
379
  if (isThisParameter(node))
379
380
  return grammarErrorOnFirstToken(g, node, 359 /* Diagnostics.Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters */);
380
- const blockScopeKind = node.kind === 244 /* SyntaxKind.VariableStatement */
381
+ const blockScopeKind = node.kind === 245 /* SyntaxKind.VariableStatement */
381
382
  ? node.declarationList.flags & 7 /* NodeFlags.BlockScoped */
382
383
  : 0 /* NodeFlags.None */;
383
384
  const parent = node.parent;
@@ -392,13 +393,13 @@ function checkGrammarModifiers(g, node) {
392
393
  // trailing decorators and trailing modifiers. Leading and trailing decorators can't both appear.
393
394
  let hasLeadingDecorators = false;
394
395
  for (const modifier of modifiers.nodes) {
395
- if (modifier.kind === 171 /* SyntaxKind.Decorator */) {
396
+ if (modifier.kind === 172 /* SyntaxKind.Decorator */) {
396
397
  if (!nodeCanBeDecorated(g.legacyDecorators, node, parent, parent.parent)) {
397
- if (node.kind === 175 /* SyntaxKind.MethodDeclaration */ && !nodeIsPresent(getBody(node)))
398
+ if (node.kind === 176 /* SyntaxKind.MethodDeclaration */ && !nodeIsPresent(getBody(node)))
398
399
  return grammarErrorOnFirstToken(g, node, 199 /* Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload */);
399
400
  return grammarErrorOnFirstToken(g, node, 160 /* Diagnostics.Decorators_are_not_valid_here */);
400
401
  }
401
- else if (g.legacyDecorators && (node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */)) {
402
+ else if (g.legacyDecorators && (node.kind === 179 /* SyntaxKind.GetAccessor */ || node.kind === 180 /* SyntaxKind.SetAccessor */)) {
402
403
  const first = getFirstAccessorOfPair(g.c, node);
403
404
  if (first !== node && hasDecorators(first))
404
405
  return grammarErrorOnFirstToken(g, node, 161 /* Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name */);
@@ -409,8 +410,8 @@ function checkGrammarModifiers(g, node) {
409
410
  if (hasLeadingDecorators && (flags & 98303 /* ModifierFlags.Modifier */) !== 0) {
410
411
  if (g.hasParseErrors)
411
412
  return false;
412
- const diagnostic = g.c.error(modifier, 1767 /* Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export */);
413
- addRelated(diagnostic, firstDecorator, 401 /* Diagnostics.Decorator_used_before_export_here */);
413
+ const diagnostic = g.c.error(modifier, 1787 /* Diagnostics.Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export */);
414
+ addRelated(diagnostic, firstDecorator, 399 /* Diagnostics.Decorator_used_before_export_here */);
414
415
  return true;
415
416
  }
416
417
  flags |= 32768 /* ModifierFlags.Decorator */;
@@ -425,21 +426,21 @@ function checkGrammarModifiers(g, node) {
425
426
  const kind = modifier.kind;
426
427
  const reparsed = (modifier.flags & 8 /* NodeFlags.Reparsed */) !== 0;
427
428
  if (kind !== 148 /* SyntaxKind.ReadonlyKeyword */) {
428
- if (node.kind === 172 /* SyntaxKind.PropertySignature */ || node.kind === 174 /* SyntaxKind.MethodSignature */)
429
+ if (node.kind === 173 /* SyntaxKind.PropertySignature */ || node.kind === 175 /* SyntaxKind.MethodSignature */)
429
430
  return grammarErrorOnNode(g, modifier, 54 /* Diagnostics.X_0_modifier_cannot_appear_on_a_type_member */, tokenToString(kind));
430
- if (node.kind === 182 /* SyntaxKind.IndexSignature */ && (kind !== 125 /* SyntaxKind.StaticKeyword */ || !isClassLike(parent)))
431
+ if (node.kind === 183 /* SyntaxKind.IndexSignature */ && (kind !== 125 /* SyntaxKind.StaticKeyword */ || !isClassLike(parent)))
431
432
  return grammarErrorOnNode(g, modifier, 55 /* Diagnostics.X_0_modifier_cannot_appear_on_an_index_signature */, tokenToString(kind));
432
433
  }
433
434
  if (kind !== 102 /* SyntaxKind.InKeyword */ &&
434
435
  kind !== 147 /* SyntaxKind.OutKeyword */ &&
435
436
  kind !== 86 /* SyntaxKind.ConstKeyword */ &&
436
- node.kind === 169 /* SyntaxKind.TypeParameter */)
437
+ node.kind === 170 /* SyntaxKind.TypeParameter */)
437
438
  return grammarErrorOnNode(g, modifier, 222 /* Diagnostics.X_0_modifier_cannot_appear_on_a_type_parameter */, tokenToString(kind));
438
439
  switch (kind) {
439
440
  case 86 /* SyntaxKind.ConstKeyword */:
440
- if (node.kind !== 267 /* SyntaxKind.EnumDeclaration */ && node.kind !== 169 /* SyntaxKind.TypeParameter */)
441
+ if (node.kind !== 268 /* SyntaxKind.EnumDeclaration */ && node.kind !== 170 /* SyntaxKind.TypeParameter */)
441
442
  return grammarErrorOnNode(g, node, 198 /* Diagnostics.A_class_member_cannot_have_the_0_keyword */, tokenToString(kind));
442
- if (node.kind === 169 /* SyntaxKind.TypeParameter */ && !isConstTypeParameterContainer(parent))
443
+ if (node.kind === 170 /* SyntaxKind.TypeParameter */ && !isConstTypeParameterContainer(parent))
443
444
  return grammarErrorOnNode(g, modifier, 226 /* Diagnostics.X_0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class */, tokenToString(kind));
444
445
  break;
445
446
  case 164 /* SyntaxKind.OverrideKeyword */:
@@ -473,7 +474,7 @@ function checkGrammarModifiers(g, node) {
473
474
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, text, 'readonly');
474
475
  if ((flags & 1024 /* ModifierFlags.Async */) !== 0 && !reparsed)
475
476
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, text, 'async');
476
- if (parent.kind === 269 /* SyntaxKind.ModuleBlock */ || parent.kind === 307 /* SyntaxKind.SourceFile */)
477
+ if (parent.kind === 270 /* SyntaxKind.ModuleBlock */ || parent.kind === 308 /* SyntaxKind.SourceFile */)
477
478
  return grammarErrorOnNode(g, modifier, 32 /* Diagnostics.X_0_modifier_cannot_appear_on_a_module_or_namespace_element */, text);
478
479
  if ((flags & 64 /* ModifierFlags.Abstract */) !== 0) {
479
480
  if (kind === 122 /* SyntaxKind.PrivateKeyword */)
@@ -482,7 +483,7 @@ function checkGrammarModifiers(g, node) {
482
483
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, text, 'abstract');
483
484
  }
484
485
  else if (isPrivateIdentifierClassElementDeclaration(node))
485
- return grammarErrorOnNode(g, modifier, 1832 /* Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier */);
486
+ return grammarErrorOnNode(g, modifier, 1852 /* Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier */);
486
487
  flags |= modifierToFlag(kind);
487
488
  break;
488
489
  }
@@ -495,9 +496,9 @@ function checkGrammarModifiers(g, node) {
495
496
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, 'static', 'async');
496
497
  if ((flags & 512 /* ModifierFlags.Accessor */) !== 0 && !reparsed)
497
498
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, 'static', 'accessor');
498
- if (parent.kind === 269 /* SyntaxKind.ModuleBlock */ || parent.kind === 307 /* SyntaxKind.SourceFile */)
499
+ if (parent.kind === 270 /* SyntaxKind.ModuleBlock */ || parent.kind === 308 /* SyntaxKind.SourceFile */)
499
500
  return grammarErrorOnNode(g, modifier, 32 /* Diagnostics.X_0_modifier_cannot_appear_on_a_module_or_namespace_element */, 'static');
500
- if (node.kind === 170 /* SyntaxKind.Parameter */)
501
+ if (node.kind === 171 /* SyntaxKind.Parameter */)
501
502
  return grammarErrorOnNode(g, modifier, 59 /* Diagnostics.X_0_modifier_cannot_appear_on_a_parameter */, 'static');
502
503
  if ((flags & 64 /* ModifierFlags.Abstract */) !== 0)
503
504
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'static', 'abstract');
@@ -513,7 +514,7 @@ function checkGrammarModifiers(g, node) {
513
514
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'accessor', 'readonly');
514
515
  if ((flags & 128 /* ModifierFlags.Ambient */) !== 0)
515
516
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'accessor', 'declare');
516
- if (node.kind !== 173 /* SyntaxKind.PropertyDeclaration */)
517
+ if (node.kind !== 174 /* SyntaxKind.PropertyDeclaration */)
517
518
  return grammarErrorOnNode(g, modifier, 224 /* Diagnostics.X_accessor_modifier_can_only_appear_on_a_property_declaration */);
518
519
  flags |= 512 /* ModifierFlags.Accessor */;
519
520
  break;
@@ -521,10 +522,10 @@ function checkGrammarModifiers(g, node) {
521
522
  if ((flags & 8 /* ModifierFlags.Readonly */) !== 0)
522
523
  return grammarErrorOnNode(g, modifier, 23 /* Diagnostics.X_0_modifier_already_seen */, 'readonly');
523
524
  // Parameters that aren't parameter properties are reported by the parameter check.
524
- if (node.kind !== 173 /* SyntaxKind.PropertyDeclaration */ &&
525
- node.kind !== 172 /* SyntaxKind.PropertySignature */ &&
526
- node.kind !== 182 /* SyntaxKind.IndexSignature */ &&
527
- node.kind !== 170 /* SyntaxKind.Parameter */)
525
+ if (node.kind !== 174 /* SyntaxKind.PropertyDeclaration */ &&
526
+ node.kind !== 173 /* SyntaxKind.PropertySignature */ &&
527
+ node.kind !== 183 /* SyntaxKind.IndexSignature */ &&
528
+ node.kind !== 171 /* SyntaxKind.Parameter */)
528
529
  return grammarErrorOnNode(g, modifier, 19 /* Diagnostics.X_readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature */);
529
530
  if ((flags & 512 /* ModifierFlags.Accessor */) !== 0)
530
531
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'readonly', 'accessor');
@@ -533,10 +534,10 @@ function checkGrammarModifiers(g, node) {
533
534
  case 94 /* SyntaxKind.ExportKeyword */:
534
535
  if (g.c.compilerOptions.verbatimModuleSyntax === true &&
535
536
  (node.flags & 8388608 /* NodeFlags.Ambient */) === 0 &&
536
- node.kind !== 266 /* SyntaxKind.TypeAliasDeclaration */ &&
537
- node.kind !== 265 /* SyntaxKind.InterfaceDeclaration */ &&
538
- node.kind !== 268 /* SyntaxKind.ModuleDeclaration */ &&
539
- parent.kind === 307 /* SyntaxKind.SourceFile */ &&
537
+ node.kind !== 267 /* SyntaxKind.TypeAliasDeclaration */ &&
538
+ node.kind !== 266 /* SyntaxKind.InterfaceDeclaration */ &&
539
+ node.kind !== 269 /* SyntaxKind.ModuleDeclaration */ &&
540
+ parent.kind === 308 /* SyntaxKind.SourceFile */ &&
540
541
  getEmitModuleFormat(g) === ModuleKind.CommonJS)
541
542
  return grammarErrorOnNode(g, modifier, 236 /* Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled */);
542
543
  if ((flags & 32 /* ModifierFlags.Export */) !== 0)
@@ -547,24 +548,24 @@ function checkGrammarModifiers(g, node) {
547
548
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, 'export', 'abstract');
548
549
  if ((flags & 1024 /* ModifierFlags.Async */) !== 0 && !reparsed)
549
550
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, 'export', 'async');
550
- if (isClassLike(parent) && node.kind !== 345 /* SyntaxKind.JSTypeAliasDeclaration */)
551
+ if (isClassLike(parent) && node.kind !== 346 /* SyntaxKind.JSTypeAliasDeclaration */)
551
552
  return grammarErrorOnNode(g, modifier, 24 /* Diagnostics.X_0_modifier_cannot_appear_on_class_elements_of_this_kind */, 'export');
552
- if (node.kind === 170 /* SyntaxKind.Parameter */)
553
+ if (node.kind === 171 /* SyntaxKind.Parameter */)
553
554
  return grammarErrorOnNode(g, modifier, 59 /* Diagnostics.X_0_modifier_cannot_appear_on_a_parameter */, 'export');
554
555
  if (blockScopeKind === 4 /* NodeFlags.Using */)
555
- return grammarErrorOnNode(g, modifier, 406 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'export');
556
+ return grammarErrorOnNode(g, modifier, 404 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'export');
556
557
  if (blockScopeKind === 6 /* NodeFlags.AwaitUsing */)
557
- return grammarErrorOnNode(g, modifier, 410 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'export');
558
+ return grammarErrorOnNode(g, modifier, 408 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'export');
558
559
  flags |= 32 /* ModifierFlags.Export */;
559
560
  break;
560
561
  case 89 /* SyntaxKind.DefaultKeyword */: {
561
- const container = parent.kind === 307 /* SyntaxKind.SourceFile */ ? parent : parent.parent;
562
- if (container.kind === 268 /* SyntaxKind.ModuleDeclaration */ && !isAmbientModule(container))
562
+ const container = parent.kind === 308 /* SyntaxKind.SourceFile */ ? parent : parent.parent;
563
+ if (container.kind === 269 /* SyntaxKind.ModuleDeclaration */ && !isAmbientModule(container))
563
564
  return grammarErrorOnNode(g, modifier, 255 /* Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module */);
564
565
  if (blockScopeKind === 4 /* NodeFlags.Using */)
565
- return grammarErrorOnNode(g, modifier, 406 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'default');
566
+ return grammarErrorOnNode(g, modifier, 404 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'default');
566
567
  if (blockScopeKind === 6 /* NodeFlags.AwaitUsing */)
567
- return grammarErrorOnNode(g, modifier, 410 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'default');
568
+ return grammarErrorOnNode(g, modifier, 408 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'default');
568
569
  if ((flags & 32 /* ModifierFlags.Export */) === 0 && !reparsed)
569
570
  return grammarErrorOnNode(g, modifier, 22 /* Diagnostics.X_0_modifier_must_precede_1_modifier */, 'export', 'default');
570
571
  if (sawExportBeforeDecorators)
@@ -579,18 +580,18 @@ function checkGrammarModifiers(g, node) {
579
580
  return grammarErrorOnNode(g, modifier, 30 /* Diagnostics.X_0_modifier_cannot_be_used_in_an_ambient_context */, 'async');
580
581
  if ((flags & 16 /* ModifierFlags.Override */) !== 0)
581
582
  return grammarErrorOnNode(g, modifier, 30 /* Diagnostics.X_0_modifier_cannot_be_used_in_an_ambient_context */, 'override');
582
- if (isClassLike(parent) && node.kind !== 173 /* SyntaxKind.PropertyDeclaration */)
583
+ if (isClassLike(parent) && node.kind !== 174 /* SyntaxKind.PropertyDeclaration */)
583
584
  return grammarErrorOnNode(g, modifier, 24 /* Diagnostics.X_0_modifier_cannot_appear_on_class_elements_of_this_kind */, 'declare');
584
- if (node.kind === 170 /* SyntaxKind.Parameter */)
585
+ if (node.kind === 171 /* SyntaxKind.Parameter */)
585
586
  return grammarErrorOnNode(g, modifier, 59 /* Diagnostics.X_0_modifier_cannot_appear_on_a_parameter */, 'declare');
586
587
  if (blockScopeKind === 4 /* NodeFlags.Using */)
587
- return grammarErrorOnNode(g, modifier, 406 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'declare');
588
+ return grammarErrorOnNode(g, modifier, 404 /* Diagnostics.X_0_modifier_cannot_appear_on_a_using_declaration */, 'declare');
588
589
  if (blockScopeKind === 6 /* NodeFlags.AwaitUsing */)
589
- return grammarErrorOnNode(g, modifier, 410 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'declare');
590
- if ((parent.flags & 8388608 /* NodeFlags.Ambient */) !== 0 && parent.kind === 269 /* SyntaxKind.ModuleBlock */)
590
+ return grammarErrorOnNode(g, modifier, 408 /* Diagnostics.X_0_modifier_cannot_appear_on_an_await_using_declaration */, 'declare');
591
+ if ((parent.flags & 8388608 /* NodeFlags.Ambient */) !== 0 && parent.kind === 270 /* SyntaxKind.ModuleBlock */)
591
592
  return grammarErrorOnNode(g, modifier, 28 /* Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context */);
592
593
  if (isPrivateIdentifierClassElementDeclaration(node))
593
- return grammarErrorOnNode(g, modifier, 1841 /* Diagnostics.X_0_modifier_cannot_be_used_with_a_private_identifier */, 'declare');
594
+ return grammarErrorOnNode(g, modifier, 1861 /* Diagnostics.X_0_modifier_cannot_be_used_with_a_private_identifier */, 'declare');
594
595
  if ((flags & 512 /* ModifierFlags.Accessor */) !== 0)
595
596
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'declare', 'accessor');
596
597
  flags |= 128 /* ModifierFlags.Ambient */;
@@ -599,14 +600,14 @@ function checkGrammarModifiers(g, node) {
599
600
  case 127 /* SyntaxKind.AbstractKeyword */: {
600
601
  if ((flags & 64 /* ModifierFlags.Abstract */) !== 0)
601
602
  return grammarErrorOnNode(g, modifier, 23 /* Diagnostics.X_0_modifier_already_seen */, 'abstract');
602
- if (node.kind !== 264 /* SyntaxKind.ClassDeclaration */ && node.kind !== 186 /* SyntaxKind.ConstructorType */) {
603
- if (node.kind !== 175 /* SyntaxKind.MethodDeclaration */ &&
604
- node.kind !== 173 /* SyntaxKind.PropertyDeclaration */ &&
605
- node.kind !== 178 /* SyntaxKind.GetAccessor */ &&
606
- node.kind !== 179 /* SyntaxKind.SetAccessor */)
603
+ if (node.kind !== 265 /* SyntaxKind.ClassDeclaration */ && node.kind !== 187 /* SyntaxKind.ConstructorType */) {
604
+ if (node.kind !== 176 /* SyntaxKind.MethodDeclaration */ &&
605
+ node.kind !== 174 /* SyntaxKind.PropertyDeclaration */ &&
606
+ node.kind !== 179 /* SyntaxKind.GetAccessor */ &&
607
+ node.kind !== 180 /* SyntaxKind.SetAccessor */)
607
608
  return grammarErrorOnNode(g, modifier, 192 /* Diagnostics.X_abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration */);
608
- if (!(parent.kind === 264 /* SyntaxKind.ClassDeclaration */ && hasSyntacticModifier(parent, 64 /* ModifierFlags.Abstract */)))
609
- return grammarErrorOnNode(g, modifier, node.kind === 173 /* SyntaxKind.PropertyDeclaration */
609
+ if (!(parent.kind === 265 /* SyntaxKind.ClassDeclaration */ && hasSyntacticModifier(parent, 64 /* ModifierFlags.Abstract */)))
610
+ return grammarErrorOnNode(g, modifier, node.kind === 174 /* SyntaxKind.PropertyDeclaration */
610
611
  ? 203 /* Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class */
611
612
  : 194 /* Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class */);
612
613
  if ((flags & 256 /* ModifierFlags.Static */) !== 0)
@@ -622,7 +623,7 @@ function checkGrammarModifiers(g, node) {
622
623
  }
623
624
  const name = getName(node);
624
625
  if (name !== undefined && name.kind === 80 /* SyntaxKind.PrivateIdentifier */)
625
- return grammarErrorOnNode(g, modifier, 1841 /* Diagnostics.X_0_modifier_cannot_be_used_with_a_private_identifier */, 'abstract');
626
+ return grammarErrorOnNode(g, modifier, 1861 /* Diagnostics.X_0_modifier_cannot_be_used_with_a_private_identifier */, 'abstract');
626
627
  flags |= 64 /* ModifierFlags.Abstract */;
627
628
  break;
628
629
  }
@@ -631,7 +632,7 @@ function checkGrammarModifiers(g, node) {
631
632
  return grammarErrorOnNode(g, modifier, 23 /* Diagnostics.X_0_modifier_already_seen */, 'async');
632
633
  if ((flags & 128 /* ModifierFlags.Ambient */) !== 0 || (parent.flags & 8388608 /* NodeFlags.Ambient */) !== 0)
633
634
  return grammarErrorOnNode(g, modifier, 30 /* Diagnostics.X_0_modifier_cannot_be_used_in_an_ambient_context */, 'async');
634
- if (node.kind === 170 /* SyntaxKind.Parameter */)
635
+ if (node.kind === 171 /* SyntaxKind.Parameter */)
635
636
  return grammarErrorOnNode(g, modifier, 59 /* Diagnostics.X_0_modifier_cannot_appear_on_a_parameter */, 'async');
636
637
  if ((flags & 64 /* ModifierFlags.Abstract */) !== 0)
637
638
  return grammarErrorOnNode(g, modifier, 193 /* Diagnostics.X_0_modifier_cannot_be_used_with_1_modifier */, 'async', 'abstract');
@@ -642,11 +643,11 @@ function checkGrammarModifiers(g, node) {
642
643
  case 147 /* SyntaxKind.OutKeyword */: {
643
644
  const inOutFlag = kind === 102 /* SyntaxKind.InKeyword */ ? 8192 /* ModifierFlags.In */ : 16384 /* ModifierFlags.Out */;
644
645
  const inOutText = kind === 102 /* SyntaxKind.InKeyword */ ? 'in' : 'out';
645
- if (node.kind !== 169 /* SyntaxKind.TypeParameter */ ||
646
- !(parent.kind === 265 /* SyntaxKind.InterfaceDeclaration */ ||
646
+ if (node.kind !== 170 /* SyntaxKind.TypeParameter */ ||
647
+ !(parent.kind === 266 /* SyntaxKind.InterfaceDeclaration */ ||
647
648
  isClassLike(parent) ||
648
- parent.kind === 266 /* SyntaxKind.TypeAliasDeclaration */ ||
649
- parent.kind === 345 /* SyntaxKind.JSTypeAliasDeclaration */))
649
+ parent.kind === 267 /* SyntaxKind.TypeAliasDeclaration */ ||
650
+ parent.kind === 346 /* SyntaxKind.JSTypeAliasDeclaration */))
650
651
  return grammarErrorOnNode(g, modifier, 223 /* Diagnostics.X_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias */, inOutText);
651
652
  if ((flags & inOutFlag) !== 0)
652
653
  return grammarErrorOnNode(g, modifier, 23 /* Diagnostics.X_0_modifier_already_seen */, inOutText);
@@ -657,7 +658,7 @@ function checkGrammarModifiers(g, node) {
657
658
  }
658
659
  }
659
660
  }
660
- if (node.kind === 177 /* SyntaxKind.Constructor */) {
661
+ if (node.kind === 178 /* SyntaxKind.Constructor */) {
661
662
  if ((flags & 256 /* ModifierFlags.Static */) !== 0)
662
663
  return grammarErrorOnNode(g, lastStatic, 58 /* Diagnostics.X_0_modifier_cannot_appear_on_a_constructor_declaration */, 'static');
663
664
  if ((flags & 16 /* ModifierFlags.Override */) !== 0)
@@ -666,12 +667,12 @@ function checkGrammarModifiers(g, node) {
666
667
  return grammarErrorOnNode(g, lastAsync, 58 /* Diagnostics.X_0_modifier_cannot_appear_on_a_constructor_declaration */, 'async');
667
668
  return false;
668
669
  }
669
- if ((node.kind === 273 /* SyntaxKind.ImportDeclaration */ ||
670
- node.kind === 346 /* SyntaxKind.JSImportDeclaration */ ||
671
- node.kind === 272 /* SyntaxKind.ImportEqualsDeclaration */) &&
670
+ if ((node.kind === 274 /* SyntaxKind.ImportDeclaration */ ||
671
+ node.kind === 347 /* SyntaxKind.JSImportDeclaration */ ||
672
+ node.kind === 273 /* SyntaxKind.ImportEqualsDeclaration */) &&
672
673
  (flags & 128 /* ModifierFlags.Ambient */) !== 0)
673
674
  return grammarErrorOnNode(g, lastDeclare, 56 /* Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration */, 'declare');
674
- if (node.kind === 170 /* SyntaxKind.Parameter */ && (flags & 31 /* ModifierFlags.ParameterPropertyModifier */) !== 0) {
675
+ if (node.kind === 171 /* SyntaxKind.Parameter */ && (flags & 31 /* ModifierFlags.ParameterPropertyModifier */) !== 0) {
675
676
  const parameter = node;
676
677
  if (isBindingPattern(parameter.name))
677
678
  return grammarErrorOnNode(g, node, 143 /* Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern */);
@@ -684,11 +685,11 @@ function checkGrammarModifiers(g, node) {
684
685
  }
685
686
  function isConstTypeParameterContainer(parent) {
686
687
  switch (parent.kind) {
687
- case 185 /* SyntaxKind.FunctionType */:
688
- case 186 /* SyntaxKind.ConstructorType */:
689
- case 180 /* SyntaxKind.CallSignature */:
690
- case 181 /* SyntaxKind.ConstructSignature */:
691
- case 174 /* SyntaxKind.MethodSignature */:
688
+ case 186 /* SyntaxKind.FunctionType */:
689
+ case 187 /* SyntaxKind.ConstructorType */:
690
+ case 181 /* SyntaxKind.CallSignature */:
691
+ case 182 /* SyntaxKind.ConstructSignature */:
692
+ case 175 /* SyntaxKind.MethodSignature */:
692
693
  return true;
693
694
  }
694
695
  return isFunctionLikeDeclarationKind(parent.kind) || isClassLike(parent);
@@ -709,47 +710,47 @@ function findFirstModifierExcept(modifiers, allowedModifier) {
709
710
  }
710
711
  function findFirstIllegalModifier(node, modifiers) {
711
712
  switch (node.kind) {
712
- case 178 /* SyntaxKind.GetAccessor */:
713
- case 179 /* SyntaxKind.SetAccessor */:
714
- case 177 /* SyntaxKind.Constructor */:
715
- case 173 /* SyntaxKind.PropertyDeclaration */:
716
- case 172 /* SyntaxKind.PropertySignature */:
717
- case 175 /* SyntaxKind.MethodDeclaration */:
718
- case 174 /* SyntaxKind.MethodSignature */:
719
- case 182 /* SyntaxKind.IndexSignature */:
720
- case 268 /* SyntaxKind.ModuleDeclaration */:
721
- case 273 /* SyntaxKind.ImportDeclaration */:
722
- case 346 /* SyntaxKind.JSImportDeclaration */:
723
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
724
- case 279 /* SyntaxKind.ExportDeclaration */:
725
- case 278 /* SyntaxKind.ExportAssignment */:
726
- case 219 /* SyntaxKind.FunctionExpression */:
727
- case 220 /* SyntaxKind.ArrowFunction */:
728
- case 170 /* SyntaxKind.Parameter */:
729
- case 169 /* SyntaxKind.TypeParameter */:
730
- case 345 /* SyntaxKind.JSTypeAliasDeclaration */:
713
+ case 179 /* SyntaxKind.GetAccessor */:
714
+ case 180 /* SyntaxKind.SetAccessor */:
715
+ case 178 /* SyntaxKind.Constructor */:
716
+ case 174 /* SyntaxKind.PropertyDeclaration */:
717
+ case 173 /* SyntaxKind.PropertySignature */:
718
+ case 176 /* SyntaxKind.MethodDeclaration */:
719
+ case 175 /* SyntaxKind.MethodSignature */:
720
+ case 183 /* SyntaxKind.IndexSignature */:
721
+ case 269 /* SyntaxKind.ModuleDeclaration */:
722
+ case 274 /* SyntaxKind.ImportDeclaration */:
723
+ case 347 /* SyntaxKind.JSImportDeclaration */:
724
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
725
+ case 280 /* SyntaxKind.ExportDeclaration */:
726
+ case 279 /* SyntaxKind.ExportAssignment */:
727
+ case 220 /* SyntaxKind.FunctionExpression */:
728
+ case 221 /* SyntaxKind.ArrowFunction */:
729
+ case 171 /* SyntaxKind.Parameter */:
730
+ case 170 /* SyntaxKind.TypeParameter */:
731
+ case 346 /* SyntaxKind.JSTypeAliasDeclaration */:
731
732
  return undefined;
732
- case 176 /* SyntaxKind.ClassStaticBlockDeclaration */:
733
- case 303 /* SyntaxKind.PropertyAssignment */:
734
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
735
- case 271 /* SyntaxKind.NamespaceExportDeclaration */:
736
- case 283 /* SyntaxKind.MissingDeclaration */:
733
+ case 177 /* SyntaxKind.ClassStaticBlockDeclaration */:
734
+ case 304 /* SyntaxKind.PropertyAssignment */:
735
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
736
+ case 272 /* SyntaxKind.NamespaceExportDeclaration */:
737
+ case 284 /* SyntaxKind.MissingDeclaration */:
737
738
  return findFirstModifier(modifiers);
738
739
  }
739
740
  const parent = node.parent;
740
- if (parent.kind === 269 /* SyntaxKind.ModuleBlock */ || parent.kind === 307 /* SyntaxKind.SourceFile */)
741
+ if (parent.kind === 270 /* SyntaxKind.ModuleBlock */ || parent.kind === 308 /* SyntaxKind.SourceFile */)
741
742
  return undefined;
742
743
  switch (node.kind) {
743
- case 263 /* SyntaxKind.FunctionDeclaration */:
744
+ case 264 /* SyntaxKind.FunctionDeclaration */:
744
745
  return findFirstModifierExcept(modifiers, 133 /* SyntaxKind.AsyncKeyword */);
745
- case 264 /* SyntaxKind.ClassDeclaration */:
746
- case 186 /* SyntaxKind.ConstructorType */:
746
+ case 265 /* SyntaxKind.ClassDeclaration */:
747
+ case 187 /* SyntaxKind.ConstructorType */:
747
748
  return findFirstModifierExcept(modifiers, 127 /* SyntaxKind.AbstractKeyword */);
748
- case 244 /* SyntaxKind.VariableStatement */:
749
+ case 245 /* SyntaxKind.VariableStatement */:
749
750
  if ((node.declarationList.flags & 4 /* NodeFlags.Using */) !== 0)
750
751
  return findFirstModifierExcept(modifiers, 134 /* SyntaxKind.AwaitKeyword */);
751
752
  return findFirstModifier(modifiers);
752
- case 267 /* SyntaxKind.EnumDeclaration */:
753
+ case 268 /* SyntaxKind.EnumDeclaration */:
753
754
  return findFirstModifierExcept(modifiers, 86 /* SyntaxKind.ConstKeyword */);
754
755
  }
755
756
  // Class expressions, interfaces and type aliases.
@@ -759,16 +760,16 @@ function reportObviousDecoratorErrors(g, node, modifiers) {
759
760
  if (!canHaveIllegalDecorators(node))
760
761
  return false;
761
762
  for (const modifier of modifiers.nodes)
762
- if (modifier.kind === 171 /* SyntaxKind.Decorator */)
763
+ if (modifier.kind === 172 /* SyntaxKind.Decorator */)
763
764
  return grammarErrorOnFirstToken(g, modifier, 160 /* Diagnostics.Decorators_are_not_valid_here */);
764
765
  return false;
765
766
  }
766
767
  function checkGrammarAsyncModifier(g, node, asyncModifier) {
767
768
  switch (node.kind) {
768
- case 175 /* SyntaxKind.MethodDeclaration */:
769
- case 263 /* SyntaxKind.FunctionDeclaration */:
770
- case 219 /* SyntaxKind.FunctionExpression */:
771
- case 220 /* SyntaxKind.ArrowFunction */:
769
+ case 176 /* SyntaxKind.MethodDeclaration */:
770
+ case 264 /* SyntaxKind.FunctionDeclaration */:
771
+ case 220 /* SyntaxKind.FunctionExpression */:
772
+ case 221 /* SyntaxKind.ArrowFunction */:
772
773
  return false;
773
774
  }
774
775
  return grammarErrorOnNode(g, asyncModifier, 31 /* Diagnostics.X_0_modifier_cannot_be_used_here */, 'async');
@@ -778,7 +779,7 @@ function hasDecorators(node) {
778
779
  if (modifiers === undefined)
779
780
  return false;
780
781
  for (const modifier of modifiers.nodes)
781
- if (modifier.kind === 171 /* SyntaxKind.Decorator */)
782
+ if (modifier.kind === 172 /* SyntaxKind.Decorator */)
782
783
  return true;
783
784
  return false;
784
785
  }
@@ -789,30 +790,30 @@ function nodeCanBeDecorated(legacy, node, parent, grandparent) {
789
790
  if (legacy && name !== undefined && name.kind === 80 /* SyntaxKind.PrivateIdentifier */)
790
791
  return false;
791
792
  switch (node.kind) {
792
- case 264 /* SyntaxKind.ClassDeclaration */:
793
+ case 265 /* SyntaxKind.ClassDeclaration */:
793
794
  return true;
794
- case 232 /* SyntaxKind.ClassExpression */:
795
+ case 233 /* SyntaxKind.ClassExpression */:
795
796
  return !legacy;
796
- case 173 /* SyntaxKind.PropertyDeclaration */:
797
+ case 174 /* SyntaxKind.PropertyDeclaration */:
797
798
  return (parent !== undefined &&
798
799
  (legacy
799
- ? parent.kind === 264 /* SyntaxKind.ClassDeclaration */
800
+ ? parent.kind === 265 /* SyntaxKind.ClassDeclaration */
800
801
  : isClassLike(parent) && !hasSyntacticModifier(node, 64 /* ModifierFlags.Abstract */ | 128 /* ModifierFlags.Ambient */)));
801
- case 178 /* SyntaxKind.GetAccessor */:
802
- case 179 /* SyntaxKind.SetAccessor */:
803
- case 175 /* SyntaxKind.MethodDeclaration */:
802
+ case 179 /* SyntaxKind.GetAccessor */:
803
+ case 180 /* SyntaxKind.SetAccessor */:
804
+ case 176 /* SyntaxKind.MethodDeclaration */:
804
805
  return (parent !== undefined &&
805
806
  getBody(node) !== undefined &&
806
- (legacy ? parent.kind === 264 /* SyntaxKind.ClassDeclaration */ : isClassLike(parent)));
807
- case 170 /* SyntaxKind.Parameter */:
807
+ (legacy ? parent.kind === 265 /* SyntaxKind.ClassDeclaration */ : isClassLike(parent)));
808
+ case 171 /* SyntaxKind.Parameter */:
808
809
  if (!legacy || parent === undefined || getBody(parent) === undefined)
809
810
  return false;
810
- return ((parent.kind === 177 /* SyntaxKind.Constructor */ ||
811
- parent.kind === 175 /* SyntaxKind.MethodDeclaration */ ||
812
- parent.kind === 179 /* SyntaxKind.SetAccessor */) &&
811
+ return ((parent.kind === 178 /* SyntaxKind.Constructor */ ||
812
+ parent.kind === 176 /* SyntaxKind.MethodDeclaration */ ||
813
+ parent.kind === 180 /* SyntaxKind.SetAccessor */) &&
813
814
  getThisParameter(parent) !== node &&
814
815
  grandparent !== undefined &&
815
- grandparent.kind === 264 /* SyntaxKind.ClassDeclaration */);
816
+ grandparent.kind === 265 /* SyntaxKind.ClassDeclaration */);
816
817
  }
817
818
  return false;
818
819
  }
@@ -821,7 +822,7 @@ function getFirstAccessorOfPair(c, node) {
821
822
  const symbol = getSymbolOfDeclaration(c, node);
822
823
  if (symbol === undefined)
823
824
  return node;
824
- const otherKind = node.kind === 178 /* SyntaxKind.GetAccessor */ ? 179 /* SyntaxKind.SetAccessor */ : 178 /* SyntaxKind.GetAccessor */;
825
+ const otherKind = node.kind === 179 /* SyntaxKind.GetAccessor */ ? 180 /* SyntaxKind.SetAccessor */ : 179 /* SyntaxKind.GetAccessor */;
825
826
  for (const declaration of getDeclarations(symbol))
826
827
  if (declaration.kind === otherKind && declaration.pos < node.pos)
827
828
  return declaration;
@@ -834,7 +835,7 @@ function checkGrammarDecorators(g, node) {
834
835
  if (!nodeCanBeDecorated(g.legacyDecorators, node, node.parent, node.parent.parent))
835
836
  return;
836
837
  for (const modifier of getModifiers(node).nodes)
837
- if (modifier.kind === 171 /* SyntaxKind.Decorator */)
838
+ if (modifier.kind === 172 /* SyntaxKind.Decorator */)
838
839
  checkGrammarDecorator(g, modifier);
839
840
  }
840
841
  function checkGrammarDecorator(g, decorator) {
@@ -842,18 +843,18 @@ function checkGrammarDecorator(g, decorator) {
842
843
  return false;
843
844
  let node = decorator.expression;
844
845
  // `@(expression)`
845
- if (node.kind === 218 /* SyntaxKind.ParenthesizedExpression */)
846
+ if (node.kind === 219 /* SyntaxKind.ParenthesizedExpression */)
846
847
  return false;
847
848
  let canHaveCallExpression = true;
848
849
  let errorNode;
849
850
  for (;;) {
850
851
  // Non-null assertions and instantiation expressions are allowed.
851
- if (node.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */ || node.kind === 236 /* SyntaxKind.NonNullExpression */) {
852
+ if (node.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */ || node.kind === 237 /* SyntaxKind.NonNullExpression */) {
852
853
  node = getExpression(node);
853
854
  continue;
854
855
  }
855
856
  // `@member.expression(arguments)`
856
- if (node.kind === 214 /* SyntaxKind.CallExpression */) {
857
+ if (node.kind === 215 /* SyntaxKind.CallExpression */) {
857
858
  const call = node;
858
859
  if (!canHaveCallExpression)
859
860
  errorNode = node;
@@ -865,7 +866,7 @@ function checkGrammarDecorator(g, decorator) {
865
866
  continue;
866
867
  }
867
868
  // `@identifier`, `@member.name` and `@member.#name`
868
- if (node.kind === 212 /* SyntaxKind.PropertyAccessExpression */) {
869
+ if (node.kind === 213 /* SyntaxKind.PropertyAccessExpression */) {
869
870
  const access = node;
870
871
  if (access.questionDotToken !== undefined)
871
872
  errorNode = access.questionDotToken;
@@ -879,8 +880,8 @@ function checkGrammarDecorator(g, decorator) {
879
880
  }
880
881
  if (errorNode === undefined)
881
882
  return false;
882
- const diagnostic = g.c.error(decorator.expression, 412 /* Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator */);
883
- addRelated(diagnostic, errorNode, 413 /* Diagnostics.Invalid_syntax_in_decorator */);
883
+ const diagnostic = g.c.error(decorator.expression, 410 /* Diagnostics.Expression_must_be_enclosed_in_parentheses_to_be_used_as_a_decorator */);
884
+ addRelated(diagnostic, errorNode, 411 /* Diagnostics.Invalid_syntax_in_decorator */);
884
885
  return true;
885
886
  }
886
887
  // ---- Functions and parameters
@@ -933,7 +934,7 @@ function checkGrammarForUseStrictSimpleParameterList(g, node) {
933
934
  if (g.c.languageVersion < ScriptTarget.ES2016)
934
935
  return false;
935
936
  const body = getBody(node);
936
- if (body === undefined || body.kind !== 242 /* SyntaxKind.Block */)
937
+ if (body === undefined || body.kind !== 243 /* SyntaxKind.Block */)
937
938
  return false;
938
939
  const useStrictDirective = findUseStrictPrologue(g.file, getStatements(body).nodes);
939
940
  if (useStrictDirective === undefined)
@@ -952,11 +953,11 @@ function checkGrammarForUseStrictSimpleParameterList(g, node) {
952
953
  }
953
954
  const diagnostic = g.c.error(useStrictDirective, 281 /* Diagnostics.X_use_strict_directive_cannot_be_used_with_non_simple_parameter_list */);
954
955
  for (let i = 0; i < nonSimpleParameters.length; i++)
955
- addRelated(diagnostic, nonSimpleParameters[i], i === 0 ? 282 /* Diagnostics.Non_simple_parameter_declared_here */ : 1357 /* Diagnostics.X_and_here */);
956
+ addRelated(diagnostic, nonSimpleParameters[i], i === 0 ? 282 /* Diagnostics.Non_simple_parameter_declared_here */ : 1368 /* Diagnostics.X_and_here */);
956
957
  return true;
957
958
  }
958
959
  function checkGrammarArrowFunction(g, node) {
959
- if (node.kind !== 220 /* SyntaxKind.ArrowFunction */)
960
+ if (node.kind !== 221 /* SyntaxKind.ArrowFunction */)
960
961
  return false;
961
962
  const arrow = node;
962
963
  const typeParameters = arrow.typeParameters;
@@ -965,7 +966,7 @@ function checkGrammarArrowFunction(g, node) {
965
966
  const hasConstraint = nodes.length > 0 && nodes[0].constraint !== undefined;
966
967
  if (!(nodes.length > 1 || typeParameters.hasTrailingComma() || hasConstraint) &&
967
968
  fileExtensionIsOneOf(g.file.fileName, ['.mts', '.cts']))
968
- grammarErrorOnNode(g, nodes[0], 1731 /* Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint */);
969
+ grammarErrorOnNode(g, nodes[0], 1750 /* Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint */);
969
970
  }
970
971
  const arrowToken = arrow.equalsGreaterThanToken;
971
972
  if (arrowToken === undefined)
@@ -998,7 +999,7 @@ function checkGrammarForGenerator(g, node) {
998
999
  return false;
999
1000
  }
1000
1001
  function isThisParameter(node) {
1001
- if (node.kind !== 170 /* SyntaxKind.Parameter */)
1002
+ if (node.kind !== 171 /* SyntaxKind.Parameter */)
1002
1003
  return false;
1003
1004
  const name = node.name;
1004
1005
  return name instanceof Identifier && name.text === 'this';
@@ -1012,7 +1013,7 @@ function getThisParameter(signature) {
1012
1013
  }
1013
1014
  function isBindingPattern(node) {
1014
1015
  return (node !== undefined &&
1015
- (node.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || node.kind === 208 /* SyntaxKind.ArrayBindingPattern */));
1016
+ (node.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || node.kind === 209 /* SyntaxKind.ArrayBindingPattern */));
1016
1017
  }
1017
1018
  // ---- Signatures and members
1018
1019
  function checkGrammarIndexSignatureParameters(g, node) {
@@ -1069,7 +1070,7 @@ function checkGrammarTypeArguments(g, typeArguments) {
1069
1070
  }
1070
1071
  function checkGrammarExpressionWithTypeArguments(g, node) {
1071
1072
  const typeArguments = getTypeArguments(node);
1072
- if (node.kind === 234 /* SyntaxKind.ExpressionWithTypeArguments */ &&
1073
+ if (node.kind === 235 /* SyntaxKind.ExpressionWithTypeArguments */ &&
1073
1074
  node.expression.kind === 101 /* SyntaxKind.ImportKeyword */ &&
1074
1075
  typeArguments !== undefined)
1075
1076
  return grammarErrorOnNode(g, node, 262 /* Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments */);
@@ -1091,14 +1092,14 @@ function checkGrammarClassDeclaration(g, node) {
1091
1092
  if (g.legacyDecorators && modifiers !== undefined) {
1092
1093
  let firstDecorator;
1093
1094
  for (const modifier of modifiers.nodes)
1094
- if (modifier.kind === 171 /* SyntaxKind.Decorator */) {
1095
+ if (modifier.kind === 172 /* SyntaxKind.Decorator */) {
1095
1096
  firstDecorator = modifier;
1096
1097
  break;
1097
1098
  }
1098
1099
  if (firstDecorator !== undefined)
1099
1100
  for (const member of getMembers(node).nodes)
1100
1101
  if (hasSyntacticModifier(member, 256 /* ModifierFlags.Static */) && isPrivateIdentifierClassElementDeclaration(member)) {
1101
- grammarErrorOnNode(g, firstDecorator, 1853 /* Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator */);
1102
+ grammarErrorOnNode(g, firstDecorator, 1873 /* Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator */);
1102
1103
  break;
1103
1104
  }
1104
1105
  }
@@ -1133,11 +1134,6 @@ function checkGrammarClassDeclarationHeritageClauses(g, node) {
1133
1134
  return grammarErrorOnFirstToken(g, clause, 129 /* Diagnostics.X_extends_clause_must_precede_implements_clause */);
1134
1135
  if (clause.types.nodes.length > 1)
1135
1136
  return grammarErrorOnFirstToken(g, clause.types.nodes[1], 130 /* Diagnostics.Classes_can_only_extend_a_single_class */);
1136
- if (clause.types.nodes.length > 0) {
1137
- const mismatch = findMismatchedAugmentsTag(node, clause.types.nodes[0]);
1138
- if (mismatch !== undefined)
1139
- return grammarErrorOnNode(g, mismatch.name, 1752 /* Diagnostics.JSDoc_0_1_does_not_match_the_extends_2_clause */, mismatch.tagName, mismatch.className, mismatch.extendsName);
1140
- }
1141
1137
  seenExtendsClause = true;
1142
1138
  }
1143
1139
  else {
@@ -1179,10 +1175,10 @@ function checkGrammarInterfaceDeclaration(g, node) {
1179
1175
  checkGrammarTypeArguments(g, getTypeArguments(type));
1180
1176
  }
1181
1177
  function checkGrammarComputedPropertyName(g, node) {
1182
- if (node.kind !== 168 /* SyntaxKind.ComputedPropertyName */)
1178
+ if (node.kind !== 169 /* SyntaxKind.ComputedPropertyName */)
1183
1179
  return false;
1184
1180
  const expression = node.expression;
1185
- return (expression.kind === 227 /* SyntaxKind.BinaryExpression */ &&
1181
+ return (expression.kind === 228 /* SyntaxKind.BinaryExpression */ &&
1186
1182
  expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ &&
1187
1183
  grammarErrorOnNode(g, expression, 127 /* Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name */));
1188
1184
  }
@@ -1201,13 +1197,13 @@ function isNonBindableDynamicName(c, node) {
1201
1197
  if (!isDynamicName(node))
1202
1198
  return false;
1203
1199
  let expression;
1204
- if (node.kind === 168 /* SyntaxKind.ComputedPropertyName */)
1200
+ if (node.kind === 169 /* SyntaxKind.ComputedPropertyName */)
1205
1201
  expression = getExpression(node);
1206
1202
  else if (node instanceof ElementAccessExpression)
1207
1203
  expression = node.argumentExpression;
1208
1204
  if (expression === undefined || !isEntityNameExpression(expression, false))
1209
1205
  return true;
1210
- const t = node.kind === 168 /* SyntaxKind.ComputedPropertyName */
1206
+ const t = node.kind === 169 /* SyntaxKind.ComputedPropertyName */
1211
1207
  ? checkComputedPropertyName(c, node)
1212
1208
  : checkExpressionCached(c, expression);
1213
1209
  return !isTypeUsableAsPropertyName(t);
@@ -1219,7 +1215,7 @@ function checkGrammarForInvalidDynamicName(g, node, message) {
1219
1215
  return !isEntityNameExpression(expression, false) && grammarErrorOnNode(g, node, message);
1220
1216
  }
1221
1217
  function checkGrammarMethodDeclaration(g, node) {
1222
- if (node.parent.kind === 211 /* SyntaxKind.ObjectLiteralExpression */) {
1218
+ if (node.parent.kind === 212 /* SyntaxKind.ObjectLiteralExpression */) {
1223
1219
  // `checkObjectLiteralMethod` checks the method, then checks it again as a function expression.
1224
1220
  checkGrammarMethod(g, node);
1225
1221
  checkGrammarFunctionLikeDeclaration(g, node);
@@ -1233,14 +1229,14 @@ function checkGrammarMethodDeclaration(g, node) {
1233
1229
  }
1234
1230
  checkGrammarDecorators(g, node);
1235
1231
  if (name.kind === 80 /* SyntaxKind.PrivateIdentifier */ && getContainingClass(node) === undefined)
1236
- g.c.error(node, 1838 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
1232
+ g.c.error(node, 1858 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
1237
1233
  }
1238
1234
  function checkGrammarMethod(g, node) {
1239
1235
  if (checkGrammarFunctionLikeDeclaration(g, node))
1240
1236
  return true;
1241
1237
  const parent = node.parent;
1242
- if (node.kind === 175 /* SyntaxKind.MethodDeclaration */) {
1243
- if (parent.kind === 211 /* SyntaxKind.ObjectLiteralExpression */) {
1238
+ if (node.kind === 176 /* SyntaxKind.MethodDeclaration */) {
1239
+ if (parent.kind === 212 /* SyntaxKind.ObjectLiteralExpression */) {
1244
1240
  // Only `async` is allowed on object literal methods.
1245
1241
  const modifiers = getModifiers(node);
1246
1242
  if (modifiers !== undefined &&
@@ -1263,13 +1259,13 @@ function checkGrammarMethod(g, node) {
1263
1259
  // those report other errors first.
1264
1260
  if ((node.flags & 8388608 /* NodeFlags.Ambient */) !== 0)
1265
1261
  return checkGrammarForInvalidDynamicName(g, name, 122 /* Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */);
1266
- if (node.kind === 175 /* SyntaxKind.MethodDeclaration */ && getBody(node) === undefined)
1262
+ if (node.kind === 176 /* SyntaxKind.MethodDeclaration */ && getBody(node) === undefined)
1267
1263
  return checkGrammarForInvalidDynamicName(g, name, 124 /* Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */);
1268
1264
  }
1269
- else if (parent.kind === 265 /* SyntaxKind.InterfaceDeclaration */) {
1265
+ else if (parent.kind === 266 /* SyntaxKind.InterfaceDeclaration */) {
1270
1266
  return checkGrammarForInvalidDynamicName(g, name, 125 /* Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */);
1271
1267
  }
1272
- else if (parent.kind === 188 /* SyntaxKind.TypeLiteral */) {
1268
+ else if (parent.kind === 189 /* SyntaxKind.TypeLiteral */) {
1273
1269
  return checkGrammarForInvalidDynamicName(g, name, 126 /* Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */);
1274
1270
  }
1275
1271
  return false;
@@ -1290,7 +1286,7 @@ function checkGrammarAccessorDeclaration(g, node) {
1290
1286
  function checkGrammarAccessor(g, accessor) {
1291
1287
  const body = getBody(accessor);
1292
1288
  const parent = accessor.parent;
1293
- const inTypeMember = parent.kind === 188 /* SyntaxKind.TypeLiteral */ || parent.kind === 265 /* SyntaxKind.InterfaceDeclaration */;
1289
+ const inTypeMember = parent.kind === 189 /* SyntaxKind.TypeLiteral */ || parent.kind === 266 /* SyntaxKind.InterfaceDeclaration */;
1294
1290
  const isAbstract = hasSyntacticModifier(accessor, 64 /* ModifierFlags.Abstract */);
1295
1291
  if ((accessor.flags & 8388608 /* NodeFlags.Ambient */) === 0 && !inTypeMember && body === undefined && !isAbstract)
1296
1292
  return grammarErrorAtPos(g, accessor.end - 1, 1, 2 /* Diagnostics.X_0_expected */, '{');
@@ -1304,7 +1300,7 @@ function checkGrammarAccessor(g, accessor) {
1304
1300
  if (getTypeParameters(accessor) !== undefined)
1305
1301
  return grammarErrorOnNode(g, name, 63 /* Diagnostics.An_accessor_cannot_have_type_parameters */);
1306
1302
  const parameters = getParameters(accessor).nodes;
1307
- const isGetter = accessor.kind === 178 /* SyntaxKind.GetAccessor */;
1303
+ const isGetter = accessor.kind === 179 /* SyntaxKind.GetAccessor */;
1308
1304
  // A `this` parameter only counts with the right number of other parameters.
1309
1305
  const hasThisParameter = parameters.length === (isGetter ? 1 : 2) && isThisParameter(parameters[0]);
1310
1306
  if (!hasThisParameter && parameters.length !== (isGetter ? 0 : 1))
@@ -1331,29 +1327,29 @@ function checkGrammarPropertyDeclaration(g, node) {
1331
1327
  function checkGrammarProperty(g, node) {
1332
1328
  const name = getName(node);
1333
1329
  const parent = node.parent;
1334
- if (name.kind === 168 /* SyntaxKind.ComputedPropertyName */) {
1330
+ if (name.kind === 169 /* SyntaxKind.ComputedPropertyName */) {
1335
1331
  const expression = name.expression;
1336
- if (expression.kind === 227 /* SyntaxKind.BinaryExpression */ &&
1332
+ if (expression.kind === 228 /* SyntaxKind.BinaryExpression */ &&
1337
1333
  expression.operatorToken.kind === 102 /* SyntaxKind.InKeyword */)
1338
- return grammarErrorOnNode(g, getMembers(parent).nodes[0], 1732 /* Diagnostics.A_mapped_type_may_not_declare_properties_or_methods */);
1334
+ return grammarErrorOnNode(g, getMembers(parent).nodes[0], 1751 /* Diagnostics.A_mapped_type_may_not_declare_properties_or_methods */);
1339
1335
  }
1340
1336
  if (isClassLike(parent)) {
1341
1337
  if (name instanceof StringLiteral && name.text === 'constructor')
1342
- return grammarErrorOnNode(g, name, 1829 /* Diagnostics.Classes_may_not_have_a_field_named_constructor */);
1338
+ return grammarErrorOnNode(g, name, 1849 /* Diagnostics.Classes_may_not_have_a_field_named_constructor */);
1343
1339
  if (checkGrammarForInvalidDynamicName(g, name, 123 /* Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_have_a_simple_literal_type_or_a_unique_symbol_type */))
1344
1340
  return true;
1345
1341
  if (isAutoAccessorPropertyDeclaration(node) &&
1346
1342
  checkGrammarForInvalidQuestionMark(g, getPostfixToken(node), 225 /* Diagnostics.An_accessor_property_cannot_be_declared_optional */))
1347
1343
  return true;
1348
1344
  }
1349
- else if (parent.kind === 265 /* SyntaxKind.InterfaceDeclaration */) {
1345
+ else if (parent.kind === 266 /* SyntaxKind.InterfaceDeclaration */) {
1350
1346
  if (checkGrammarForInvalidDynamicName(g, name, 125 /* Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */))
1351
1347
  return true;
1352
1348
  const initializer = getInitializer(node);
1353
1349
  if (initializer !== undefined)
1354
1350
  return grammarErrorOnNode(g, initializer, 196 /* Diagnostics.An_interface_property_cannot_have_an_initializer */);
1355
1351
  }
1356
- else if (parent.kind === 188 /* SyntaxKind.TypeLiteral */) {
1352
+ else if (parent.kind === 189 /* SyntaxKind.TypeLiteral */) {
1357
1353
  if (checkGrammarForInvalidDynamicName(g, name, 126 /* Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type */))
1358
1354
  return true;
1359
1355
  const initializer = getInitializer(node);
@@ -1362,7 +1358,7 @@ function checkGrammarProperty(g, node) {
1362
1358
  }
1363
1359
  if ((node.flags & 8388608 /* NodeFlags.Ambient */) !== 0)
1364
1360
  checkAmbientInitializer(g, node);
1365
- if (node.kind === 173 /* SyntaxKind.PropertyDeclaration */) {
1361
+ if (node.kind === 174 /* SyntaxKind.PropertyDeclaration */) {
1366
1362
  const property = node;
1367
1363
  const postfixToken = property.postfixToken;
1368
1364
  if (postfixToken !== undefined && postfixToken.kind === 53 /* SyntaxKind.ExclamationToken */) {
@@ -1388,7 +1384,7 @@ function checkAmbientInitializer(g, node) {
1388
1384
  initializer.kind === 111 /* SyntaxKind.TrueKeyword */ ||
1389
1385
  initializer.kind === 96 /* SyntaxKind.FalseKeyword */ ||
1390
1386
  isInitializerBigIntLiteralExpression(initializer));
1391
- const isConstOrReadonly = isDeclarationReadonly(node) || (node.kind === 261 /* SyntaxKind.VariableDeclaration */ && isVarConstLike(node));
1387
+ const isConstOrReadonly = isDeclarationReadonly(node) || (node.kind === 262 /* SyntaxKind.VariableDeclaration */ && isVarConstLike(node));
1392
1388
  if (!isConstOrReadonly || getType(node) !== undefined)
1393
1389
  return grammarErrorOnNode(g, initializer, 29 /* Diagnostics.Initializers_are_not_allowed_in_ambient_contexts */);
1394
1390
  if (isInvalidInitializer)
@@ -1397,7 +1393,7 @@ function checkAmbientInitializer(g, node) {
1397
1393
  }
1398
1394
  function isDeclarationReadonly(node) {
1399
1395
  return ((getCombinedModifierFlags(node) & 8 /* ModifierFlags.Readonly */) !== 0 &&
1400
- !(node.kind === 170 /* SyntaxKind.Parameter */ && node.parent.kind === 177 /* SyntaxKind.Constructor */));
1396
+ !(node.kind === 171 /* SyntaxKind.Parameter */ && node.parent.kind === 178 /* SyntaxKind.Constructor */));
1401
1397
  }
1402
1398
  function isVarConstLike(node) {
1403
1399
  const blockScopeKind = getCombinedNodeFlags(node) & 7 /* NodeFlags.BlockScoped */;
@@ -1409,7 +1405,7 @@ function isInitializerStringOrNumberLiteralExpression(expression) {
1409
1405
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
1410
1406
  case 8 /* SyntaxKind.NumericLiteral */:
1411
1407
  return true;
1412
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
1408
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
1413
1409
  const unary = expression;
1414
1410
  return unary.operator === 40 /* SyntaxKind.MinusToken */ && unary.operand.kind === 8 /* SyntaxKind.NumericLiteral */;
1415
1411
  }
@@ -1419,13 +1415,13 @@ function isInitializerStringOrNumberLiteralExpression(expression) {
1419
1415
  function isInitializerBigIntLiteralExpression(expression) {
1420
1416
  if (expression.kind === 9 /* SyntaxKind.BigIntLiteral */)
1421
1417
  return true;
1422
- if (expression.kind !== 225 /* SyntaxKind.PrefixUnaryExpression */)
1418
+ if (expression.kind !== 226 /* SyntaxKind.PrefixUnaryExpression */)
1423
1419
  return false;
1424
1420
  const unary = expression;
1425
1421
  return unary.operator === 40 /* SyntaxKind.MinusToken */ && unary.operand.kind === 9 /* SyntaxKind.BigIntLiteral */;
1426
1422
  }
1427
1423
  function isInitializerSimpleLiteralEnumReference(c, expression) {
1428
- if (expression.kind === 212 /* SyntaxKind.PropertyAccessExpression */)
1424
+ if (expression.kind === 213 /* SyntaxKind.PropertyAccessExpression */)
1429
1425
  return (checkExpressionCached(c, expression).flags & 98304 /* TypeFlags.EnumLike */) !== 0;
1430
1426
  if (expression instanceof ElementAccessExpression)
1431
1427
  return (isInitializerStringOrNumberLiteralExpression(expression.argumentExpression) &&
@@ -1446,9 +1442,9 @@ function checkGrammarStatementInAmbientContext(g, node) {
1446
1442
  return reported;
1447
1443
  }
1448
1444
  // Report once per block; statements nested in other statements are covered by their parent.
1449
- if (parent.kind === 242 /* SyntaxKind.Block */ ||
1450
- parent.kind === 269 /* SyntaxKind.ModuleBlock */ ||
1451
- parent.kind === 307 /* SyntaxKind.SourceFile */) {
1445
+ if (parent.kind === 243 /* SyntaxKind.Block */ ||
1446
+ parent.kind === 270 /* SyntaxKind.ModuleBlock */ ||
1447
+ parent.kind === 308 /* SyntaxKind.SourceFile */) {
1452
1448
  const parentId = getNodeId(parent);
1453
1449
  if (!g.reportedAmbientStatements.has(parentId)) {
1454
1450
  const reported = grammarErrorOnFirstToken(g, node, 27 /* Diagnostics.Statements_are_not_allowed_in_ambient_contexts */);
@@ -1460,7 +1456,7 @@ function checkGrammarStatementInAmbientContext(g, node) {
1460
1456
  return false;
1461
1457
  }
1462
1458
  function isAccessor(node) {
1463
- return node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */;
1459
+ return node.kind === 179 /* SyntaxKind.GetAccessor */ || node.kind === 180 /* SyntaxKind.SetAccessor */;
1464
1460
  }
1465
1461
  function checkGrammarVariableStatement(g, node) {
1466
1462
  if (!checkGrammarModifiers(g, node) && !checkGrammarVariableDeclarationList(g, node.declarationList))
@@ -1485,15 +1481,15 @@ function checkGrammarForDisallowedBlockScopedVariableStatement(g, node) {
1485
1481
  }
1486
1482
  function containerAllowsBlockScopedVariable(parent) {
1487
1483
  switch (parent.kind) {
1488
- case 246 /* SyntaxKind.IfStatement */:
1489
- case 247 /* SyntaxKind.DoStatement */:
1490
- case 248 /* SyntaxKind.WhileStatement */:
1491
- case 255 /* SyntaxKind.WithStatement */:
1492
- case 249 /* SyntaxKind.ForStatement */:
1493
- case 250 /* SyntaxKind.ForInStatement */:
1494
- case 251 /* SyntaxKind.ForOfStatement */:
1484
+ case 247 /* SyntaxKind.IfStatement */:
1485
+ case 248 /* SyntaxKind.DoStatement */:
1486
+ case 249 /* SyntaxKind.WhileStatement */:
1487
+ case 256 /* SyntaxKind.WithStatement */:
1488
+ case 250 /* SyntaxKind.ForStatement */:
1489
+ case 251 /* SyntaxKind.ForInStatement */:
1490
+ case 252 /* SyntaxKind.ForOfStatement */:
1495
1491
  return false;
1496
- case 257 /* SyntaxKind.LabeledStatement */:
1492
+ case 258 /* SyntaxKind.LabeledStatement */:
1497
1493
  return containerAllowsBlockScopedVariable(parent.parent);
1498
1494
  }
1499
1495
  return true;
@@ -1508,19 +1504,19 @@ function checkGrammarVariableDeclarationList(g, list) {
1508
1504
  const parent = list.parent;
1509
1505
  if (blockScopeFlags === 4 /* NodeFlags.Using */ || blockScopeFlags === 6 /* NodeFlags.AwaitUsing */) {
1510
1506
  const isUsing = blockScopeFlags === 4 /* NodeFlags.Using */;
1511
- if (parent.kind === 250 /* SyntaxKind.ForInStatement */)
1507
+ if (parent.kind === 251 /* SyntaxKind.ForInStatement */)
1512
1508
  return grammarErrorOnNode(g, list, isUsing
1513
- ? 408 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration */
1514
- : 409 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration */);
1509
+ ? 406 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration */
1510
+ : 407 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration */);
1515
1511
  if ((list.flags & 8388608 /* NodeFlags.Ambient */) !== 0)
1516
1512
  return grammarErrorOnNode(g, list, isUsing
1517
- ? 460 /* Diagnostics.X_using_declarations_are_not_allowed_in_ambient_contexts */
1518
- : 461 /* Diagnostics.X_await_using_declarations_are_not_allowed_in_ambient_contexts */);
1519
- if (parent.kind === 244 /* SyntaxKind.VariableStatement */ &&
1520
- (parent.parent.kind === 297 /* SyntaxKind.CaseClause */ || parent.parent.kind === 298 /* SyntaxKind.DefaultClause */))
1513
+ ? 458 /* Diagnostics.X_using_declarations_are_not_allowed_in_ambient_contexts */
1514
+ : 459 /* Diagnostics.X_await_using_declarations_are_not_allowed_in_ambient_contexts */);
1515
+ if (parent.kind === 245 /* SyntaxKind.VariableStatement */ &&
1516
+ (parent.parent.kind === 298 /* SyntaxKind.CaseClause */ || parent.parent.kind === 299 /* SyntaxKind.DefaultClause */))
1521
1517
  return grammarErrorOnNode(g, list, isUsing
1522
- ? 462 /* Diagnostics.X_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block */
1523
- : 463 /* Diagnostics.X_await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block */);
1518
+ ? 460 /* Diagnostics.X_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block */
1519
+ : 461 /* Diagnostics.X_await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block */);
1524
1520
  }
1525
1521
  if (blockScopeFlags === 6 /* NodeFlags.AwaitUsing */)
1526
1522
  return checkGrammarAwaitOrAwaitUsing(g, list);
@@ -1532,12 +1528,12 @@ function checkGrammarVariableDeclaration(g, node) {
1532
1528
  const name = node.name;
1533
1529
  if (isBindingPattern(name)) {
1534
1530
  if (blockScopeKind === 6 /* NodeFlags.AwaitUsing */)
1535
- return grammarErrorOnNode(g, node, 407 /* Diagnostics.X_0_declarations_may_not_have_binding_patterns */, 'await using');
1531
+ return grammarErrorOnNode(g, node, 405 /* Diagnostics.X_0_declarations_may_not_have_binding_patterns */, 'await using');
1536
1532
  if (blockScopeKind === 4 /* NodeFlags.Using */)
1537
- return grammarErrorOnNode(g, node, 407 /* Diagnostics.X_0_declarations_may_not_have_binding_patterns */, 'using');
1533
+ return grammarErrorOnNode(g, node, 405 /* Diagnostics.X_0_declarations_may_not_have_binding_patterns */, 'using');
1538
1534
  }
1539
1535
  const statement = node.parent.parent;
1540
- if (statement.kind !== 250 /* SyntaxKind.ForInStatement */ && statement.kind !== 251 /* SyntaxKind.ForOfStatement */) {
1536
+ if (statement.kind !== 251 /* SyntaxKind.ForInStatement */ && statement.kind !== 252 /* SyntaxKind.ForOfStatement */) {
1541
1537
  if ((nodeFlags & 8388608 /* NodeFlags.Ambient */) !== 0)
1542
1538
  checkAmbientInitializer(g, node);
1543
1539
  else if (node.initializer === undefined) {
@@ -1553,7 +1549,7 @@ function checkGrammarVariableDeclaration(g, node) {
1553
1549
  }
1554
1550
  const exclamationToken = node.exclamationToken;
1555
1551
  if (exclamationToken !== undefined &&
1556
- (statement.kind !== 244 /* SyntaxKind.VariableStatement */ ||
1552
+ (statement.kind !== 245 /* SyntaxKind.VariableStatement */ ||
1557
1553
  node.type === undefined ||
1558
1554
  node.initializer !== undefined ||
1559
1555
  (nodeFlags & 8388608 /* NodeFlags.Ambient */) !== 0)) {
@@ -1586,7 +1582,7 @@ function checkGrammarNameInLetOrConstDeclarations(g, name) {
1586
1582
  if (name instanceof Identifier) {
1587
1583
  const identifier = name;
1588
1584
  if (identifier.text === 'let')
1589
- return grammarErrorOnNode(g, name, 643 /* Diagnostics.X_let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations */);
1585
+ return grammarErrorOnNode(g, name, 650 /* Diagnostics.X_let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations */);
1590
1586
  return false;
1591
1587
  }
1592
1588
  for (const element of getElements(name).nodes) {
@@ -1600,10 +1596,10 @@ function checkGrammarBindingElement(g, node) {
1600
1596
  if (node.dotDotDotToken !== undefined) {
1601
1597
  const elements = getElements(node.parent);
1602
1598
  if (node !== elements.nodes[elements.nodes.length - 1])
1603
- return grammarErrorOnNode(g, node, 628 /* Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern */);
1599
+ return grammarErrorOnNode(g, node, 635 /* Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern */);
1604
1600
  checkGrammarForDisallowedTrailingComma(g, elements, 9 /* Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma */);
1605
1601
  if (node.propertyName !== undefined)
1606
- return grammarErrorOnNode(g, node.name, 720 /* Diagnostics.A_rest_element_cannot_have_a_property_name */);
1602
+ return grammarErrorOnNode(g, node.name, 727 /* Diagnostics.A_rest_element_cannot_have_a_property_name */);
1607
1603
  // Report on the `=` before the initializer.
1608
1604
  if (node.initializer !== undefined)
1609
1605
  return grammarErrorAtPos(g, node.initializer.pos - 1, 1, 142 /* Diagnostics.A_rest_element_cannot_have_an_initializer */);
@@ -1614,10 +1610,10 @@ function checkGrammarForInOrForOfStatement(g, node) {
1614
1610
  checkGrammarForInOrForOfStatementWorker(g, node);
1615
1611
  // `checkForOfStatement` reports `for await` in static blocks after the statement's grammar.
1616
1612
  const awaitModifier = node.awaitModifier;
1617
- if (node.kind === 251 /* SyntaxKind.ForOfStatement */ && awaitModifier !== undefined) {
1613
+ if (node.kind === 252 /* SyntaxKind.ForOfStatement */ && awaitModifier !== undefined) {
1618
1614
  const container = getContainingFunctionOrClassStaticBlock(node);
1619
- if (container !== undefined && container.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */)
1620
- grammarErrorOnNode(g, awaitModifier, 1855 /* Diagnostics.X_for_await_loops_cannot_be_used_inside_a_class_static_block */);
1615
+ if (container !== undefined && container.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */)
1616
+ grammarErrorOnNode(g, awaitModifier, 1875 /* Diagnostics.X_for_await_loops_cannot_be_used_inside_a_class_static_block */);
1621
1617
  }
1622
1618
  return false;
1623
1619
  }
@@ -1625,7 +1621,7 @@ function checkGrammarForInOrForOfStatementWorker(g, node) {
1625
1621
  if (checkGrammarStatementInAmbientContext(g, node))
1626
1622
  return true;
1627
1623
  const awaitModifier = node.awaitModifier;
1628
- if (node.kind === 251 /* SyntaxKind.ForOfStatement */ &&
1624
+ if (node.kind === 252 /* SyntaxKind.ForOfStatement */ &&
1629
1625
  awaitModifier !== undefined &&
1630
1626
  (node.flags & 8192 /* NodeFlags.AwaitContext */) === 0) {
1631
1627
  if (isInTopLevelContext(node)) {
@@ -1643,21 +1639,21 @@ function checkGrammarForInOrForOfStatementWorker(g, node) {
1643
1639
  // `for await` in a function that isn't async.
1644
1640
  const diagnostic = createDiagnosticForNode(awaitModifier, 72 /* Diagnostics.X_for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules */, []);
1645
1641
  const containingFunction = getContainingFunction(node);
1646
- if (containingFunction !== undefined && containingFunction.kind !== 177 /* SyntaxKind.Constructor */)
1642
+ if (containingFunction !== undefined && containingFunction.kind !== 178 /* SyntaxKind.Constructor */)
1647
1643
  addRelated(diagnostic, containingFunction, 290 /* Diagnostics.Did_you_mean_to_mark_this_function_as_async */);
1648
1644
  g.c.addDiagnostic(diagnostic);
1649
1645
  return true;
1650
1646
  }
1651
1647
  }
1652
1648
  const initializer = node.initializer;
1653
- if (node.kind === 251 /* SyntaxKind.ForOfStatement */ &&
1649
+ if (node.kind === 252 /* SyntaxKind.ForOfStatement */ &&
1654
1650
  (node.flags & 8192 /* NodeFlags.AwaitContext */) === 0 &&
1655
1651
  initializer instanceof Identifier &&
1656
1652
  initializer.text === 'async') {
1657
1653
  grammarErrorOnNode(g, initializer, 75 /* Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async */);
1658
1654
  return false;
1659
1655
  }
1660
- if (initializer.kind !== 262 /* SyntaxKind.VariableDeclarationList */)
1656
+ if (initializer.kind !== 263 /* SyntaxKind.VariableDeclarationList */)
1661
1657
  return false;
1662
1658
  const list = initializer;
1663
1659
  if (checkGrammarVariableDeclarationList(g, list))
@@ -1666,7 +1662,7 @@ function checkGrammarForInOrForOfStatementWorker(g, node) {
1666
1662
  const declarations = list.declarations.nodes;
1667
1663
  if (declarations.length === 0)
1668
1664
  return false;
1669
- const isForIn = node.kind === 250 /* SyntaxKind.ForInStatement */;
1665
+ const isForIn = node.kind === 251 /* SyntaxKind.ForInStatement */;
1670
1666
  if (declarations.length > 1)
1671
1667
  return grammarErrorOnFirstToken(g, declarations[1], isForIn
1672
1668
  ? 60 /* Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement */
@@ -1678,8 +1674,8 @@ function checkGrammarForInOrForOfStatementWorker(g, node) {
1678
1674
  : 146 /* Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer */);
1679
1675
  if (first.type !== undefined)
1680
1676
  return grammarErrorOnNode(g, first, isForIn
1681
- ? 575 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation */
1682
- : 645 /* Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation */);
1677
+ ? 582 /* Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation */
1678
+ : 652 /* Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation */);
1683
1679
  return false;
1684
1680
  }
1685
1681
  /** Whether the module and target options allow top-level `await`. */
@@ -1698,11 +1694,11 @@ function checkTopLevelAwaitModule(g) {
1698
1694
  }
1699
1695
  function checkGrammarBreakOrContinueStatement(g, node) {
1700
1696
  const targetLabel = getLabel(node);
1701
- const isBreak = node.kind === 253 /* SyntaxKind.BreakStatement */;
1697
+ const isBreak = node.kind === 254 /* SyntaxKind.BreakStatement */;
1702
1698
  for (let current = node; current !== undefined; current = current.parent) {
1703
- if (isFunctionLike(current) || current.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */)
1699
+ if (isFunctionLike(current) || current.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */)
1704
1700
  return grammarErrorOnNode(g, node, 76 /* Diagnostics.Jump_target_cannot_cross_function_boundary */);
1705
- if (current.kind === 257 /* SyntaxKind.LabeledStatement */) {
1701
+ if (current.kind === 258 /* SyntaxKind.LabeledStatement */) {
1706
1702
  const labeled = current;
1707
1703
  if (targetLabel !== undefined && labeled.label.text === getText(targetLabel)) {
1708
1704
  // `continue` can only target labels of iteration statements.
@@ -1711,7 +1707,7 @@ function checkGrammarBreakOrContinueStatement(g, node) {
1711
1707
  return false;
1712
1708
  }
1713
1709
  }
1714
- else if (current.kind === 256 /* SyntaxKind.SwitchStatement */) {
1710
+ else if (current.kind === 257 /* SyntaxKind.SwitchStatement */) {
1715
1711
  if (isBreak && targetLabel === undefined)
1716
1712
  return false;
1717
1713
  }
@@ -1729,13 +1725,13 @@ function checkGrammarBreakOrContinueStatement(g, node) {
1729
1725
  }
1730
1726
  function isIterationStatement(node, lookInLabeledStatements) {
1731
1727
  switch (node.kind) {
1732
- case 249 /* SyntaxKind.ForStatement */:
1733
- case 250 /* SyntaxKind.ForInStatement */:
1734
- case 251 /* SyntaxKind.ForOfStatement */:
1735
- case 247 /* SyntaxKind.DoStatement */:
1736
- case 248 /* SyntaxKind.WhileStatement */:
1728
+ case 250 /* SyntaxKind.ForStatement */:
1729
+ case 251 /* SyntaxKind.ForInStatement */:
1730
+ case 252 /* SyntaxKind.ForOfStatement */:
1731
+ case 248 /* SyntaxKind.DoStatement */:
1732
+ case 249 /* SyntaxKind.WhileStatement */:
1737
1733
  return true;
1738
- case 257 /* SyntaxKind.LabeledStatement */:
1734
+ case 258 /* SyntaxKind.LabeledStatement */:
1739
1735
  return lookInLabeledStatements && isIterationStatement(node.statement, true);
1740
1736
  }
1741
1737
  return false;
@@ -1745,8 +1741,8 @@ function checkGrammarReturnStatement(g, node) {
1745
1741
  if (checkGrammarStatementInAmbientContext(g, node))
1746
1742
  return false;
1747
1743
  const container = getContainingFunctionOrClassStaticBlock(node);
1748
- if (container !== undefined && container.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */) {
1749
- grammarErrorOnFirstToken(g, node, 1857 /* Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block */);
1744
+ if (container !== undefined && container.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */) {
1745
+ grammarErrorOnFirstToken(g, node, 1877 /* Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block */);
1750
1746
  return false;
1751
1747
  }
1752
1748
  if (container === undefined) {
@@ -1761,13 +1757,13 @@ function checkGrammarWithStatement(g, node) {
1761
1757
  // The body of a `with` statement isn't checked.
1762
1758
  g.visitNode(node.expression);
1763
1759
  const start = skipTrivia(g.file.text, node.pos);
1764
- grammarErrorAtPos(g, start, node.statement.pos - start, 581 /* Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any */);
1760
+ grammarErrorAtPos(g, start, node.statement.pos - start, 588 /* Diagnostics.The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any */);
1765
1761
  }
1766
1762
  function checkGrammarSwitchStatement(g, node) {
1767
1763
  checkGrammarStatementInAmbientContext(g, node);
1768
1764
  let seenDefaultClause = false;
1769
1765
  for (const clause of node.caseBlock.clauses.nodes) {
1770
- if (clause.kind !== 298 /* SyntaxKind.DefaultClause */)
1766
+ if (clause.kind !== 299 /* SyntaxKind.DefaultClause */)
1771
1767
  continue;
1772
1768
  if (!seenDefaultClause)
1773
1769
  seenDefaultClause = true;
@@ -1782,7 +1778,7 @@ function checkGrammarLabeledStatement(g, node) {
1782
1778
  return;
1783
1779
  const label = node.label;
1784
1780
  for (let current = node.parent; current !== undefined && !isFunctionLike(current); current = current.parent)
1785
- if (current.kind === 257 /* SyntaxKind.LabeledStatement */ && current.label.text === label.text) {
1781
+ if (current.kind === 258 /* SyntaxKind.LabeledStatement */ && current.label.text === label.text) {
1786
1782
  grammarErrorOnNode(g, label, 82 /* Diagnostics.Duplicate_label_0 */, label.text);
1787
1783
  return;
1788
1784
  }
@@ -1810,7 +1806,7 @@ function checkGrammarCatchClause(g, node) {
1810
1806
  if (blockLocal !== undefined &&
1811
1807
  blockLocal.valueDeclaration !== undefined &&
1812
1808
  (blockLocal.flags & 2 /* SymbolFlags.BlockScopedVariable */) !== 0)
1813
- grammarErrorOnNode(g, blockLocal.valueDeclaration, 652 /* Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause */, caughtName);
1809
+ grammarErrorOnNode(g, blockLocal.valueDeclaration, 659 /* Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause */, caughtName);
1814
1810
  }
1815
1811
  }
1816
1812
  }
@@ -1822,25 +1818,25 @@ function getContainingFunction(node) {
1822
1818
  }
1823
1819
  export function getContainingFunctionOrClassStaticBlock(node) {
1824
1820
  let current = node.parent;
1825
- while (current !== undefined && !isFunctionLike(current) && current.kind !== 176 /* SyntaxKind.ClassStaticBlockDeclaration */)
1821
+ while (current !== undefined && !isFunctionLike(current) && current.kind !== 177 /* SyntaxKind.ClassStaticBlockDeclaration */)
1826
1822
  current = current.parent;
1827
1823
  return current;
1828
1824
  }
1829
1825
  // ---- Modules, imports and exports
1830
1826
  function checkGrammarTopLevelElementsForRequiredDeclareModifier(g, file) {
1831
1827
  for (const statement of file.statements.nodes) {
1832
- if (!isDeclarationNode(statement) && statement.kind !== 244 /* SyntaxKind.VariableStatement */)
1828
+ if (!isDeclarationNode(statement) && statement.kind !== 245 /* SyntaxKind.VariableStatement */)
1833
1829
  continue;
1834
1830
  // Everything but interfaces, type aliases, imports and exports needs `declare` or `export`.
1835
1831
  switch (statement.kind) {
1836
- case 265 /* SyntaxKind.InterfaceDeclaration */:
1837
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
1838
- case 273 /* SyntaxKind.ImportDeclaration */:
1839
- case 346 /* SyntaxKind.JSImportDeclaration */:
1840
- case 272 /* SyntaxKind.ImportEqualsDeclaration */:
1841
- case 279 /* SyntaxKind.ExportDeclaration */:
1842
- case 278 /* SyntaxKind.ExportAssignment */:
1843
- case 271 /* SyntaxKind.NamespaceExportDeclaration */:
1832
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
1833
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
1834
+ case 274 /* SyntaxKind.ImportDeclaration */:
1835
+ case 347 /* SyntaxKind.JSImportDeclaration */:
1836
+ case 273 /* SyntaxKind.ImportEqualsDeclaration */:
1837
+ case 280 /* SyntaxKind.ExportDeclaration */:
1838
+ case 279 /* SyntaxKind.ExportAssignment */:
1839
+ case 272 /* SyntaxKind.NamespaceExportDeclaration */:
1844
1840
  continue;
1845
1841
  }
1846
1842
  if (hasSyntacticModifier(statement, 128 /* ModifierFlags.Ambient */ | 32 /* ModifierFlags.Export */ | 2048 /* ModifierFlags.Default */))
@@ -1852,17 +1848,44 @@ function checkGrammarTopLevelElementsForRequiredDeclareModifier(g, file) {
1852
1848
  }
1853
1849
  function checkGrammarModuleElementContext(g, node, message) {
1854
1850
  const parent = node.parent;
1855
- const isInAppropriateContext = parent.kind === 307 /* SyntaxKind.SourceFile */ ||
1856
- parent.kind === 269 /* SyntaxKind.ModuleBlock */ ||
1857
- parent.kind === 268 /* SyntaxKind.ModuleDeclaration */;
1851
+ const isInAppropriateContext = parent.kind === 308 /* SyntaxKind.SourceFile */ ||
1852
+ parent.kind === 270 /* SyntaxKind.ModuleBlock */ ||
1853
+ parent.kind === 269 /* SyntaxKind.ModuleDeclaration */;
1858
1854
  if (!isInAppropriateContext)
1859
1855
  grammarErrorOnFirstToken(g, node, message);
1860
1856
  return !isInAppropriateContext;
1861
1857
  }
1858
+ /** An ambient module's import attributes type: property signatures with string literal types, each required,
1859
+ * not readonly, named by an identifier or a string other than `resolution-mode`. */
1860
+ function checkGrammarImportAttributesType(g, attributes) {
1861
+ for (const member of attributes.members.nodes) {
1862
+ if (member.kind !== 173 /* SyntaxKind.PropertySignature */)
1863
+ return grammarErrorOnNode(g, member, 465 /* Diagnostics.An_import_attributes_type_may_only_contain_property_signatures */);
1864
+ const property = member;
1865
+ for (const modifier of property.modifiers?.nodes ?? [])
1866
+ if (modifier.kind === 148 /* SyntaxKind.ReadonlyKeyword */)
1867
+ return grammarErrorOnNode(g, modifier, 471 /* Diagnostics.An_import_attributes_property_cannot_have_a_readonly_modifier */);
1868
+ if (property.type === undefined)
1869
+ return grammarErrorOnNode(g, member, 466 /* Diagnostics.An_import_attributes_property_must_have_a_type_annotation */);
1870
+ if (property.postfixToken?.kind === 57 /* SyntaxKind.QuestionToken */)
1871
+ return grammarErrorOnNode(g, member, 469 /* Diagnostics.An_import_attributes_property_cannot_be_optional */);
1872
+ const name = property.name;
1873
+ if (!isStringLiteralLike(name) && name.kind !== 79 /* SyntaxKind.Identifier */)
1874
+ return grammarErrorOnNode(g, name, 467 /* Diagnostics.An_import_attributes_property_must_have_a_string_literal_or_identifier_name */);
1875
+ if (getText(name) === 'resolution-mode')
1876
+ return grammarErrorOnNode(g, name, 470 /* Diagnostics.X_0_is_not_a_valid_key_for_an_import_attributes_type */, getText(name));
1877
+ const type = property.type;
1878
+ if (type.kind !== 203 /* SyntaxKind.LiteralType */ || type.literal.kind !== 10 /* SyntaxKind.StringLiteral */)
1879
+ return grammarErrorOnNode(g, type, 468 /* Diagnostics.An_import_attributes_property_must_have_a_string_literal_type_annotation */);
1880
+ }
1881
+ return false;
1882
+ }
1862
1883
  function checkGrammarModuleDeclaration(g, node) {
1884
+ if (node.attributes !== undefined)
1885
+ checkGrammarImportAttributesType(g, node.attributes);
1863
1886
  // The declaration check reports an illegal context and skips the rest.
1864
1887
  const parent = node.parent.kind;
1865
- if (parent !== 307 /* SyntaxKind.SourceFile */ && parent !== 269 /* SyntaxKind.ModuleBlock */ && parent !== 268 /* SyntaxKind.ModuleDeclaration */)
1888
+ if (parent !== 308 /* SyntaxKind.SourceFile */ && parent !== 270 /* SyntaxKind.ModuleBlock */ && parent !== 269 /* SyntaxKind.ModuleDeclaration */)
1866
1889
  return true;
1867
1890
  if (!checkGrammarModifiers(g, node) &&
1868
1891
  (node.flags & 8388608 /* NodeFlags.Ambient */) === 0 &&
@@ -1881,9 +1904,9 @@ function checkExternalImportOrExportDeclaration(g, node) {
1881
1904
  return false;
1882
1905
  }
1883
1906
  const parent = node.parent;
1884
- const inAmbientExternalModule = parent.kind === 269 /* SyntaxKind.ModuleBlock */ && isAmbientModule(parent.parent);
1885
- if (parent.kind !== 307 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) {
1886
- g.c.error(moduleName, node.kind === 279 /* SyntaxKind.ExportDeclaration */
1907
+ const inAmbientExternalModule = parent.kind === 270 /* SyntaxKind.ModuleBlock */ && isAmbientModule(parent.parent);
1908
+ if (parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) {
1909
+ g.c.error(moduleName, node.kind === 280 /* SyntaxKind.ExportDeclaration */
1887
1910
  ? 150 /* Diagnostics.Export_declarations_are_not_permitted_in_a_namespace */
1888
1911
  : 112 /* Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module */);
1889
1912
  return false;
@@ -1892,34 +1915,38 @@ function checkExternalImportOrExportDeclaration(g, node) {
1892
1915
  isExternalModuleNameRelative(moduleName.text) &&
1893
1916
  !isModuleAugmentationExternal(parent.parent)) {
1894
1917
  // Module augmentations report relative names when checking the augmentation.
1895
- g.c.error(node, 607 /* Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name */);
1918
+ g.c.error(node, 614 /* Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name */);
1896
1919
  return false;
1897
1920
  }
1898
- if (node.kind === 272 /* SyntaxKind.ImportEqualsDeclaration */)
1921
+ if (node.kind === 273 /* SyntaxKind.ImportEqualsDeclaration */)
1899
1922
  return true;
1900
1923
  const attributes = getImportAttributes(node);
1901
- if (attributes === undefined)
1902
- return true;
1924
+ return attributes === undefined || !checkGrammarImportAttributeValues(g, attributes);
1925
+ }
1926
+ /** Reports attribute values that are not string literals, and returns whether there are any. */
1927
+ function checkGrammarImportAttributeValues(g, node) {
1903
1928
  let hasError = false;
1904
- for (const attribute of attributes.attributes.nodes) {
1929
+ for (const attribute of node.attributes.nodes) {
1905
1930
  const value = attribute.value;
1906
1931
  if (value.kind !== 10 /* SyntaxKind.StringLiteral */) {
1907
1932
  hasError = true;
1908
- g.c.error(value, 978 /* Diagnostics.Import_attribute_values_must_be_string_literal_expressions */);
1933
+ g.c.error(value, 985 /* Diagnostics.Import_attribute_values_must_be_string_literal_expressions */);
1909
1934
  }
1910
1935
  }
1911
- return !hasError;
1936
+ return hasError;
1912
1937
  }
1913
1938
  function getImportAttributes(node) {
1914
- if (node.kind === 273 /* SyntaxKind.ImportDeclaration */ || node.kind === 346 /* SyntaxKind.JSImportDeclaration */)
1939
+ if (node.kind === 274 /* SyntaxKind.ImportDeclaration */ || node.kind === 347 /* SyntaxKind.JSImportDeclaration */)
1940
+ return node.attributes;
1941
+ if (node.kind === 280 /* SyntaxKind.ExportDeclaration */)
1915
1942
  return node.attributes;
1916
- if (node.kind === 279 /* SyntaxKind.ExportDeclaration */)
1943
+ if (node.kind === 207 /* SyntaxKind.ImportType */)
1917
1944
  return node.attributes;
1918
1945
  return undefined;
1919
1946
  }
1920
1947
  function checkGrammarImportDeclaration(g, node) {
1921
1948
  if (checkGrammarModuleElementContext(g, node, isInJSFile(node)
1922
- ? 388 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module */
1949
+ ? 386 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module */
1923
1950
  : 182 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module */))
1924
1951
  return;
1925
1952
  if (!checkGrammarModifiers(g, node) && node.modifiers !== undefined)
@@ -1934,35 +1961,48 @@ function checkGrammarImportClause(g, node) {
1934
1961
  if (node.phaseModifier === 156 /* SyntaxKind.TypeKeyword */) {
1935
1962
  if ((node.flags & 4194304 /* NodeFlags.JSDoc */) === 0 && node.name !== undefined && namedBindings !== undefined)
1936
1963
  return grammarErrorOnNode(g, node, 297 /* Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both */);
1937
- if (namedBindings !== undefined && namedBindings.kind === 276 /* SyntaxKind.NamedImports */)
1964
+ if (namedBindings !== undefined && namedBindings.kind === 277 /* SyntaxKind.NamedImports */)
1938
1965
  return checkGrammarTypeOnlyNamedImportsOrExports(g, namedBindings);
1939
1966
  }
1940
1967
  else if (node.phaseModifier === 166 /* SyntaxKind.DeferKeyword */) {
1941
1968
  if (node.name !== undefined)
1942
- return grammarErrorOnNode(g, node, 1873 /* Diagnostics.Default_imports_are_not_allowed_in_a_deferred_import */);
1943
- if (namedBindings !== undefined && namedBindings.kind === 276 /* SyntaxKind.NamedImports */)
1944
- return grammarErrorOnNode(g, node, 1874 /* Diagnostics.Named_imports_are_not_allowed_in_a_deferred_import */);
1945
- if (g.moduleKind !== ModuleKind.ESNext && g.moduleKind !== ModuleKind.Preserve)
1946
- return grammarErrorOnNode(g, node, 1875 /* Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve */);
1969
+ return grammarErrorOnNode(g, node, 1893 /* Diagnostics.Default_imports_are_not_allowed_in_a_deferred_import */);
1970
+ if (namedBindings === undefined)
1971
+ return grammarErrorOnNode(g, node, 1952 /* Diagnostics.A_deferred_import_must_specify_a_namespace_binding */);
1972
+ if (namedBindings.kind === 277 /* SyntaxKind.NamedImports */)
1973
+ return grammarErrorOnNode(g, node, 1894 /* Diagnostics.Named_imports_are_not_allowed_in_a_deferred_import */);
1974
+ if (!supportsDeferredImports(g.moduleKind))
1975
+ return grammarErrorOnNode(g, node, 1895 /* Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve */);
1976
+ }
1977
+ else if (node.phaseModifier === 167 /* SyntaxKind.SourceKeyword */) {
1978
+ if (namedBindings !== undefined)
1979
+ return grammarErrorOnNode(g, node, 1947 /* Diagnostics.Named_and_namespace_imports_are_not_allowed_in_a_source_phase_import */);
1980
+ if (node.name === undefined)
1981
+ return grammarErrorOnNode(g, node, 1946 /* Diagnostics.A_source_phase_import_must_specify_a_local_binding */);
1982
+ if (!supportsSourcePhaseImports(g.moduleKind))
1983
+ return grammarErrorOnNode(g, node, 1948 /* Diagnostics.Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve */);
1984
+ const moduleSpecifier = node.parent.moduleSpecifier;
1985
+ if (getEmitSyntaxForModuleSpecifierExpression(g.c, moduleSpecifier) === ModuleKind.CommonJS)
1986
+ return grammarErrorOnNode(g, node, 1950 /* Diagnostics.Source_phase_imports_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls */);
1947
1987
  }
1948
1988
  return false;
1949
1989
  }
1950
1990
  function checkGrammarTypeOnlyNamedImportsOrExports(g, namedBindings) {
1951
- const isImport = namedBindings.kind === 276 /* SyntaxKind.NamedImports */;
1991
+ const isImport = namedBindings.kind === 277 /* SyntaxKind.NamedImports */;
1952
1992
  for (const specifier of getElements(namedBindings).nodes)
1953
1993
  if (getIsTypeOnly(specifier))
1954
1994
  return grammarErrorOnFirstToken(g, specifier, isImport
1955
- ? 471 /* Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement */
1956
- : 472 /* Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement */);
1995
+ ? 478 /* Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement */
1996
+ : 479 /* Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement */);
1957
1997
  return false;
1958
1998
  }
1959
1999
  function checkGrammarImportEqualsDeclaration(g, node) {
1960
2000
  if (checkGrammarModuleElementContext(g, node, isInJSFile(node)
1961
- ? 388 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module */
2001
+ ? 386 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_module */
1962
2002
  : 182 /* Diagnostics.An_import_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module */))
1963
2003
  return;
1964
2004
  checkGrammarModifiers(g, node);
1965
- const isExternal = node.moduleReference.kind === 284 /* SyntaxKind.ExternalModuleReference */;
2005
+ const isExternal = node.moduleReference.kind === 285 /* SyntaxKind.ExternalModuleReference */;
1966
2006
  if (!isExternal) {
1967
2007
  if (node.isTypeOnly) {
1968
2008
  const symbol = getSymbolOfDeclaration(g.c, node);
@@ -1985,23 +2025,23 @@ function checkGrammarExportDeclaration(g, node) {
1985
2025
  if (!checkGrammarModifiers(g, node) && node.modifiers !== undefined)
1986
2026
  grammarErrorOnFirstToken(g, node, 149 /* Diagnostics.An_export_declaration_cannot_have_modifiers */);
1987
2027
  const clause = node.exportClause;
1988
- if (node.isTypeOnly && clause !== undefined && clause.kind === 280 /* SyntaxKind.NamedExports */)
2028
+ if (node.isTypeOnly && clause !== undefined && clause.kind === 281 /* SyntaxKind.NamedExports */)
1989
2029
  checkGrammarTypeOnlyNamedImportsOrExports(g, clause);
1990
2030
  const hasModuleSpecifier = node.moduleSpecifier !== undefined;
1991
2031
  if ((!hasModuleSpecifier || checkExternalImportOrExportDeclaration(g, node)) &&
1992
2032
  clause !== undefined &&
1993
- clause.kind === 280 /* SyntaxKind.NamedExports */) {
2033
+ clause.kind === 281 /* SyntaxKind.NamedExports */) {
1994
2034
  for (const specifier of getElements(clause).nodes) {
1995
2035
  checkGrammarModuleExportName(g, specifier.propertyName, hasModuleSpecifier);
1996
2036
  checkGrammarModuleExportName(g, specifier.name, true);
1997
2037
  }
1998
2038
  const parent = node.parent;
1999
- const inAmbientExternalModule = parent.kind === 269 /* SyntaxKind.ModuleBlock */ && isAmbientModule(parent.parent);
2039
+ const inAmbientExternalModule = parent.kind === 270 /* SyntaxKind.ModuleBlock */ && isAmbientModule(parent.parent);
2000
2040
  const inAmbientNamespaceDeclaration = !inAmbientExternalModule &&
2001
- parent.kind === 269 /* SyntaxKind.ModuleBlock */ &&
2041
+ parent.kind === 270 /* SyntaxKind.ModuleBlock */ &&
2002
2042
  !hasModuleSpecifier &&
2003
2043
  (node.flags & 8388608 /* NodeFlags.Ambient */) !== 0;
2004
- if (parent.kind !== 307 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration)
2044
+ if (parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration)
2005
2045
  g.c.error(node, 150 /* Diagnostics.Export_declarations_are_not_permitted_in_a_namespace */);
2006
2046
  }
2007
2047
  checkGrammarImportAttributes(g, node);
@@ -2012,7 +2052,7 @@ function checkGrammarModuleExportName(g, name, allowStringLiteral) {
2012
2052
  if (!allowStringLiteral)
2013
2053
  grammarErrorOnNode(g, name, 1 /* Diagnostics.Identifier_expected */);
2014
2054
  else if ((g.moduleKind === ModuleKind.ES2015 || g.moduleKind === ModuleKind.ES2020) && !g.file.isDeclarationFile)
2015
- grammarErrorOnNode(g, name, 1872 /* Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020 */);
2055
+ grammarErrorOnNode(g, name, 1892 /* Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020 */);
2016
2056
  }
2017
2057
  /** Returns whether the export's expression is checked. */
2018
2058
  function checkGrammarExportAssignment(g, node) {
@@ -2022,8 +2062,8 @@ function checkGrammarExportAssignment(g, node) {
2022
2062
  : 207 /* Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration */))
2023
2063
  return false;
2024
2064
  const parent = node.parent;
2025
- const container = parent.kind === 307 /* SyntaxKind.SourceFile */ ? parent : parent.parent;
2026
- if (container.kind === 268 /* SyntaxKind.ModuleDeclaration */ && !isAmbientModule(container)) {
2065
+ const container = parent.kind === 308 /* SyntaxKind.SourceFile */ ? parent : parent.parent;
2066
+ if (container.kind === 269 /* SyntaxKind.ModuleDeclaration */ && !isAmbientModule(container)) {
2027
2067
  g.c.error(node, isExportEquals
2028
2068
  ? 48 /* Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace */
2029
2069
  : 255 /* Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module */);
@@ -2033,7 +2073,7 @@ function checkGrammarExportAssignment(g, node) {
2033
2073
  grammarErrorOnFirstToken(g, node, 88 /* Diagnostics.An_export_assignment_cannot_have_modifiers */);
2034
2074
  const isAmbient = (node.flags & 8388608 /* NodeFlags.Ambient */) !== 0;
2035
2075
  if (isAmbient && !isEntityNameExpression(node.expression, false))
2036
- grammarErrorOnNode(g, node.expression, 846 /* Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context */);
2076
+ grammarErrorOnNode(g, node.expression, 853 /* Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context */);
2037
2077
  if (isExportEquals) {
2038
2078
  const impliedFormat = getImpliedNodeFormatForEmit(g.file.fileName, g.moduleKind, g.metadata);
2039
2079
  // Export assignments aren't supported in ECMAScript modules.
@@ -2069,7 +2109,7 @@ function checkGrammarTypeReference(g, node) {
2069
2109
  const scanner = g.getScanner();
2070
2110
  scanner.resetTokenState(node.typeName.end);
2071
2111
  if (scanner.scan() === 24 /* SyntaxKind.DotToken */)
2072
- grammarErrorAtPos(g, skipTrivia(g.file.text, node.typeName.end), 1, 1749 /* Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments */);
2112
+ grammarErrorAtPos(g, skipTrivia(g.file.text, node.typeName.end), 1, 1769 /* Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments */);
2073
2113
  }
2074
2114
  function checkGrammarTypeOperatorNode(g, node) {
2075
2115
  const innerType = node.type;
@@ -2077,25 +2117,25 @@ function checkGrammarTypeOperatorNode(g, node) {
2077
2117
  if (innerType.kind !== 155 /* SyntaxKind.SymbolKeyword */)
2078
2118
  return grammarErrorOnNode(g, innerType, 2 /* Diagnostics.X_0_expected */, tokenToString(155 /* SyntaxKind.SymbolKeyword */));
2079
2119
  let parent = node.parent;
2080
- while (parent.kind === 197 /* SyntaxKind.ParenthesizedType */)
2120
+ while (parent.kind === 198 /* SyntaxKind.ParenthesizedType */)
2081
2121
  parent = parent.parent;
2082
2122
  switch (parent.kind) {
2083
- case 261 /* SyntaxKind.VariableDeclaration */: {
2123
+ case 262 /* SyntaxKind.VariableDeclaration */: {
2084
2124
  const declaration = parent;
2085
2125
  if (declaration.name.kind !== 79 /* SyntaxKind.Identifier */)
2086
2126
  return grammarErrorOnNode(g, node, 269 /* Diagnostics.X_unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name */);
2087
- if (!(declaration.parent.kind === 262 /* SyntaxKind.VariableDeclarationList */ &&
2088
- declaration.parent.parent.kind === 244 /* SyntaxKind.VariableStatement */))
2127
+ if (!(declaration.parent.kind === 263 /* SyntaxKind.VariableDeclarationList */ &&
2128
+ declaration.parent.parent.kind === 245 /* SyntaxKind.VariableStatement */))
2089
2129
  return grammarErrorOnNode(g, node, 270 /* Diagnostics.X_unique_symbol_types_are_only_allowed_on_variables_in_a_variable_statement */);
2090
2130
  if ((declaration.parent.flags & 2 /* NodeFlags.Const */) === 0)
2091
2131
  return grammarErrorOnNode(g, declaration.name, 268 /* Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const */);
2092
2132
  return false;
2093
2133
  }
2094
- case 173 /* SyntaxKind.PropertyDeclaration */:
2134
+ case 174 /* SyntaxKind.PropertyDeclaration */:
2095
2135
  if (!isStatic(parent) || !hasSyntacticModifier(parent, 8 /* ModifierFlags.Readonly */))
2096
2136
  return grammarErrorOnNode(g, getName(parent), 267 /* Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly */);
2097
2137
  return false;
2098
- case 172 /* SyntaxKind.PropertySignature */:
2138
+ case 173 /* SyntaxKind.PropertySignature */:
2099
2139
  if (!hasSyntacticModifier(parent, 8 /* ModifierFlags.Readonly */))
2100
2140
  return grammarErrorOnNode(g, getName(parent), 266 /* Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly */);
2101
2141
  return false;
@@ -2103,8 +2143,8 @@ function checkGrammarTypeOperatorNode(g, node) {
2103
2143
  return grammarErrorOnNode(g, node, 271 /* Diagnostics.X_unique_symbol_types_are_not_allowed_here */);
2104
2144
  }
2105
2145
  if (node.operator === 148 /* SyntaxKind.ReadonlyKeyword */ &&
2106
- innerType.kind !== 189 /* SyntaxKind.ArrayType */ &&
2107
- innerType.kind !== 190 /* SyntaxKind.TupleType */)
2146
+ innerType.kind !== 190 /* SyntaxKind.ArrayType */ &&
2147
+ innerType.kind !== 191 /* SyntaxKind.TupleType */)
2108
2148
  return grammarErrorOnFirstToken(g, node, 288 /* Diagnostics.X_readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types */, tokenToString(155 /* SyntaxKind.SymbolKeyword */));
2109
2149
  return false;
2110
2150
  }
@@ -2112,7 +2152,7 @@ function checkGrammarInferType(g, node) {
2112
2152
  for (let current = node; current !== undefined; current = current.parent) {
2113
2153
  const parent = current.parent;
2114
2154
  if (parent !== undefined &&
2115
- parent.kind === 195 /* SyntaxKind.ConditionalType */ &&
2155
+ parent.kind === 196 /* SyntaxKind.ConditionalType */ &&
2116
2156
  parent.extendsType === current)
2117
2157
  return;
2118
2158
  }
@@ -2153,47 +2193,35 @@ function checkGrammarTupleType(g, node) {
2153
2193
  }
2154
2194
  function checkGrammarNamedTupleMember(g, node) {
2155
2195
  if (node.dotDotDotToken !== undefined && node.questionToken !== undefined)
2156
- grammarErrorOnNode(g, node, 1159 /* Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest */);
2157
- if (node.type.kind === 191 /* SyntaxKind.OptionalType */)
2158
- grammarErrorOnNode(g, node.type, 1160 /* Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type */);
2159
- if (node.type.kind === 192 /* SyntaxKind.RestType */)
2160
- grammarErrorOnNode(g, node.type, 1161 /* Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type */);
2196
+ grammarErrorOnNode(g, node, 1166 /* Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest */);
2197
+ if (node.type.kind === 192 /* SyntaxKind.OptionalType */)
2198
+ grammarErrorOnNode(g, node.type, 1167 /* Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type */);
2199
+ if (node.type.kind === 193 /* SyntaxKind.RestType */)
2200
+ grammarErrorOnNode(g, node.type, 1168 /* Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type */);
2161
2201
  }
2162
2202
  /** JSDoc-only type syntax in TypeScript code. */
2163
2203
  function checkGrammarJSDocTypeInTypeScript(g, node) {
2164
2204
  if ((node.flags & 65536 /* NodeFlags.JavaScriptFile */) !== 0)
2165
2205
  return;
2166
- if (node.kind !== 312 /* SyntaxKind.JSDocNonNullableType */ && node.kind !== 311 /* SyntaxKind.JSDocNullableType */) {
2167
- grammarErrorOnNode(g, node, 1749 /* Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments */);
2206
+ if (node.kind !== 313 /* SyntaxKind.JSDocNonNullableType */ && node.kind !== 312 /* SyntaxKind.JSDocNullableType */) {
2207
+ grammarErrorOnNode(g, node, 1769 /* Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments */);
2168
2208
  return;
2169
2209
  }
2170
- const isNullable = node.kind === 311 /* SyntaxKind.JSDocNullableType */;
2210
+ const isNullable = node.kind === 312 /* SyntaxKind.JSDocNullableType */;
2171
2211
  const typeNode = getType(node);
2172
2212
  const postfix = node.pos === typeNode.pos;
2173
2213
  let t = getTypeFromTypeNode(g.c, typeNode);
2174
2214
  if (isNullable && t !== g.c.neverType && t !== g.c.voidType)
2175
2215
  t = getNullableType(g.c, t, postfix ? 4 /* TypeFlags.Undefined */ : 12 /* TypeFlags.Nullable */);
2176
2216
  grammarErrorOnNode(g, node, postfix
2177
- ? 1822 /* Diagnostics.X_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 */
2178
- : 1823 /* Diagnostics.X_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 */, isNullable ? '?' : '!', typeToString(g.c, t));
2217
+ ? 1842 /* Diagnostics.X_0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 */
2218
+ : 1843 /* Diagnostics.X_0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 */, isNullable ? '?' : '!', typeToString(g.c, t));
2179
2219
  }
2180
- /** The `resolution-mode` of import type attributes, as tsgo's `getResolutionModeOverride`. */
2220
+ /** The `resolution-mode` of import type attributes, as tsgo's `GetResolutionModeOverride`. */
2181
2221
  function getResolutionModeOverride(g, node, reportErrors) {
2182
- const attributes = node.attributes.nodes;
2183
- if (attributes.length !== 1) {
2184
- if (reportErrors)
2185
- grammarErrorOnNode(g, node, 384 /* Diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require */);
2222
+ const attribute = resolutionModeAttribute(node);
2223
+ if (attribute === undefined)
2186
2224
  return ModuleKind.None;
2187
- }
2188
- const attribute = attributes[0];
2189
- const name = attribute.name;
2190
- if (name === undefined || !isStringLiteralLike(name))
2191
- return ModuleKind.None;
2192
- if (getText(name) !== 'resolution-mode') {
2193
- if (reportErrors)
2194
- grammarErrorOnNode(g, name, 383 /* Diagnostics.X_resolution_mode_is_the_only_valid_key_for_type_import_attributes */);
2195
- return ModuleKind.None;
2196
- }
2197
2225
  const value = attribute.value;
2198
2226
  if (!isStringLiteralLike(value))
2199
2227
  return ModuleKind.None;
@@ -2211,36 +2239,32 @@ function checkGrammarImportAttributes(g, declaration) {
2211
2239
  const node = getImportAttributes(declaration);
2212
2240
  if (node === undefined)
2213
2241
  return;
2214
- const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(declaration);
2242
+ const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(declaration) || declaration.kind === 207 /* SyntaxKind.ImportType */;
2215
2243
  const override = getResolutionModeOverride(g, node, isTypeOnly);
2216
- // Other checks don't apply to type-only imports with a resolution mode.
2217
- if (isTypeOnly && override !== ModuleKind.None)
2244
+ // Other checks don't apply to type-only imports and import types.
2245
+ if (isTypeOnly)
2218
2246
  return;
2219
2247
  const moduleKind = g.moduleKind;
2220
2248
  if (!((moduleKind >= ModuleKind.Node18 && moduleKind <= ModuleKind.NodeNext) ||
2221
2249
  moduleKind === ModuleKind.Preserve ||
2222
2250
  moduleKind === ModuleKind.ESNext)) {
2223
- grammarErrorOnNode(g, node, 954 /* Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve */);
2251
+ grammarErrorOnNode(g, node, 961 /* Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve */);
2224
2252
  return;
2225
2253
  }
2226
2254
  const moduleSpecifier = getExternalModuleName(declaration);
2227
2255
  if (moduleSpecifier !== undefined &&
2228
2256
  isStringLiteralLike(moduleSpecifier) &&
2229
2257
  getEmitSyntaxOfImportOrExport(g) === ModuleKind.CommonJS) {
2230
- grammarErrorOnNode(g, node, 976 /* Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls */);
2231
- return;
2232
- }
2233
- if (isTypeOnly) {
2234
- grammarErrorOnNode(g, node, 977 /* Diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports */);
2258
+ grammarErrorOnNode(g, node, 983 /* Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls */);
2235
2259
  return;
2236
2260
  }
2237
2261
  if (override !== ModuleKind.None)
2238
2262
  grammarErrorOnNode(g, node, 375 /* Diagnostics.X_resolution_mode_can_only_be_set_for_type_only_imports */);
2239
2263
  }
2240
2264
  function isExclusivelyTypeOnlyImportOrExport(node) {
2241
- if (node.kind === 279 /* SyntaxKind.ExportDeclaration */)
2265
+ if (node.kind === 280 /* SyntaxKind.ExportDeclaration */)
2242
2266
  return node.isTypeOnly;
2243
- if (node.kind !== 273 /* SyntaxKind.ImportDeclaration */ && node.kind !== 346 /* SyntaxKind.JSImportDeclaration */)
2267
+ if (node.kind !== 274 /* SyntaxKind.ImportDeclaration */ && node.kind !== 347 /* SyntaxKind.JSImportDeclaration */)
2244
2268
  return false;
2245
2269
  const clause = node.importClause;
2246
2270
  return clause !== undefined && clause.phaseModifier === 156 /* SyntaxKind.TypeKeyword */;
@@ -2255,22 +2279,23 @@ function getEmitSyntaxOfImportOrExport(g) {
2255
2279
  return ModuleKind.None;
2256
2280
  }
2257
2281
  function checkGrammarObjectLiteralExpression(g, node, inDestructuring) {
2258
- const seen = new Map();
2282
+ // An object literal with one property can't repeat a name, so it needs no table of names.
2283
+ const seen = node.properties.nodes.length > 1 ? new Map() : undefined;
2259
2284
  for (const property of node.properties.nodes) {
2260
- if (property.kind === 305 /* SyntaxKind.SpreadAssignment */) {
2285
+ if (property.kind === 306 /* SyntaxKind.SpreadAssignment */) {
2261
2286
  if (inDestructuring) {
2262
2287
  // A rest property can't be destructured further.
2263
2288
  const expression = skipParentheses(getExpression(property));
2264
- if (expression.kind === 210 /* SyntaxKind.ArrayLiteralExpression */ ||
2265
- expression.kind === 211 /* SyntaxKind.ObjectLiteralExpression */)
2266
- return grammarErrorOnNode(g, getExpression(property), 661 /* Diagnostics.A_rest_element_cannot_contain_a_binding_pattern */);
2289
+ if (expression.kind === 211 /* SyntaxKind.ArrayLiteralExpression */ ||
2290
+ expression.kind === 212 /* SyntaxKind.ObjectLiteralExpression */)
2291
+ return grammarErrorOnNode(g, getExpression(property), 668 /* Diagnostics.A_rest_element_cannot_contain_a_binding_pattern */);
2267
2292
  }
2268
2293
  continue;
2269
2294
  }
2270
2295
  const name = getName(property);
2271
- if (name.kind === 168 /* SyntaxKind.ComputedPropertyName */)
2296
+ if (name.kind === 169 /* SyntaxKind.ComputedPropertyName */)
2272
2297
  checkGrammarComputedPropertyName(g, name);
2273
- if (property.kind === 304 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring) {
2298
+ if (property.kind === 305 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring) {
2274
2299
  // An initializer is only valid in a destructuring pattern; report on the `=`.
2275
2300
  const shorthand = property;
2276
2301
  const equalsToken = shorthand.equalsToken;
@@ -2278,32 +2303,32 @@ function checkGrammarObjectLiteralExpression(g, node, inDestructuring) {
2278
2303
  grammarErrorOnFirstToken(g, equalsToken !== undefined ? equalsToken : shorthand.name, 248 /* Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern */);
2279
2304
  }
2280
2305
  if (name.kind === 80 /* SyntaxKind.PrivateIdentifier */)
2281
- grammarErrorOnNode(g, name, 1838 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
2306
+ grammarErrorOnNode(g, name, 1858 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
2282
2307
  // Only `async` is allowed, and only on methods.
2283
2308
  const modifiers = getModifiers(property);
2284
2309
  if (modifiers !== undefined)
2285
2310
  for (const modifier of modifiers.nodes)
2286
2311
  if (isModifierKind(modifier.kind) &&
2287
- (modifier.kind !== 133 /* SyntaxKind.AsyncKeyword */ || property.kind !== 175 /* SyntaxKind.MethodDeclaration */))
2312
+ (modifier.kind !== 133 /* SyntaxKind.AsyncKeyword */ || property.kind !== 176 /* SyntaxKind.MethodDeclaration */))
2288
2313
  grammarErrorOnNode(g, modifier, 31 /* Diagnostics.X_0_modifier_cannot_be_used_here */, getTextOfNodeFromSourceText(g.file.text, modifier));
2289
2314
  // Duplicate data properties are errors in strict mode only, but accessors and data
2290
2315
  // properties never mix, and get/set accessors can't repeat (ECMA-262 11.1.5).
2291
2316
  let currentKind;
2292
2317
  switch (property.kind) {
2293
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
2294
- case 303 /* SyntaxKind.PropertyAssignment */: {
2318
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
2319
+ case 304 /* SyntaxKind.PropertyAssignment */: {
2295
2320
  const postfixToken = getPostfixToken(property);
2296
2321
  checkGrammarForInvalidExclamationToken(g, postfixToken, 205 /* Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context */);
2297
2322
  checkGrammarForInvalidQuestionMark(g, postfixToken, 119 /* Diagnostics.An_object_member_cannot_be_declared_optional */);
2298
2323
  if (name.kind === 9 /* SyntaxKind.BigIntLiteral */)
2299
- g.c.addDiagnostic(createDiagnosticForNode(name, 454 /* Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name */, []));
2324
+ g.c.addDiagnostic(createDiagnosticForNode(name, 452 /* Diagnostics.A_bigint_literal_cannot_be_used_as_a_property_name */, []));
2300
2325
  currentKind = 4 /* DeclarationMeaning.PropertyAssignment */;
2301
2326
  break;
2302
2327
  }
2303
- case 175 /* SyntaxKind.MethodDeclaration */:
2328
+ case 176 /* SyntaxKind.MethodDeclaration */:
2304
2329
  currentKind = 8 /* DeclarationMeaning.Method */;
2305
2330
  break;
2306
- case 178 /* SyntaxKind.GetAccessor */:
2331
+ case 179 /* SyntaxKind.GetAccessor */:
2307
2332
  currentKind = 1 /* DeclarationMeaning.GetAccessor */;
2308
2333
  break;
2309
2334
  default:
@@ -2313,7 +2338,7 @@ function checkGrammarObjectLiteralExpression(g, node, inDestructuring) {
2313
2338
  if (inDestructuring)
2314
2339
  continue;
2315
2340
  const effectiveName = getEffectivePropertyNameForPropertyNameNode(g.c, name);
2316
- if (effectiveName === undefined)
2341
+ if (effectiveName === undefined || seen === undefined)
2317
2342
  continue;
2318
2343
  const existingKind = seen.get(effectiveName);
2319
2344
  if (existingKind === undefined) {
@@ -2321,7 +2346,7 @@ function checkGrammarObjectLiteralExpression(g, node, inDestructuring) {
2321
2346
  continue;
2322
2347
  }
2323
2348
  if ((currentKind & 8 /* DeclarationMeaning.Method */) !== 0 && (existingKind & 8 /* DeclarationMeaning.Method */) !== 0)
2324
- grammarErrorOnNode(g, name, 478 /* Diagnostics.Duplicate_identifier_0 */, getTextOfNodeFromSourceText(g.file.text, name));
2349
+ grammarErrorOnNode(g, name, 485 /* Diagnostics.Duplicate_identifier_0 */, getTextOfNodeFromSourceText(g.file.text, name));
2325
2350
  else if ((currentKind & 4 /* DeclarationMeaning.PropertyAssignment */) !== 0 &&
2326
2351
  (existingKind & 4 /* DeclarationMeaning.PropertyAssignment */) !== 0)
2327
2352
  grammarErrorOnNode(g, name, 85 /* Diagnostics.An_object_literal_cannot_have_multiple_properties_with_the_same_name */, getTextOfNodeFromSourceText(g.file.text, name));
@@ -2348,14 +2373,14 @@ function getEffectivePropertyNameForPropertyNameNode(c, name) {
2348
2373
  case 8 /* SyntaxKind.NumericLiteral */:
2349
2374
  case 9 /* SyntaxKind.BigIntLiteral */:
2350
2375
  return getText(name);
2351
- case 168 /* SyntaxKind.ComputedPropertyName */: {
2376
+ case 169 /* SyntaxKind.ComputedPropertyName */: {
2352
2377
  const expression = name.expression;
2353
2378
  switch (expression.kind) {
2354
2379
  case 10 /* SyntaxKind.StringLiteral */:
2355
2380
  case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */:
2356
2381
  case 8 /* SyntaxKind.NumericLiteral */:
2357
2382
  return getText(expression);
2358
- case 225 /* SyntaxKind.PrefixUnaryExpression */: {
2383
+ case 226 /* SyntaxKind.PrefixUnaryExpression */: {
2359
2384
  const unary = expression;
2360
2385
  if (unary.operand.kind === 8 /* SyntaxKind.NumericLiteral */ &&
2361
2386
  (unary.operator === 40 /* SyntaxKind.MinusToken */ || unary.operator === 39 /* SyntaxKind.PlusToken */))
@@ -2373,11 +2398,7 @@ function getEffectivePropertyNameForPropertyNameNode(c, name) {
2373
2398
  }
2374
2399
  function checkGrammarCallExpression(g, node) {
2375
2400
  const callee = node.expression;
2376
- const isImportCall = callee.kind === 101 /* SyntaxKind.ImportKeyword */ ||
2377
- (callee.kind === 237 /* SyntaxKind.MetaProperty */ &&
2378
- callee.keywordToken === 101 /* SyntaxKind.ImportKeyword */ &&
2379
- callee.name.text === 'defer');
2380
- if (isImportCall)
2401
+ if (callee.kind === 101 /* SyntaxKind.ImportKeyword */ || isImportPhaseMetaProperty(callee))
2381
2402
  checkGrammarImportCallExpression(g, node);
2382
2403
  else
2383
2404
  checkGrammarTypeArguments(g, callTypeArguments(node));
@@ -2388,12 +2409,19 @@ function checkGrammarImportCallExpression(g, node) {
2388
2409
  return grammarErrorOnNode(g, node, fileExtensionIsOneOf(g.file.fileName, ['.cts', '.cjs'])
2389
2410
  ? 235 /* Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax */
2390
2411
  : 244 /* Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript */);
2391
- if (node.expression.kind === 237 /* SyntaxKind.MetaProperty */) {
2392
- if (moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.Preserve)
2393
- return grammarErrorOnNode(g, node, 1875 /* Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve */);
2412
+ if (isImportSourceMetaProperty(node.expression)) {
2413
+ if (!supportsSourcePhaseImports(moduleKind))
2414
+ return grammarErrorOnNode(g, node, 1948 /* Diagnostics.Source_phase_imports_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve */);
2415
+ }
2416
+ else if (isImportDeferMetaProperty(node.expression)) {
2417
+ if (!supportsDeferredImports(moduleKind))
2418
+ return grammarErrorOnNode(g, node, 1895 /* Diagnostics.Deferred_imports_are_only_supported_when_the_module_flag_is_set_to_esnext_or_preserve */);
2394
2419
  }
2395
2420
  else if (moduleKind === ModuleKind.ES2015)
2396
2421
  return grammarErrorOnNode(g, node, 259 /* Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_node20_or_nodenext */);
2422
+ const questionDotToken = callQuestionDotToken(node);
2423
+ if (questionDotToken !== undefined && isSourcePhaseImportCall(node))
2424
+ return grammarErrorOnNode(g, questionDotToken, 1949 /* Diagnostics.Optional_chaining_cannot_be_used_with_import_source */);
2397
2425
  if (callTypeArguments(node) !== undefined)
2398
2426
  return grammarErrorOnNode(g, node, 262 /* Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments */);
2399
2427
  const args = node.arguments;
@@ -2410,7 +2438,7 @@ function checkGrammarImportCallExpression(g, node) {
2410
2438
  return grammarErrorOnNode(g, node, 372 /* Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_set_of_attributes_as_arguments */);
2411
2439
  // Arguments are parsed like array elements, which allows spreads.
2412
2440
  for (const argument of argumentNodes)
2413
- if (argument.kind === 231 /* SyntaxKind.SpreadElement */)
2441
+ if (argument.kind === 232 /* SyntaxKind.SpreadElement */)
2414
2442
  return grammarErrorOnNode(g, argument, 261 /* Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element */);
2415
2443
  return false;
2416
2444
  }
@@ -2424,32 +2452,32 @@ function checkGrammarMetaProperty(g, node) {
2424
2452
  const nameText = name.text;
2425
2453
  if (node.keywordToken === 104 /* SyntaxKind.NewKeyword */) {
2426
2454
  if (nameText !== 'target')
2427
- return grammarErrorOnNode(g, name, 1815 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 */, nameText, tokenToString(node.keywordToken), 'target');
2455
+ return grammarErrorOnNode(g, name, 1835 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 */, nameText, tokenToString(node.keywordToken), 'target');
2428
2456
  }
2429
2457
  else if (node.keywordToken === 101 /* SyntaxKind.ImportKeyword */ && nameText !== 'meta') {
2430
2458
  const parent = node.parent;
2431
- const isCallee = parent.kind === 214 /* SyntaxKind.CallExpression */ && parent.expression === node;
2432
- if (nameText === 'defer') {
2459
+ const isCallee = parent.kind === 215 /* SyntaxKind.CallExpression */ && parent.expression === node;
2460
+ if (isImportPhaseMetaProperty(node)) {
2433
2461
  if (!isCallee)
2434
2462
  return grammarErrorAtPos(g, node.end, 0, 2 /* Diagnostics.X_0_expected */, '(');
2435
2463
  }
2436
2464
  else {
2437
2465
  if (isCallee)
2438
- return grammarErrorOnNode(g, name, 1876 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_or_defer */, nameText);
2439
- return grammarErrorOnNode(g, name, 1815 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 */, nameText, tokenToString(node.keywordToken), 'meta');
2466
+ return grammarErrorOnNode(g, name, 1896 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_import_Did_you_mean_meta_defer_or_source */, nameText);
2467
+ return grammarErrorOnNode(g, name, 1835 /* Diagnostics.X_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2 */, nameText, tokenToString(node.keywordToken), 'meta');
2440
2468
  }
2441
2469
  }
2442
2470
  return false;
2443
2471
  }
2444
2472
  function checkGrammarAwaitOrAwaitUsing(g, node) {
2445
- const isAwaitExpression = node.kind === 224 /* SyntaxKind.AwaitExpression */;
2473
+ const isAwaitExpression = node.kind === 225 /* SyntaxKind.AwaitExpression */;
2446
2474
  let hasError = false;
2447
2475
  const container = getContainingFunctionOrClassStaticBlock(node);
2448
- if (container !== undefined && container.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */) {
2476
+ if (container !== undefined && container.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */) {
2449
2477
  // Reported even with parse errors.
2450
2478
  g.c.error(node, isAwaitExpression
2451
- ? 1854 /* Diagnostics.X_await_expression_cannot_be_used_inside_a_class_static_block */
2452
- : 1869 /* Diagnostics.X_await_using_statements_cannot_be_used_inside_a_class_static_block */);
2479
+ ? 1874 /* Diagnostics.X_await_expression_cannot_be_used_inside_a_class_static_block */
2480
+ : 1889 /* Diagnostics.X_await_using_statements_cannot_be_used_inside_a_class_static_block */);
2453
2481
  hasError = true;
2454
2482
  }
2455
2483
  else if ((node.flags & 8192 /* NodeFlags.AwaitContext */) === 0) {
@@ -2458,7 +2486,7 @@ function checkGrammarAwaitOrAwaitUsing(g, node) {
2458
2486
  if (!isEffectiveExternalModule(g)) {
2459
2487
  g.c.addDiagnostic(diagnosticAtFirstToken(g, node, isAwaitExpression
2460
2488
  ? 304 /* Diagnostics.X_await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module */
2461
- : 973 /* Diagnostics.X_await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module */));
2489
+ : 980 /* Diagnostics.X_await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module */));
2462
2490
  hasError = true;
2463
2491
  }
2464
2492
  const support = checkTopLevelAwaitModule(g);
@@ -2469,7 +2497,7 @@ function checkGrammarAwaitOrAwaitUsing(g, node) {
2469
2497
  else if (support === 2 /* TopLevelAwaitSupport.Unsupported */) {
2470
2498
  g.c.addDiagnostic(diagnosticAtFirstToken(g, node, isAwaitExpression
2471
2499
  ? 307 /* Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher */
2472
- : 974 /* Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher */));
2500
+ : 981 /* Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_node20_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher */));
2473
2501
  hasError = true;
2474
2502
  }
2475
2503
  }
@@ -2478,9 +2506,9 @@ function checkGrammarAwaitOrAwaitUsing(g, node) {
2478
2506
  // `await` in a function that isn't async.
2479
2507
  const diagnostic = diagnosticAtFirstToken(g, node, isAwaitExpression
2480
2508
  ? 246 /* Diagnostics.X_await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules */
2481
- : 972 /* Diagnostics.X_await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules */);
2509
+ : 979 /* Diagnostics.X_await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules */);
2482
2510
  if (container !== undefined &&
2483
- container.kind !== 177 /* SyntaxKind.Constructor */ &&
2511
+ container.kind !== 178 /* SyntaxKind.Constructor */ &&
2484
2512
  !hasSyntacticModifier(container, 1024 /* ModifierFlags.Async */))
2485
2513
  addRelated(diagnostic, container, 290 /* Diagnostics.Did_you_mean_to_mark_this_function_as_async */);
2486
2514
  g.c.addDiagnostic(diagnostic);
@@ -2489,7 +2517,7 @@ function checkGrammarAwaitOrAwaitUsing(g, node) {
2489
2517
  }
2490
2518
  if (isAwaitExpression && isInParameterInitializerBeforeContainingFunction(node)) {
2491
2519
  // Reported even with parse errors.
2492
- g.c.error(node, 683 /* Diagnostics.X_await_expressions_cannot_be_used_in_a_parameter_initializer */);
2520
+ g.c.error(node, 690 /* Diagnostics.X_await_expressions_cannot_be_used_in_a_parameter_initializer */);
2493
2521
  hasError = true;
2494
2522
  }
2495
2523
  return hasError;
@@ -2501,19 +2529,19 @@ function checkGrammarYieldExpression(g, node) {
2501
2529
  hasError = true;
2502
2530
  }
2503
2531
  if (isInParameterInitializerBeforeContainingFunction(node)) {
2504
- g.c.error(node, 682 /* Diagnostics.X_yield_expressions_cannot_be_used_in_a_parameter_initializer */);
2532
+ g.c.error(node, 689 /* Diagnostics.X_yield_expressions_cannot_be_used_in_a_parameter_initializer */);
2505
2533
  hasError = true;
2506
2534
  }
2507
2535
  return hasError;
2508
2536
  }
2509
- function isInParameterInitializerBeforeContainingFunction(node) {
2537
+ export function isInParameterInitializerBeforeContainingFunction(node) {
2510
2538
  let inBindingInitializer = false;
2511
2539
  let current = node;
2512
2540
  while (current.parent !== undefined && !isFunctionLike(current.parent)) {
2513
2541
  const parent = current.parent;
2514
- if (parent.kind === 170 /* SyntaxKind.Parameter */ && (inBindingInitializer || getInitializer(parent) === current))
2542
+ if (parent.kind === 171 /* SyntaxKind.Parameter */ && (inBindingInitializer || getInitializer(parent) === current))
2515
2543
  return true;
2516
- if (parent.kind === 209 /* SyntaxKind.BindingElement */ && getInitializer(parent) === current)
2544
+ if (parent.kind === 210 /* SyntaxKind.BindingElement */ && getInitializer(parent) === current)
2517
2545
  inBindingInitializer = true;
2518
2546
  current = parent;
2519
2547
  }
@@ -2522,15 +2550,19 @@ function isInParameterInitializerBeforeContainingFunction(node) {
2522
2550
  /** A private name in an expression, which is only valid as `#x in obj`. */
2523
2551
  function checkGrammarPrivateIdentifierExpression(g, node) {
2524
2552
  const parent = node.parent;
2525
- // Names of members and property accesses aren't expressions.
2526
- if (parent.kind === 212 /* SyntaxKind.PropertyAccessExpression */ || getName(parent) === node)
2553
+ // Names of members, property accesses, qualified names (`typeof this.#x`) and destructured properties aren't
2554
+ // expressions.
2555
+ if (parent.kind === 213 /* SyntaxKind.PropertyAccessExpression */ ||
2556
+ parent.kind === 168 /* SyntaxKind.QualifiedName */ ||
2557
+ getName(parent) === node ||
2558
+ (parent.kind === 210 /* SyntaxKind.BindingElement */ && parent.propertyName === node))
2527
2559
  return false;
2528
- const isForIn = parent.kind === 250 /* SyntaxKind.ForInStatement */;
2560
+ const isForIn = parent.kind === 251 /* SyntaxKind.ForInStatement */;
2529
2561
  if (getContainingClass(node) === undefined)
2530
- return grammarErrorOnNode(g, node, 1838 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
2562
+ return grammarErrorOnNode(g, node, 1858 /* Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies */);
2531
2563
  if (isForIn)
2532
2564
  return false;
2533
- const isLeftOfIn = parent.kind === 227 /* SyntaxKind.BinaryExpression */ &&
2565
+ const isLeftOfIn = parent.kind === 228 /* SyntaxKind.BinaryExpression */ &&
2534
2566
  parent.left === node &&
2535
2567
  parent.operatorToken.kind === 102 /* SyntaxKind.InKeyword */;
2536
2568
  if (!isLeftOfIn)
@@ -2542,13 +2574,13 @@ function checkGrammarBigIntLiteral(g, node) {
2542
2574
  // Like tsgo, only BigInt literals checked as expressions are reported, not property or member names.
2543
2575
  if (getName(parent) === node)
2544
2576
  return false;
2545
- const isLiteralType = parent.kind === 202 /* SyntaxKind.LiteralType */ ||
2546
- (parent.kind === 225 /* SyntaxKind.PrefixUnaryExpression */ && parent.parent.kind === 202 /* SyntaxKind.LiteralType */);
2577
+ const isLiteralType = parent.kind === 203 /* SyntaxKind.LiteralType */ ||
2578
+ (parent.kind === 226 /* SyntaxKind.PrefixUnaryExpression */ && parent.parent.kind === 203 /* SyntaxKind.LiteralType */);
2547
2579
  // BigInt literals are fine in types and ambient contexts.
2548
2580
  return (!isLiteralType &&
2549
2581
  (node.flags & 8388608 /* NodeFlags.Ambient */) === 0 &&
2550
2582
  g.c.languageVersion < ScriptTarget.ES2020 &&
2551
- grammarErrorOnNode(g, node, 869 /* Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020 */));
2583
+ grammarErrorOnNode(g, node, 876 /* Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ES2020 */));
2552
2584
  }
2553
2585
  /** Reports the errors of rescanning a regular expression; spelling suggestions become related information. */
2554
2586
  class RegularExpressionErrorReporter extends ScannerErrorReporter {