tsc-ts 0.0.10 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/README.md +1 -1
  2. package/bin/tsc-ts.js +70 -1
  3. package/dist/api/compiler/ast-utilities.d.ts +19 -1
  4. package/dist/api/compiler/ast-utilities.js +180 -95
  5. package/dist/api/compiler/ast.d.ts +20 -15
  6. package/dist/api/compiler/ast.js +1023 -995
  7. package/dist/api/compiler/astnav.js +15 -15
  8. package/dist/api/compiler/binder-utilities.js +186 -186
  9. package/dist/api/compiler/binder.js +290 -263
  10. package/dist/api/compiler/character-codes.js +2 -2
  11. package/dist/api/compiler/checker-calls.js +173 -123
  12. package/dist/api/compiler/checker-classes.d.ts +14 -3
  13. package/dist/api/compiler/checker-classes.js +134 -90
  14. package/dist/api/compiler/checker-contextual.js +64 -61
  15. package/dist/api/compiler/checker-declaration-order.js +79 -79
  16. package/dist/api/compiler/checker-declarations.d.ts +1 -0
  17. package/dist/api/compiler/checker-declarations.js +160 -136
  18. package/dist/api/compiler/checker-declared-types.js +67 -65
  19. package/dist/api/compiler/checker-decorators.js +77 -77
  20. package/dist/api/compiler/checker-deprecation.d.ts +8 -3
  21. package/dist/api/compiler/checker-deprecation.js +76 -55
  22. package/dist/api/compiler/checker-destructuring.js +47 -45
  23. package/dist/api/compiler/checker-elaboration.js +24 -24
  24. package/dist/api/compiler/checker-emit-helpers.js +4 -4
  25. package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
  26. package/dist/api/compiler/checker-emit-resolver.js +25 -13
  27. package/dist/api/compiler/checker-evaluator.js +9 -9
  28. package/dist/api/compiler/checker-expressions.js +244 -211
  29. package/dist/api/compiler/checker-functions.js +113 -107
  30. package/dist/api/compiler/checker-generated-code.d.ts +0 -11
  31. package/dist/api/compiler/checker-generated-code.js +28 -52
  32. package/dist/api/compiler/checker-grammar.d.ts +1 -0
  33. package/dist/api/compiler/checker-grammar.js +469 -438
  34. package/dist/api/compiler/checker-heritage.js +91 -93
  35. package/dist/api/compiler/checker-inference.d.ts +77 -5
  36. package/dist/api/compiler/checker-inference.js +487 -113
  37. package/dist/api/compiler/checker-iteration.d.ts +0 -10
  38. package/dist/api/compiler/checker-iteration.js +35 -52
  39. package/dist/api/compiler/checker-javascript.js +14 -14
  40. package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
  41. package/dist/api/compiler/checker-jsdoc.js +67 -58
  42. package/dist/api/compiler/checker-jsx.js +105 -88
  43. package/dist/api/compiler/checker-members.d.ts +9 -2
  44. package/dist/api/compiler/checker-members.js +210 -74
  45. package/dist/api/compiler/checker-modules.d.ts +15 -6
  46. package/dist/api/compiler/checker-modules.js +469 -309
  47. package/dist/api/compiler/checker-narrowing.js +273 -189
  48. package/dist/api/compiler/checker-object-literals.js +25 -22
  49. package/dist/api/compiler/checker-operators.js +126 -118
  50. package/dist/api/compiler/checker-overloads.js +27 -27
  51. package/dist/api/compiler/checker-property-access.js +59 -55
  52. package/dist/api/compiler/checker-services.d.ts +1 -0
  53. package/dist/api/compiler/checker-services.js +222 -210
  54. package/dist/api/compiler/checker-signatures.js +65 -49
  55. package/dist/api/compiler/checker-source-file.d.ts +5 -0
  56. package/dist/api/compiler/checker-source-file.js +154 -130
  57. package/dist/api/compiler/checker-statements.js +33 -32
  58. package/dist/api/compiler/checker-super.js +50 -50
  59. package/dist/api/compiler/checker-symbol-types.js +109 -93
  60. package/dist/api/compiler/checker-symbols.d.ts +13 -1
  61. package/dist/api/compiler/checker-symbols.js +264 -149
  62. package/dist/api/compiler/checker-type-factory.d.ts +5 -0
  63. package/dist/api/compiler/checker-type-factory.js +137 -34
  64. package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
  65. package/dist/api/compiler/checker-type-nodes.js +179 -141
  66. package/dist/api/compiler/checker-type-operators.d.ts +2 -0
  67. package/dist/api/compiler/checker-type-operators.js +110 -63
  68. package/dist/api/compiler/checker-types.d.ts +80 -3
  69. package/dist/api/compiler/checker-types.js +121 -2
  70. package/dist/api/compiler/checker-unused.js +114 -118
  71. package/dist/api/compiler/checker-utilities.js +11 -11
  72. package/dist/api/compiler/checker.d.ts +93 -31
  73. package/dist/api/compiler/checker.js +143 -35
  74. package/dist/api/compiler/command-line.d.ts +1 -3
  75. package/dist/api/compiler/command-line.js +47 -44
  76. package/dist/api/compiler/compile-program.d.ts +19 -4
  77. package/dist/api/compiler/compile-program.js +45 -26
  78. package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
  79. package/dist/api/compiler/diagnostic-messages.js +128 -122
  80. package/dist/api/compiler/diagnostics.js +7 -7
  81. package/dist/api/compiler/emitter.d.ts +7 -1
  82. package/dist/api/compiler/emitter.js +53 -11
  83. package/dist/api/compiler/file-include.d.ts +2 -1
  84. package/dist/api/compiler/file-include.js +11 -7
  85. package/dist/api/compiler/file-loader.d.ts +10 -0
  86. package/dist/api/compiler/file-loader.js +138 -41
  87. package/dist/api/compiler/instantiation.d.ts +7 -0
  88. package/dist/api/compiler/instantiation.js +101 -49
  89. package/dist/api/compiler/jsdoc.js +23 -23
  90. package/dist/api/compiler/link-tables.d.ts +48 -18
  91. package/dist/api/compiler/link-tables.js +80 -37
  92. package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
  93. package/dist/api/compiler/locales/cs-CZ.js +1 -1
  94. package/dist/api/compiler/locales/de-DE.d.ts +1 -1
  95. package/dist/api/compiler/locales/de-DE.js +1 -1
  96. package/dist/api/compiler/locales/es-ES.d.ts +1 -1
  97. package/dist/api/compiler/locales/es-ES.js +1 -1
  98. package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
  99. package/dist/api/compiler/locales/fr-FR.js +1 -1
  100. package/dist/api/compiler/locales/it-IT.d.ts +1 -1
  101. package/dist/api/compiler/locales/it-IT.js +1 -1
  102. package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
  103. package/dist/api/compiler/locales/ja-JP.js +1 -1
  104. package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
  105. package/dist/api/compiler/locales/ko-KR.js +1 -1
  106. package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
  107. package/dist/api/compiler/locales/pl-PL.js +1 -1
  108. package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
  109. package/dist/api/compiler/locales/pt-BR.js +1 -1
  110. package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
  111. package/dist/api/compiler/locales/ru-RU.js +1 -1
  112. package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
  113. package/dist/api/compiler/locales/tr-TR.js +1 -1
  114. package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
  115. package/dist/api/compiler/locales/zh-CN.js +1 -1
  116. package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
  117. package/dist/api/compiler/locales/zh-TW.js +1 -1
  118. package/dist/api/compiler/module-resolution-types.js +6 -6
  119. package/dist/api/compiler/module-resolution.d.ts +10 -1
  120. package/dist/api/compiler/module-resolution.js +115 -84
  121. package/dist/api/compiler/module-specifiers.d.ts +15 -0
  122. package/dist/api/compiler/module-specifiers.js +24 -18
  123. package/dist/api/compiler/name-resolver.js +74 -65
  124. package/dist/api/compiler/node-builder-names.d.ts +11 -3
  125. package/dist/api/compiler/node-builder-names.js +210 -90
  126. package/dist/api/compiler/node-builder-pseudo.js +29 -31
  127. package/dist/api/compiler/node-builder-reuse.js +23 -22
  128. package/dist/api/compiler/node-builder.d.ts +18 -1
  129. package/dist/api/compiler/node-builder.js +191 -102
  130. package/dist/api/compiler/option-declarations.d.ts +2 -6
  131. package/dist/api/compiler/option-declarations.js +315 -375
  132. package/dist/api/compiler/options.d.ts +15 -33
  133. package/dist/api/compiler/options.js +21 -54
  134. package/dist/api/compiler/output-paths.d.ts +4 -1
  135. package/dist/api/compiler/output-paths.js +6 -11
  136. package/dist/api/compiler/package-json.d.ts +3 -3
  137. package/dist/api/compiler/package-json.js +11 -10
  138. package/dist/api/compiler/parser.d.ts +40 -19
  139. package/dist/api/compiler/parser.js +308 -216
  140. package/dist/api/compiler/path.d.ts +9 -0
  141. package/dist/api/compiler/path.js +20 -3
  142. package/dist/api/compiler/printer/emit-context.d.ts +3 -1
  143. package/dist/api/compiler/printer/emit-context.js +16 -1
  144. package/dist/api/compiler/printer/factory-base.d.ts +2 -2
  145. package/dist/api/compiler/printer/factory-base.js +7 -3
  146. package/dist/api/compiler/printer/factory.js +3 -1
  147. package/dist/api/compiler/printer/helpers.js +10 -1
  148. package/dist/api/compiler/printer/name-generator.d.ts +1 -1
  149. package/dist/api/compiler/printer/name-generator.js +35 -16
  150. package/dist/api/compiler/printer/printer.d.ts +1 -0
  151. package/dist/api/compiler/printer/printer.js +303 -281
  152. package/dist/api/compiler/printer/utilities.js +149 -147
  153. package/dist/api/compiler/program-checker.d.ts +8 -2
  154. package/dist/api/compiler/program-checker.js +84 -34
  155. package/dist/api/compiler/program-utilities.d.ts +3 -1
  156. package/dist/api/compiler/program-utilities.js +28 -15
  157. package/dist/api/compiler/program.d.ts +2 -0
  158. package/dist/api/compiler/program.js +69 -57
  159. package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
  160. package/dist/api/compiler/pseudo-bigint.js +18 -0
  161. package/dist/api/compiler/regexp-checker.d.ts +1 -1
  162. package/dist/api/compiler/regexp-checker.js +93 -76
  163. package/dist/api/compiler/relations.d.ts +27 -4
  164. package/dist/api/compiler/relations.js +337 -180
  165. package/dist/api/compiler/reparser.js +60 -56
  166. package/dist/api/compiler/scanner.d.ts +19 -2
  167. package/dist/api/compiler/scanner.js +123 -108
  168. package/dist/api/compiler/shared-results.d.ts +463 -0
  169. package/dist/api/compiler/shared-results.js +2128 -0
  170. package/dist/api/compiler/sourcemap.js +2 -2
  171. package/dist/api/compiler/symbol-accessibility.js +87 -74
  172. package/dist/api/compiler/symbol.d.ts +22 -13
  173. package/dist/api/compiler/symbol.js +15 -1
  174. package/dist/api/compiler/syntax-kind.d.ts +198 -197
  175. package/dist/api/compiler/transformers/alias-references.js +247 -139
  176. package/dist/api/compiler/transformers/async-utilities.js +25 -25
  177. package/dist/api/compiler/transformers/async.d.ts +0 -1
  178. package/dist/api/compiler/transformers/async.js +64 -77
  179. package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
  180. package/dist/api/compiler/transformers/class-fields.js +81 -78
  181. package/dist/api/compiler/transformers/commonjs-module.js +18 -15
  182. package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
  183. package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
  184. package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
  185. package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
  186. package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
  187. package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
  188. package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
  189. package/dist/api/compiler/transformers/declarations.d.ts +4 -1
  190. package/dist/api/compiler/transformers/declarations.js +305 -238
  191. package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
  192. package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
  193. package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
  194. package/dist/api/compiler/transformers/destructuring.js +19 -18
  195. package/dist/api/compiler/transformers/emit-resolver.js +1 -1
  196. package/dist/api/compiler/transformers/es-decorators.js +55 -55
  197. package/dist/api/compiler/transformers/external-module-info.js +3 -3
  198. package/dist/api/compiler/transformers/for-await.js +25 -25
  199. package/dist/api/compiler/transformers/import-elision.js +14 -14
  200. package/dist/api/compiler/transformers/jsx.js +12 -12
  201. package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
  202. package/dist/api/compiler/transformers/module.js +8 -8
  203. package/dist/api/compiler/transformers/named-evaluation.js +4 -4
  204. package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
  205. package/dist/api/compiler/transformers/optional-chain.js +10 -10
  206. package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
  207. package/dist/api/compiler/transformers/reference-resolver.js +131 -69
  208. package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
  209. package/dist/api/compiler/transformers/subtree-facts.js +47 -47
  210. package/dist/api/compiler/transformers/syntax-facts.js +56 -58
  211. package/dist/api/compiler/transformers/type-eraser.js +73 -66
  212. package/dist/api/compiler/transformers/type-serialization.js +24 -24
  213. package/dist/api/compiler/transformers/using.js +12 -12
  214. package/dist/api/compiler/transformers/utilities.js +77 -77
  215. package/dist/api/compiler/transformers/visitor-base.js +172 -172
  216. package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
  217. package/dist/api/compiler/tsconfig.d.ts +10 -2
  218. package/dist/api/compiler/tsconfig.js +136 -48
  219. package/dist/api/compiler/type-printer.js +40 -3
  220. package/dist/api/compiler/types.d.ts +2 -1
  221. package/dist/api/library/ast.generated.d.ts +42 -39
  222. package/dist/api/library/ast.generated.js +1 -1
  223. package/dist/api/library/compiler-options.generated.d.ts +111 -100
  224. package/dist/api/library/compiler-options.generated.js +1 -1
  225. package/dist/api/library/disk.js +12 -1
  226. package/dist/api/library/enums.generated.d.ts +206 -206
  227. package/dist/api/library/enums.generated.js +206 -206
  228. package/dist/api/library/nodes.js +26 -26
  229. package/package.json +9 -9
  230. package/src/compiler/ast-utilities.ts +99 -7
  231. package/src/compiler/ast.ts +55 -26
  232. package/src/compiler/binder.ts +39 -4
  233. package/src/compiler/character-codes.ts +2 -2
  234. package/src/compiler/checker-calls.ts +76 -8
  235. package/src/compiler/checker-classes.ts +78 -24
  236. package/src/compiler/checker-contextual.ts +6 -1
  237. package/src/compiler/checker-declarations.ts +31 -4
  238. package/src/compiler/checker-declared-types.ts +8 -5
  239. package/src/compiler/checker-decorators.ts +1 -1
  240. package/src/compiler/checker-deprecation.ts +29 -8
  241. package/src/compiler/checker-destructuring.ts +10 -3
  242. package/src/compiler/checker-emit-helpers.ts +1 -0
  243. package/src/compiler/checker-emit-resolver.ts +16 -6
  244. package/src/compiler/checker-expressions.ts +79 -46
  245. package/src/compiler/checker-functions.ts +21 -6
  246. package/src/compiler/checker-generated-code.ts +2 -22
  247. package/src/compiler/checker-grammar.ts +133 -60
  248. package/src/compiler/checker-heritage.ts +22 -21
  249. package/src/compiler/checker-inference.ts +514 -87
  250. package/src/compiler/checker-iteration.ts +18 -31
  251. package/src/compiler/checker-javascript.ts +1 -1
  252. package/src/compiler/checker-jsdoc.ts +50 -27
  253. package/src/compiler/checker-jsx.ts +26 -4
  254. package/src/compiler/checker-members.ts +197 -55
  255. package/src/compiler/checker-modules.ts +332 -65
  256. package/src/compiler/checker-narrowing.ts +98 -19
  257. package/src/compiler/checker-object-literals.ts +3 -0
  258. package/src/compiler/checker-operators.ts +11 -4
  259. package/src/compiler/checker-property-access.ts +7 -2
  260. package/src/compiler/checker-services.ts +39 -12
  261. package/src/compiler/checker-signatures.ts +15 -1
  262. package/src/compiler/checker-source-file.ts +39 -13
  263. package/src/compiler/checker-statements.ts +3 -2
  264. package/src/compiler/checker-symbol-types.ts +29 -6
  265. package/src/compiler/checker-symbols.ts +158 -15
  266. package/src/compiler/checker-type-factory.ts +120 -21
  267. package/src/compiler/checker-type-nodes.ts +46 -3
  268. package/src/compiler/checker-type-operators.ts +83 -26
  269. package/src/compiler/checker-types.ts +147 -4
  270. package/src/compiler/checker-unused.ts +9 -14
  271. package/src/compiler/checker.ts +168 -41
  272. package/src/compiler/command-line.ts +28 -28
  273. package/src/compiler/compile-program.ts +51 -25
  274. package/src/compiler/decoder.ts +13 -4
  275. package/src/compiler/diagnostic-messages.ts +1973 -1892
  276. package/src/compiler/emitter.ts +57 -8
  277. package/src/compiler/encoder.ts +23 -8
  278. package/src/compiler/file-include.ts +9 -3
  279. package/src/compiler/file-loader.ts +139 -32
  280. package/src/compiler/help.ts +10 -14
  281. package/src/compiler/incremental.ts +86 -18
  282. package/src/compiler/init.ts +2 -7
  283. package/src/compiler/instantiation.ts +77 -22
  284. package/src/compiler/jsdoc.ts +3 -1
  285. package/src/compiler/link-tables.ts +82 -37
  286. package/src/compiler/locales/cs-CZ.ts +1 -1
  287. package/src/compiler/locales/de-DE.ts +1 -1
  288. package/src/compiler/locales/es-ES.ts +1 -1
  289. package/src/compiler/locales/fr-FR.ts +1 -1
  290. package/src/compiler/locales/it-IT.ts +1 -1
  291. package/src/compiler/locales/ja-JP.ts +1 -1
  292. package/src/compiler/locales/ko-KR.ts +1 -1
  293. package/src/compiler/locales/pl-PL.ts +1 -1
  294. package/src/compiler/locales/pt-BR.ts +1 -1
  295. package/src/compiler/locales/ru-RU.ts +1 -1
  296. package/src/compiler/locales/tr-TR.ts +1 -1
  297. package/src/compiler/locales/zh-CN.ts +1 -1
  298. package/src/compiler/locales/zh-TW.ts +1 -1
  299. package/src/compiler/module-resolution.ts +44 -8
  300. package/src/compiler/module-specifiers.ts +62 -20
  301. package/src/compiler/name-resolver.ts +9 -1
  302. package/src/compiler/node-builder-names.ts +236 -54
  303. package/src/compiler/node-builder-pseudo.ts +4 -7
  304. package/src/compiler/node-builder-reuse.ts +5 -4
  305. package/src/compiler/node-builder.ts +130 -31
  306. package/src/compiler/option-declarations.ts +33 -103
  307. package/src/compiler/options.ts +23 -62
  308. package/src/compiler/output-paths.ts +5 -18
  309. package/src/compiler/package-entrypoints.ts +345 -0
  310. package/src/compiler/package-json.ts +4 -4
  311. package/src/compiler/parallel-check.ts +197 -8
  312. package/src/compiler/parallel-emit.ts +1 -1
  313. package/src/compiler/parser.ts +156 -39
  314. package/src/compiler/path.ts +22 -2
  315. package/src/compiler/printer/emit-context.ts +16 -0
  316. package/src/compiler/printer/factory-base.ts +10 -3
  317. package/src/compiler/printer/factory.ts +4 -1
  318. package/src/compiler/printer/helpers.ts +10 -1
  319. package/src/compiler/printer/name-generator.ts +24 -2
  320. package/src/compiler/printer/printer.ts +35 -14
  321. package/src/compiler/printer/utilities.ts +8 -2
  322. package/src/compiler/program-checker.ts +53 -5
  323. package/src/compiler/program-utilities.ts +23 -10
  324. package/src/compiler/program.ts +13 -1
  325. package/src/compiler/pseudo-bigint.ts +17 -0
  326. package/src/compiler/regexp-checker.ts +63 -30
  327. package/src/compiler/relations.ts +233 -77
  328. package/src/compiler/reparser.ts +7 -2
  329. package/src/compiler/scanner.ts +109 -79
  330. package/src/compiler/shared-results.ts +2414 -0
  331. package/src/compiler/show-config.ts +18 -1
  332. package/src/compiler/sourcemap.ts +2 -2
  333. package/src/compiler/symbol-accessibility.ts +26 -3
  334. package/src/compiler/symbol.ts +31 -14
  335. package/src/compiler/syntax-kind.ts +188 -187
  336. package/src/compiler/thread-entry.ts +19 -2
  337. package/src/compiler/transformers/alias-references.ts +123 -4
  338. package/src/compiler/transformers/async.ts +2 -17
  339. package/src/compiler/transformers/class-fields.ts +13 -12
  340. package/src/compiler/transformers/commonjs-module.ts +11 -7
  341. package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
  342. package/src/compiler/transformers/declarations-pseudo.ts +2 -4
  343. package/src/compiler/transformers/declarations-resolver.ts +0 -3
  344. package/src/compiler/transformers/declarations-syntactic.ts +1 -21
  345. package/src/compiler/transformers/declarations.ts +134 -48
  346. package/src/compiler/transformers/decorator-metadata.ts +9 -1
  347. package/src/compiler/transformers/destructuring.ts +4 -3
  348. package/src/compiler/transformers/external-module-info.ts +1 -1
  349. package/src/compiler/transformers/jsx.ts +2 -1
  350. package/src/compiler/transformers/reference-resolver.ts +83 -19
  351. package/src/compiler/transformers/runtime-syntax.ts +6 -1
  352. package/src/compiler/transformers/syntax-facts.ts +2 -7
  353. package/src/compiler/transformers/type-eraser.ts +10 -1
  354. package/src/compiler/transformers/type-serialization.ts +3 -2
  355. package/src/compiler/transformers/visitor-base.ts +2 -1
  356. package/src/compiler/transformers/visitor-hooks.ts +9 -4
  357. package/src/compiler/tsc-build.ts +3 -0
  358. package/src/compiler/tsc-cli.ts +2 -0
  359. package/src/compiler/tsc-compile.ts +7 -2
  360. package/src/compiler/tsc-watch.ts +74 -45
  361. package/src/compiler/tsconfig.ts +176 -19
  362. package/src/compiler/type-printer.ts +36 -2
  363. package/src/compiler/types.ts +2 -1
  364. package/src/library/ast.generated.ts +57 -41
  365. package/src/library/compiler-options.generated.ts +117 -103
  366. package/src/library/disk.ts +10 -1
  367. package/src/library/enums.generated.ts +196 -196
@@ -28,14 +28,22 @@ import { getTypeWithFacts, hasTypeFacts, getNonNullableType } from './checker-fl
28
28
  import { getTypeOfModuleExportsSymbol, getWidenedTypeForAssignmentDeclaration } from './checker-javascript.js';
29
29
  import { copyDeclarations, declarationAt, declarationCount, getDeclarations, getSymbolId, } from './symbol.js';
30
30
  export function getTypeOfSymbol(c, symbol) {
31
+ // TSC_TS_SHARE: checker threads share the value types of variables and properties (shared-results.ts).
32
+ if (c.threadSharing !== undefined && isSharedValueSymbol(symbol)) {
33
+ const sharing = c.threadSharing;
34
+ if (sharing.computing === symbol)
35
+ sharing.computing = undefined;
36
+ else
37
+ return threadTypeOfSymbol(c, symbol);
38
+ }
31
39
  const checkFlags = symbol.checkFlags;
32
- if ((checkFlags & 65536 /* CheckFlags.DeferredType */) !== 0)
40
+ if ((checkFlags & 524288 /* CheckFlags.DeferredType */) !== 0)
33
41
  return getTypeOfSymbolWithDeferredType(c, symbol);
34
42
  if ((checkFlags & 1 /* CheckFlags.Instantiated */) !== 0)
35
43
  return getTypeOfInstantiatedSymbol(c, symbol);
36
- if ((checkFlags & 262144 /* CheckFlags.Mapped */) !== 0)
44
+ if ((checkFlags & 2097152 /* CheckFlags.Mapped */) !== 0)
37
45
  return getTypeOfMappedSymbol(c, symbol);
38
- if ((checkFlags & 8192 /* CheckFlags.ReverseMapped */) !== 0)
46
+ if ((checkFlags & 65536 /* CheckFlags.ReverseMapped */) !== 0)
39
47
  return getTypeOfReverseMappedSymbol(c, symbol);
40
48
  const flags = symbol.flags;
41
49
  if ((flags & 98304 /* SymbolFlags.Accessor */) !== 0)
@@ -94,7 +102,7 @@ function getTypeOfInstantiatedSymbol(c, symbol) {
94
102
  }
95
103
  export function getWriteTypeOfSymbol(c, symbol) {
96
104
  if ((symbol.checkFlags & 2 /* CheckFlags.SyntheticProperty */) !== 0) {
97
- if ((symbol.checkFlags & 65536 /* CheckFlags.DeferredType */) !== 0)
105
+ if ((symbol.checkFlags & 524288 /* CheckFlags.DeferredType */) !== 0)
98
106
  return getWriteTypeOfSymbolWithDeferredType(c, symbol);
99
107
  const id = getSymbolId(symbol);
100
108
  return c.symbolLinkTable.get(id)?.writeType ?? c.symbolTypes.get(id) ?? getTypeOfSymbol(c, symbol);
@@ -129,9 +137,9 @@ function isParameterOfContextSensitiveSignature(c, symbol) {
129
137
  let decl = symbol.valueDeclaration;
130
138
  if (decl === undefined)
131
139
  return false;
132
- if (decl.kind === 209 /* SyntaxKind.BindingElement */)
140
+ if (decl.kind === 210 /* SyntaxKind.BindingElement */)
133
141
  decl = getRootDeclaration(decl);
134
- return decl.kind === 170 /* SyntaxKind.Parameter */ && isContextSensitiveFunctionLikeLazy(c, decl.parent);
142
+ return decl.kind === 171 /* SyntaxKind.Parameter */ && isContextSensitiveFunctionLikeLazy(c, decl.parent);
135
143
  }
136
144
  import { isContextSensitiveFunctionOrObjectLiteralMethod as isContextSensitiveFunctionLikeLazy } from './checker-expressions.js';
137
145
  function getTypeOfVariableOrParameterOrPropertyWorker(c, symbol) {
@@ -143,7 +151,7 @@ function getTypeOfVariableOrParameterOrPropertyWorker(c, symbol) {
143
151
  if (declaration === undefined)
144
152
  return c.errorType;
145
153
  // The `export=` symbol of a JSON file has the type of its value.
146
- if (declaration.kind === 307 /* SyntaxKind.SourceFile */ && isJsonSourceFile(declaration)) {
154
+ if (declaration.kind === 308 /* SyntaxKind.SourceFile */ && isJsonSourceFile(declaration)) {
147
155
  const statements = declaration.statements.nodes;
148
156
  if (statements.length === 0)
149
157
  return c.emptyObjectType;
@@ -157,28 +165,30 @@ function getTypeOfVariableOrParameterOrPropertyWorker(c, symbol) {
157
165
  return getTypeOfModuleExportsSymbol(c, symbol);
158
166
  let result;
159
167
  switch (declaration.kind) {
160
- case 170 /* SyntaxKind.Parameter */:
161
- case 173 /* SyntaxKind.PropertyDeclaration */:
162
- case 172 /* SyntaxKind.PropertySignature */:
163
- case 261 /* SyntaxKind.VariableDeclaration */:
164
- case 209 /* SyntaxKind.BindingElement */:
165
- result = getWidenedTypeForVariableLikeDeclaration(c, declaration, true);
168
+ case 171 /* SyntaxKind.Parameter */:
169
+ case 174 /* SyntaxKind.PropertyDeclaration */:
170
+ case 173 /* SyntaxKind.PropertySignature */:
171
+ case 262 /* SyntaxKind.VariableDeclaration */:
172
+ case 210 /* SyntaxKind.BindingElement */:
173
+ // A parameter of a context sensitive function may get another type when its context is known, so
174
+ // its widening errors are left to that.
175
+ result = getWidenedTypeForVariableLikeDeclaration(c, declaration, !isParameterOfContextSensitiveSignature(c, symbol));
166
176
  break;
167
- case 303 /* SyntaxKind.PropertyAssignment */:
168
- case 304 /* SyntaxKind.ShorthandPropertyAssignment */:
169
- case 175 /* SyntaxKind.MethodDeclaration */:
177
+ case 304 /* SyntaxKind.PropertyAssignment */:
178
+ case 305 /* SyntaxKind.ShorthandPropertyAssignment */:
179
+ case 176 /* SyntaxKind.MethodDeclaration */:
170
180
  // The declared symbol of an object literal member, as opposed to the checked literal's property.
171
- if (declaration.kind === 303 /* SyntaxKind.PropertyAssignment */)
181
+ if (declaration.kind === 304 /* SyntaxKind.PropertyAssignment */)
172
182
  result = checkPropertyAssignment(c, declaration, 0 /* CheckMode.Normal */);
173
- else if (declaration.kind === 304 /* SyntaxKind.ShorthandPropertyAssignment */)
183
+ else if (declaration.kind === 305 /* SyntaxKind.ShorthandPropertyAssignment */)
174
184
  result = checkShorthandPropertyAssignment(c, declaration, true, 0 /* CheckMode.Normal */);
175
185
  else
176
186
  result = getTypeOfObjectLiteralMethod(c, declaration, 0 /* CheckMode.Normal */);
177
187
  break;
178
- case 292 /* SyntaxKind.JsxAttribute */:
188
+ case 293 /* SyntaxKind.JsxAttribute */:
179
189
  result = checkJsxAttribute(c, declaration, 0 /* CheckMode.Normal */);
180
190
  break;
181
- case 278 /* SyntaxKind.ExportAssignment */: {
191
+ case 279 /* SyntaxKind.ExportAssignment */: {
182
192
  const typeNode = getType(declaration);
183
193
  result =
184
194
  typeNode !== undefined
@@ -186,11 +196,11 @@ function getTypeOfVariableOrParameterOrPropertyWorker(c, symbol) {
186
196
  : widenTypeForVariableLikeDeclaration(c, checkExpressionCached(c, getExpression(declaration)), declaration, false);
187
197
  break;
188
198
  }
189
- case 306 /* SyntaxKind.EnumMember */:
199
+ case 307 /* SyntaxKind.EnumMember */:
190
200
  result = getTypeOfEnumMember(c, symbol);
191
201
  break;
192
- case 227 /* SyntaxKind.BinaryExpression */:
193
- case 214 /* SyntaxKind.CallExpression */:
202
+ case 228 /* SyntaxKind.BinaryExpression */:
203
+ case 215 /* SyntaxKind.CallExpression */:
194
204
  result = getWidenedTypeForAssignmentDeclaration(c, symbol);
195
205
  break;
196
206
  default:
@@ -212,23 +222,23 @@ export function isOptionalDeclaration(node) {
212
222
  return postfix !== undefined && postfix.kind === 57 /* SyntaxKind.QuestionToken */;
213
223
  }
214
224
  function isEmptyArrayLiteral(node) {
215
- return node.kind === 210 /* SyntaxKind.ArrayLiteralExpression */ && getElements(node).nodes.length === 0;
225
+ return node.kind === 211 /* SyntaxKind.ArrayLiteralExpression */ && getElements(node).nodes.length === 0;
216
226
  }
217
227
  function isNullOrUndefined(node) {
218
228
  let n = node;
219
- while (n.kind === 218 /* SyntaxKind.ParenthesizedExpression */)
229
+ while (n.kind === 219 /* SyntaxKind.ParenthesizedExpression */)
220
230
  n = getExpression(n);
221
231
  return n.kind === 105 /* SyntaxKind.NullKeyword */ || (n.kind === 79 /* SyntaxKind.Identifier */ && getText(n) === 'undefined');
222
232
  }
223
233
  function isBindingPattern(node) {
224
234
  return (node !== undefined &&
225
- (node.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || node.kind === 208 /* SyntaxKind.ArrayBindingPattern */));
235
+ (node.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || node.kind === 209 /* SyntaxKind.ArrayBindingPattern */));
226
236
  }
227
237
  /** The declared or inferred type of a variable-like declaration; undefined when nothing can be inferred. */
228
238
  export function getTypeForVariableLikeDeclaration(c, declaration, includeOptionality, checkMode = 0 /* CheckMode.Normal */) {
229
- if (declaration.kind === 261 /* SyntaxKind.VariableDeclaration */) {
239
+ if (declaration.kind === 262 /* SyntaxKind.VariableDeclaration */) {
230
240
  const grandParent = declaration.parent.parent;
231
- if (grandParent.kind === 250 /* SyntaxKind.ForInStatement */) {
241
+ if (grandParent.kind === 251 /* SyntaxKind.ForInStatement */) {
232
242
  // `for (k in x)` declares k as string, or keyof T for generic x.
233
243
  let objectType = checkExpressionEx(c, getExpression(grandParent), checkMode);
234
244
  if (hasTypeFacts(c, objectType, 50331648 /* TypeFacts.IsUndefinedOrNull */))
@@ -238,14 +248,14 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
238
248
  ? getExtractStringType(c, indexType)
239
249
  : c.stringType;
240
250
  }
241
- if (grandParent.kind === 251 /* SyntaxKind.ForOfStatement */)
251
+ if (grandParent.kind === 252 /* SyntaxKind.ForOfStatement */)
242
252
  return checkRightHandSideOfForOf(c, grandParent);
243
253
  }
244
- else if (declaration.kind === 209 /* SyntaxKind.BindingElement */)
254
+ else if (declaration.kind === 210 /* SyntaxKind.BindingElement */)
245
255
  return getTypeForBindingElement(c, declaration);
246
- const isProperty = (declaration.kind === 173 /* SyntaxKind.PropertyDeclaration */ &&
256
+ const isProperty = (declaration.kind === 174 /* SyntaxKind.PropertyDeclaration */ &&
247
257
  (getCombinedModifierFlags(declaration) & 512 /* ModifierFlags.Accessor */) === 0) ||
248
- declaration.kind === 172 /* SyntaxKind.PropertySignature */;
258
+ declaration.kind === 173 /* SyntaxKind.PropertySignature */;
249
259
  const isOptional = includeOptionality && isOptionalDeclaration(declaration);
250
260
  const typeNode = getType(declaration);
251
261
  const declaredType = typeNode !== undefined ? getTypeFromTypeNode(c, typeNode) : undefined;
@@ -257,7 +267,7 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
257
267
  if (declaredType !== undefined)
258
268
  return addOptionality(c, declaredType, isProperty, isOptional);
259
269
  if (c.noImplicitAny &&
260
- declaration.kind === 261 /* SyntaxKind.VariableDeclaration */ &&
270
+ declaration.kind === 262 /* SyntaxKind.VariableDeclaration */ &&
261
271
  !isBindingPattern(getName(declaration)) &&
262
272
  (getCombinedModifierFlags(declaration) & 32 /* ModifierFlags.Export */) === 0 &&
263
273
  (declaration.flags & 8388608 /* NodeFlags.Ambient */) === 0) {
@@ -269,14 +279,14 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
269
279
  if (initializer !== undefined && isEmptyArrayLiteral(initializer))
270
280
  return c.autoArrayType;
271
281
  }
272
- if (declaration.kind === 170 /* SyntaxKind.Parameter */) {
282
+ if (declaration.kind === 171 /* SyntaxKind.Parameter */) {
273
283
  if (getSymbol(declaration) === undefined)
274
284
  return undefined;
275
285
  const fn = declaration.parent;
276
286
  // A set accessor parameter takes the getter's type.
277
- if (fn.kind === 179 /* SyntaxKind.SetAccessor */) {
287
+ if (fn.kind === 180 /* SyntaxKind.SetAccessor */) {
278
288
  const fnSymbol = getSymbolOfDeclaration(c, fn);
279
- const getter = fnSymbol !== undefined ? getDeclarations(fnSymbol).find((d) => d.kind === 178 /* SyntaxKind.GetAccessor */) : undefined;
289
+ const getter = fnSymbol !== undefined ? getDeclarations(fnSymbol).find((d) => d.kind === 179 /* SyntaxKind.GetAccessor */) : undefined;
280
290
  if (getter !== undefined) {
281
291
  const getterSignature = getSignatureFromDeclaration(c, getter);
282
292
  // An unannotated `this` of a setter takes the getter's `this` type.
@@ -302,7 +312,7 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
302
312
  const t = widenTypeInferredFromInitializer(c, declaration, checkDeclarationInitializer(c, declaration, checkMode));
303
313
  return addOptionality(c, t, isProperty, isOptional);
304
314
  }
305
- if (c.noImplicitAny && declaration.kind === 173 /* SyntaxKind.PropertyDeclaration */) {
315
+ if (c.noImplicitAny && declaration.kind === 174 /* SyntaxKind.PropertyDeclaration */) {
306
316
  // Without an annotation or initializer, the type comes from `this` assignments in the
307
317
  // constructor or static blocks.
308
318
  const symbol = getSymbol(declaration);
@@ -318,7 +328,7 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
318
328
  else {
319
329
  const staticBlocks = [];
320
330
  for (const member of getMembers(declaration.parent).nodes)
321
- if (member.kind === 176 /* SyntaxKind.ClassStaticBlockDeclaration */)
331
+ if (member.kind === 177 /* SyntaxKind.ClassStaticBlockDeclaration */)
322
332
  staticBlocks.push(member);
323
333
  if (staticBlocks.length !== 0)
324
334
  t = getFlowTypeInStaticBlocks(c, symbol, staticBlocks);
@@ -327,7 +337,7 @@ export function getTypeForVariableLikeDeclaration(c, declaration, includeOptiona
327
337
  }
328
338
  return t !== undefined ? addOptionality(c, t, true, isOptional) : undefined;
329
339
  }
330
- if (declaration.kind === 292 /* SyntaxKind.JsxAttribute */)
340
+ if (declaration.kind === 293 /* SyntaxKind.JsxAttribute */)
331
341
  return c.trueType;
332
342
  if (isBindingPattern(getName(declaration)))
333
343
  return getTypeFromBindingPattern(c, getName(declaration), false, true);
@@ -354,7 +364,7 @@ export function getWidenedLiteralTypeForInitializer(c, declaration, t) {
354
364
  return getWidenedLiteralType(c, t);
355
365
  }
356
366
  function isDeclarationReadonly(declaration) {
357
- return ((getCombinedModifierFlags(declaration) & 8 /* ModifierFlags.Readonly */) !== 0 && declaration.kind !== 170 /* SyntaxKind.Parameter */);
367
+ return ((getCombinedModifierFlags(declaration) & 8 /* ModifierFlags.Readonly */) !== 0 && declaration.kind !== 171 /* SyntaxKind.Parameter */);
358
368
  }
359
369
  function isGlobalSymbolConstructor(c, node) {
360
370
  const symbol = getSymbolOfDeclaration(c, node);
@@ -370,13 +380,13 @@ export function widenTypeForVariableLikeDeclaration(c, t, declaration, reportErr
370
380
  reportErrorsFromWidening(c, declaration, t, 0 /* WideningKind.Normal */);
371
381
  // A unique symbol type from another declaration widens.
372
382
  if ((t.flags & 16384 /* TypeFlags.UniqueESSymbol */) !== 0 &&
373
- (declaration.kind === 209 /* SyntaxKind.BindingElement */ || getType(declaration) === undefined) &&
383
+ (declaration.kind === 210 /* SyntaxKind.BindingElement */ || getType(declaration) === undefined) &&
374
384
  t.symbol !== getSymbolOfDeclaration(c, declaration))
375
385
  t = c.esSymbolType;
376
386
  return getWidenedType(c, t);
377
387
  }
378
388
  // Rest parameters default to any[], others to any.
379
- const isRest = declaration.kind === 170 /* SyntaxKind.Parameter */ && getDotDotDotToken(declaration) !== undefined;
389
+ const isRest = declaration.kind === 171 /* SyntaxKind.Parameter */ && getDotDotDotToken(declaration) !== undefined;
380
390
  const result = isRest ? c.anyArrayType : c.anyType;
381
391
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(declaration))
382
392
  reportImplicitAny(c, declaration, result);
@@ -384,7 +394,7 @@ export function widenTypeForVariableLikeDeclaration(c, t, declaration, reportErr
384
394
  }
385
395
  export function declarationBelongsToPrivateAmbientMember(declaration) {
386
396
  const root = getRootDeclaration(declaration);
387
- const member = root.kind === 170 /* SyntaxKind.Parameter */ ? root.parent : root;
397
+ const member = root.kind === 171 /* SyntaxKind.Parameter */ ? root.parent : root;
388
398
  return isPrivateWithinAmbient(member);
389
399
  }
390
400
  export function isPrivateWithinAmbient(node) {
@@ -443,7 +453,7 @@ function reportWideningErrorsInType(c, t) {
443
453
  }
444
454
  }
445
455
  if (valueDeclaration !== undefined) {
446
- c.error(valueDeclaration, 1690 /* Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type */, symbolToString(c, p), typeToString(c, getWidenedType(c, s)));
456
+ c.error(valueDeclaration, 1709 /* Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type */, symbolToString(c, p), typeToString(c, getWidenedType(c, s)));
447
457
  errorReported = true;
448
458
  }
449
459
  }
@@ -458,29 +468,29 @@ export function reportImplicitAny(c, declaration, t, wideningKind = 0 /* Widenin
458
468
  const typeAsString = typeToString(c, getWidenedType(c, t));
459
469
  let message;
460
470
  switch (declaration.kind) {
461
- case 227 /* SyntaxKind.BinaryExpression */:
462
- case 173 /* SyntaxKind.PropertyDeclaration */:
463
- case 172 /* SyntaxKind.PropertySignature */:
471
+ case 228 /* SyntaxKind.BinaryExpression */:
472
+ case 174 /* SyntaxKind.PropertyDeclaration */:
473
+ case 173 /* SyntaxKind.PropertySignature */:
464
474
  message = c.noImplicitAny
465
- ? 1680 /* Diagnostics.Member_0_implicitly_has_an_1_type */
466
- : 1716 /* Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
475
+ ? 1699 /* Diagnostics.Member_0_implicitly_has_an_1_type */
476
+ : 1735 /* Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
467
477
  break;
468
- case 170 /* SyntaxKind.Parameter */: {
478
+ case 171 /* SyntaxKind.Parameter */: {
469
479
  const isRest = getDotDotDotToken(declaration) !== undefined;
470
480
  // `(string) => void` most likely meant a parameter of type `string`.
471
481
  const name = getName(declaration);
472
482
  const parent = declaration.parent;
473
483
  if (name !== undefined &&
474
484
  name.kind === 79 /* SyntaxKind.Identifier */ &&
475
- (parent.kind === 180 /* SyntaxKind.CallSignature */ ||
476
- parent.kind === 174 /* SyntaxKind.MethodSignature */ ||
477
- parent.kind === 185 /* SyntaxKind.FunctionType */)) {
485
+ (parent.kind === 181 /* SyntaxKind.CallSignature */ ||
486
+ parent.kind === 175 /* SyntaxKind.MethodSignature */ ||
487
+ parent.kind === 186 /* SyntaxKind.FunctionType */)) {
478
488
  const index = getParameters(parent).nodes.indexOf(declaration);
479
489
  const text = getText(name);
480
490
  if (index >= 0 &&
481
491
  (isTypeNodeKind(identifierToKeywordKind(text)) ||
482
492
  resolveName(c, declaration, text, 788968 /* SymbolFlags.Type */, undefined, true, false) !== undefined)) {
483
- c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(declaration, 1722 /* Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1 */, [
493
+ c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(declaration, 1741 /* Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1 */, [
484
494
  'arg' + index,
485
495
  declarationNameToString(file, name) + (isRest ? '[]' : ''),
486
496
  ]));
@@ -489,51 +499,56 @@ export function reportImplicitAny(c, declaration, t, wideningKind = 0 /* Widenin
489
499
  }
490
500
  if (isRest)
491
501
  message = c.noImplicitAny
492
- ? 1691 /* Diagnostics.Rest_parameter_0_implicitly_has_an_any_type */
493
- : 1718 /* Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage */;
502
+ ? 1710 /* Diagnostics.Rest_parameter_0_implicitly_has_an_any_type */
503
+ : 1737 /* Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage */;
494
504
  else
495
505
  message = c.noImplicitAny
496
- ? 1679 /* Diagnostics.Parameter_0_implicitly_has_an_1_type */
497
- : 1715 /* Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
506
+ ? 1698 /* Diagnostics.Parameter_0_implicitly_has_an_1_type */
507
+ : 1734 /* Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
498
508
  break;
499
509
  }
500
- case 209 /* SyntaxKind.BindingElement */:
510
+ case 210 /* SyntaxKind.BindingElement */:
501
511
  if (!c.noImplicitAny)
502
512
  return;
503
- message = 1702 /* Diagnostics.Binding_element_0_implicitly_has_an_1_type */;
513
+ message = 1721 /* Diagnostics.Binding_element_0_implicitly_has_an_1_type */;
504
514
  break;
505
- case 263 /* SyntaxKind.FunctionDeclaration */:
506
- case 175 /* SyntaxKind.MethodDeclaration */:
507
- case 174 /* SyntaxKind.MethodSignature */:
508
- case 178 /* SyntaxKind.GetAccessor */:
509
- case 179 /* SyntaxKind.SetAccessor */:
510
- case 219 /* SyntaxKind.FunctionExpression */:
511
- case 220 /* SyntaxKind.ArrowFunction */:
515
+ case 264 /* SyntaxKind.FunctionDeclaration */:
516
+ case 176 /* SyntaxKind.MethodDeclaration */:
517
+ case 175 /* SyntaxKind.MethodSignature */:
518
+ case 179 /* SyntaxKind.GetAccessor */:
519
+ case 180 /* SyntaxKind.SetAccessor */:
520
+ case 220 /* SyntaxKind.FunctionExpression */:
521
+ case 221 /* SyntaxKind.ArrowFunction */:
512
522
  if (c.noImplicitAny && getName(declaration) === undefined) {
513
523
  c.error(declaration, wideningKind === 3 /* WideningKind.GeneratorYield */
514
- ? 1696 /* Diagnostics.Generator_implicitly_has_yield_type_0_Consider_supplying_a_return_type_annotation */
515
- : 1683 /* Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type */, typeAsString);
524
+ ? 1715 /* Diagnostics.Generator_implicitly_has_yield_type_0_Consider_supplying_a_return_type_annotation */
525
+ : 1702 /* Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type */, typeAsString);
516
526
  return;
517
527
  }
518
528
  if (c.noImplicitAny && (declaration.flags & 8 /* NodeFlags.Reparsed */) !== 0) {
519
- c.error(declaration, 1684 /* Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation */, typeAsString);
529
+ // A JSDoc `@overload`.
530
+ const nameText = declarationNameToString(file, getNameOfDeclaration(declaration));
531
+ if (nameText !== '')
532
+ c.error(declaration, 1701 /* Diagnostics.X_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type */, nameText, typeAsString);
533
+ else
534
+ c.error(declaration, 1703 /* Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation */, typeAsString);
520
535
  return;
521
536
  }
522
537
  if (!c.noImplicitAny)
523
- message = 1721 /* Diagnostics.X_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage */;
538
+ message = 1740 /* Diagnostics.X_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage */;
524
539
  else if (wideningKind === 3 /* WideningKind.GeneratorYield */)
525
- message = 1726 /* Diagnostics.X_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type */;
540
+ message = 1745 /* Diagnostics.X_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type */;
526
541
  else
527
- message = 1682 /* Diagnostics.X_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type */;
542
+ message = 1701 /* Diagnostics.X_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type */;
528
543
  break;
529
- case 201 /* SyntaxKind.MappedType */:
544
+ case 202 /* SyntaxKind.MappedType */:
530
545
  if (c.noImplicitAny)
531
- c.error(declaration, 1710 /* Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type */);
546
+ c.error(declaration, 1729 /* Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type */);
532
547
  return;
533
548
  default:
534
549
  message = c.noImplicitAny
535
- ? 1678 /* Diagnostics.Variable_0_implicitly_has_an_1_type */
536
- : 1714 /* Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
550
+ ? 1697 /* Diagnostics.Variable_0_implicitly_has_an_1_type */
551
+ : 1733 /* Diagnostics.Variable_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage */;
537
552
  }
538
553
  const name = getNameOfDeclaration(declaration);
539
554
  c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(declaration, message, [declarationNameToString(file, name), typeAsString]));
@@ -758,7 +773,7 @@ function someReadonlyAssignmentDeclaration(c, symbol) {
758
773
  }
759
774
  /** An `Object.defineProperty` call with a value and no `writable: true`, or without a setter. */
760
775
  function isReadonlyAssignmentDeclaration(c, node) {
761
- if (node.kind !== 214 /* SyntaxKind.CallExpression */)
776
+ if (node.kind !== 215 /* SyntaxKind.CallExpression */)
762
777
  return false;
763
778
  const args = getArguments(node);
764
779
  if (args === undefined || args.nodes.length < 3)
@@ -769,7 +784,7 @@ function isReadonlyAssignmentDeclaration(c, node) {
769
784
  if (writable === undefined)
770
785
  return true;
771
786
  const declaration = writable.valueDeclaration;
772
- const writableType = declaration !== undefined && declaration.kind === 303 /* SyntaxKind.PropertyAssignment */
787
+ const writableType = declaration !== undefined && declaration.kind === 304 /* SyntaxKind.PropertyAssignment */
773
788
  ? checkExpression(c, getInitializer(declaration))
774
789
  : getTypeOfSymbol(c, writable);
775
790
  return writableType === c.falseType || writableType === c.regularFalseType;
@@ -782,6 +797,7 @@ import { getParameterTypeOfFullSignature } from './checker-jsdoc.js';
782
797
  import { isFunctionLikeDeclarationKind, isInJSFile } from './ast-utilities.js';
783
798
  import { isEmptyArrayLiteralType } from './relations.js';
784
799
  import { isCheckJsEnabledForFile } from './program-utilities.js';
800
+ import { isSharedValueSymbol, threadTypeOfSymbol } from './shared-results.js';
785
801
  function getDeclarationModifierFlags(c, symbol) {
786
802
  return getDeclarationModifierFlagsFromSymbol(c, symbol, false);
787
803
  }
@@ -792,9 +808,9 @@ function getDeclarationNodeFlagsFromSymbol(symbol) {
792
808
  export function getAnnotatedAccessorTypeNode(accessor) {
793
809
  if (accessor === undefined)
794
810
  return undefined;
795
- if (accessor.kind === 178 /* SyntaxKind.GetAccessor */ || accessor.kind === 173 /* SyntaxKind.PropertyDeclaration */)
811
+ if (accessor.kind === 179 /* SyntaxKind.GetAccessor */ || accessor.kind === 174 /* SyntaxKind.PropertyDeclaration */)
796
812
  return getType(accessor);
797
- if (accessor.kind === 179 /* SyntaxKind.SetAccessor */) {
813
+ if (accessor.kind === 180 /* SyntaxKind.SetAccessor */) {
798
814
  const params = getParameters(accessor)?.nodes ?? [];
799
815
  if (params.length === 0)
800
816
  return undefined;
@@ -809,7 +825,7 @@ function getAnnotatedAccessorType(c, accessor) {
809
825
  /** The `accessor` property declaration of `symbol`, if any. */
810
826
  function getAutoAccessorDeclaration(symbol) {
811
827
  for (const d of getDeclarations(symbol))
812
- if (d.kind === 173 /* SyntaxKind.PropertyDeclaration */ && (getCombinedModifierFlags(d) & 512 /* ModifierFlags.Accessor */) !== 0)
828
+ if (d.kind === 174 /* SyntaxKind.PropertyDeclaration */ && (getCombinedModifierFlags(d) & 512 /* ModifierFlags.Accessor */) !== 0)
813
829
  return d;
814
830
  return undefined;
815
831
  }
@@ -820,8 +836,8 @@ function getTypeOfAccessors(c, symbol) {
820
836
  return type;
821
837
  if (!pushTypeResolution(c, symbol, 0 /* TypeSystemPropertyName.Type */))
822
838
  return c.errorType;
823
- const getter = getDeclarations(symbol).find((d) => d.kind === 178 /* SyntaxKind.GetAccessor */);
824
- const setter = getDeclarations(symbol).find((d) => d.kind === 179 /* SyntaxKind.SetAccessor */);
839
+ const getter = getDeclarations(symbol).find((d) => d.kind === 179 /* SyntaxKind.GetAccessor */);
840
+ const setter = getDeclarations(symbol).find((d) => d.kind === 180 /* SyntaxKind.SetAccessor */);
825
841
  const accessor = getAutoAccessorDeclaration(symbol);
826
842
  // Getter annotation, setter annotation, accessor annotation, then getter body.
827
843
  let t = getAnnotatedAccessorType(c, getter) ?? getAnnotatedAccessorType(c, setter) ?? getAnnotatedAccessorType(c, accessor);
@@ -831,18 +847,18 @@ function getTypeOfAccessors(c, symbol) {
831
847
  t = getWidenedTypeForVariableLikeDeclaration(c, accessor, true);
832
848
  if (t === undefined) {
833
849
  if (setter !== undefined && !isPrivateWithinAmbient(setter))
834
- c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(setter, 1703 /* Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation */, [symbolToString(c, symbol)]));
850
+ c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(setter, 1722 /* Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation */, [symbolToString(c, symbol)]));
835
851
  else if (getter !== undefined && !isPrivateWithinAmbient(getter))
836
- c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(getter, 1704 /* Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation */, [symbolToString(c, symbol)]));
852
+ c.addErrorOrSuggestion(c.noImplicitAny, createDiagnosticForNode(getter, 1723 /* Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation */, [symbolToString(c, symbol)]));
837
853
  t = c.anyType;
838
854
  }
839
855
  if (!popTypeResolution(c)) {
840
856
  if (getAnnotatedAccessorTypeNode(getter) !== undefined)
841
- c.error(getter, 662 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
857
+ c.error(getter, 669 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
842
858
  else if (getAnnotatedAccessorTypeNode(setter) !== undefined)
843
- c.error(setter, 662 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
859
+ c.error(setter, 669 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
844
860
  else if (getter !== undefined && c.noImplicitAny)
845
- c.error(getter, 1694 /* Diagnostics.X_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions */, symbolToString(c, symbol));
861
+ c.error(getter, 1713 /* Diagnostics.X_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions */, symbolToString(c, symbol));
846
862
  t = c.anyType;
847
863
  }
848
864
  let cached = c.symbolTypes.get(id);
@@ -858,11 +874,11 @@ export function getWriteTypeOfAccessors(c, symbol) {
858
874
  return links.writeType;
859
875
  if (!pushTypeResolution(c, symbol, 7 /* TypeSystemPropertyName.WriteType */))
860
876
  return c.errorType;
861
- const setter = getDeclarations(symbol).find((d) => d.kind === 179 /* SyntaxKind.SetAccessor */) ?? getAutoAccessorDeclaration(symbol);
877
+ const setter = getDeclarations(symbol).find((d) => d.kind === 180 /* SyntaxKind.SetAccessor */) ?? getAutoAccessorDeclaration(symbol);
862
878
  let writeType = getAnnotatedAccessorType(c, setter);
863
879
  if (!popTypeResolution(c)) {
864
880
  if (getAnnotatedAccessorTypeNode(setter) !== undefined)
865
- c.error(setter, 662 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
881
+ c.error(setter, 669 /* Diagnostics.X_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation */, symbolToString(c, symbol));
866
882
  writeType = c.anyType;
867
883
  }
868
884
  // Without a setter annotation, the write type is the read type.
@@ -885,7 +901,7 @@ function getTypeOfFuncClassEnumModuleWorker(c, symbol) {
885
901
  return c.anyType;
886
902
  if ((symbol.flags & 512 /* SymbolFlags.ValueModule */) !== 0 &&
887
903
  symbol.valueDeclaration !== undefined &&
888
- symbol.valueDeclaration.kind === 307 /* SyntaxKind.SourceFile */) {
904
+ symbol.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */) {
889
905
  const resolvedModule = resolveExternalModuleSymbol(c, symbol, false);
890
906
  if (resolvedModule !== undefined && resolvedModule !== symbol)
891
907
  return getTypeOfSymbol(c, resolvedModule);
@@ -901,7 +917,7 @@ function getTypeOfFuncClassEnumModuleWorker(c, symbol) {
901
917
  }
902
918
  function isShorthandAmbientModuleSymbol(symbol) {
903
919
  const d = symbol.valueDeclaration;
904
- return d !== undefined && d.kind === 268 /* SyntaxKind.ModuleDeclaration */ && getBody(d) === undefined;
920
+ return d !== undefined && d.kind === 269 /* SyntaxKind.ModuleDeclaration */ && getBody(d) === undefined;
905
921
  }
906
922
  export function getBaseTypeVariableOfClass(c, symbol) {
907
923
  const baseConstructorType = getBaseConstructorTypeOfClass(c, getDeclaredTypeOfClassOrInterface(c, symbol));
@@ -1,4 +1,4 @@
1
- import { type Identifier, type Node, type PatternAmbientModule, type SourceFile, Tristate } from './ast.js';
1
+ import { type Identifier, type Node, PatternAmbientModule, type SourceFile, Tristate } from './ast.js';
2
2
  import { getSourceFileOfNode } from './binder-utilities.js';
3
3
  import { type Diagnostic, type DiagnosticMessage } from './diagnostics.js';
4
4
  import { NameResolver } from './name-resolver.js';
@@ -28,6 +28,12 @@ export declare class CheckerNameResolver extends NameResolver {
28
28
  export declare function resolveName(c: Checker, location: Node | undefined, name: string, meaning: SymbolFlags, nameNotFoundMessage: DiagnosticMessage | undefined, isUse: boolean, excludeGlobals: boolean): Symbol | undefined;
29
29
  /** `symbols[name]` (merged) if it has `meaning`, directly or through an alias. */
30
30
  export declare function getSymbolOfMeaning(c: Checker, symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol | undefined;
31
+ /**
32
+ * The name-not-found message of an identifier resolved from its own location, chosen only once the name
33
+ * isn't found (`onFailedToResolveSymbol`). Choosing it up front, as tsgo does, compares every resolved
34
+ * identifier's text with the list of names `getCannotFindNameDiagnosticForName` has messages for.
35
+ */
36
+ export declare const cannotFindNameAtLocation: DiagnosticMessage;
31
37
  /** Resolves names to their closest misspelling in scope, for "Did you mean" suggestions. */
32
38
  export declare class SuggestionNameResolver extends CheckerNameResolver {
33
39
  lookup(symbols: SymbolTable, name: string, meaning: SymbolFlags): Symbol | undefined;
@@ -78,6 +84,7 @@ export declare class MergedGlobals {
78
84
  readonly ambientModuleSymbols: Symbol[];
79
85
  readonly patternAmbientModules: PatternAmbientModule[];
80
86
  readonly patternAmbientModuleAugmentations: Map<string, Symbol>;
87
+ readonly patternAmbientModuleAugmentationTargets: Map<string, Symbol>;
81
88
  /** Whether the global `undefined` is the checker's own (no declaration of `undefined` merged). */
82
89
  readonly ownUndefined: boolean;
83
90
  /** Ids of the symbols merged into each shared symbol. */
@@ -147,6 +154,11 @@ export declare function isReservedMemberName(name: string): boolean;
147
154
  export declare function symbolIsValue(c: Checker, symbol: Symbol): boolean;
148
155
  /** Value members other than signatures and index signatures, declared ones first, each part ordered by declaration. */
149
156
  export declare function getNamedMembers(c: Checker, members: SymbolTable | undefined, container: Symbol | undefined): Symbol[];
157
+ /**
158
+ * `getNamedMembers(c, table, container)` for a table that holds `members` in this order under their names, as
159
+ * positions in `members`; undefined where a member is an alias (`symbolIsValue` then resolves it) or a name repeats.
160
+ */
161
+ export declare function getNamedMemberPositions(c: Checker, members: Symbol[], container: Symbol | undefined): number[] | undefined;
150
162
  export declare function getFirstIdentifier(node: Node): Identifier;
151
163
  export declare function resolveEntityName(c: Checker, name: Node, meaning: SymbolFlags, ignoreErrors: boolean, dontResolveAlias: boolean, location: Node | undefined): Symbol | undefined;
152
164
  /**