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
@@ -10,7 +10,7 @@ import { isPartOfTypeNode } from './transformers/alias-references.js';
10
10
  import { createDiagnosticForNode } from './checker.js';
11
11
  import { TypePredicate } from './checker-types.js';
12
12
  import { filterType, getIntersectionType, getRegularTypeOfLiteralType, getUnionTypeEx, isErrorType, isUnitType, someType, } from './checker-type-factory.js';
13
- import { getTypeOfSymbol, getWidenedType, isPrivateWithinAmbient, reportErrorsFromWidening, reportImplicitAny, } from './checker-symbol-types.js';
13
+ import { getTypeOfSymbol, getWidenedType, isPrivateWithinAmbient, reportErrorsFromWidening, reportImplicitAny, getWidenedTypeForVariableLikeDeclaration, } from './checker-symbol-types.js';
14
14
  import { getMergedSymbol, getSymbolOfDeclaration } from './checker-symbols.js';
15
15
  import { getReturnTypeFromAnnotation, getReturnTypeOfSignature, getSignatureFromDeclaration, } from './checker-signatures.js';
16
16
  import { checkExpression, checkExpressionCached, getWidenedLiteralLikeTypeForContextualType, isConstContext, } from './checker-expressions.js';
@@ -31,7 +31,7 @@ import { isTypeAssignableTo } from './relations.js';
31
31
  import { inferTypes } from './checker-inference.js';
32
32
  import { couldContainTypeVariables, instantiateSignature } from './instantiation.js';
33
33
  import { getContextualSignatureForFunctionLikeDeclaration, getInferenceContext, instantiateContextualType, } from './checker-contextual.js';
34
- import { checkJSDocFullSignature, checkUnmatchedJSDocParameters, getFullSignatureTypeNode } from './checker-jsdoc.js';
34
+ import { checkJSDocFullSignature, checkJSDocFullSignatureType, checkUnmatchedJSDocParameters, getFullSignatureTypeNode, } from './checker-jsdoc.js';
35
35
  import { getEffectiveCheckNode, isFunctionLike, nodeIsMissing } from './ast-utilities.js';
36
36
  import { getFlowTypeOfReferenceAt, isConstantReference, isReachableFlowNode, isSymbolAssigned, } from './checker-narrowing.js';
37
37
  import { FlowNode } from './flow.js';
@@ -40,9 +40,10 @@ import { typeToString } from './type-printer.js';
40
40
  import { checkGrammarAwaitExpression, checkGrammarFunctionExpression, checkGrammarYieldOfExpression, } from './checker-grammar.js';
41
41
  export function checkFunctionExpressionOrObjectLiteralMethod(c, node, checkMode) {
42
42
  checkNodeDeferred(c, node);
43
- if (node.kind === 219 /* SyntaxKind.FunctionExpression */)
43
+ checkJSDocFullSignatureType(c, node);
44
+ if (node.kind === 220 /* SyntaxKind.FunctionExpression */)
44
45
  checkCollisionsForDeclarationName(c, node, getName(node));
45
- if (node.kind === 178 /* SyntaxKind.GetAccessor */ || node.kind === 179 /* SyntaxKind.SetAccessor */)
46
+ if (node.kind === 179 /* SyntaxKind.GetAccessor */ || node.kind === 180 /* SyntaxKind.SetAccessor */)
46
47
  return c.anyType;
47
48
  if ((checkMode & 4 /* CheckMode.SkipContextSensitive */) !== 0 && isContextSensitive(c, node)) {
48
49
  // Skip parameters, but keep a return type with the non-contextual parts so that inferences can
@@ -64,7 +65,7 @@ export function checkFunctionExpressionOrObjectLiteralMethod(c, node, checkMode)
64
65
  }
65
66
  return c.anyFunctionType;
66
67
  }
67
- if (node.kind === 219 /* SyntaxKind.FunctionExpression */ || node.kind === 220 /* SyntaxKind.ArrowFunction */)
68
+ if (node.kind === 220 /* SyntaxKind.FunctionExpression */ || node.kind === 221 /* SyntaxKind.ArrowFunction */)
68
69
  checkGrammarFunctionExpression(c, node);
69
70
  checkJSDocFullSignature(c, node);
70
71
  contextuallyCheckFunctionExpressionOrObjectLiteralMethod(c, node, checkMode);
@@ -118,7 +119,8 @@ function contextuallyCheckFunctionExpressionOrObjectLiteralMethod(c, node, check
118
119
  if (contextualSignature !== undefined &&
119
120
  getType(node) === undefined &&
120
121
  resolvedReturnTypeOf(c, signature) === undefined) {
121
- const returnType = getReturnTypeFromBodyEx(c, node, checkMode);
122
+ // The resolved return type is cached, so it is computed without SkipContextSensitive to keep anyFunctionType out of it.
123
+ const returnType = getReturnTypeFromBodyEx(c, node, checkMode & ~4 /* CheckMode.SkipContextSensitive */);
122
124
  if (resolvedReturnTypeOf(c, signature) === undefined)
123
125
  signatureSideOf(c, signature).resolvedReturnType = returnType;
124
126
  }
@@ -190,7 +192,9 @@ function assignParameterSymbolType(c, parameter, contextualType) {
190
192
  return;
191
193
  const declaration = parameter.valueDeclaration;
192
194
  if (contextualType === undefined) {
193
- c.symbolTypes.set(id, getTypeOfSymbol(c, parameter));
195
+ c.symbolTypes.set(id, declaration !== undefined
196
+ ? getWidenedTypeForVariableLikeDeclaration(c, declaration, true)
197
+ : getTypeOfSymbol(c, parameter));
194
198
  return;
195
199
  }
196
200
  c.symbolTypes.set(id, addOptionality(c, contextualType, false, declaration !== undefined && getInitializer(declaration) === undefined && isOptionalDeclaration(declaration)));
@@ -200,10 +204,10 @@ function assignParameterSymbolType(c, parameter, contextualType) {
200
204
  // Without a better inference than `unknown`, a binding pattern implies the type.
201
205
  if (c.symbolTypes.get(id) === c.unknownType &&
202
206
  name !== undefined &&
203
- (name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 208 /* SyntaxKind.ArrayBindingPattern */))
207
+ (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 209 /* SyntaxKind.ArrayBindingPattern */))
204
208
  c.symbolTypes.set(id, getTypeFromBindingPattern(c, name, false, false));
205
209
  if (name !== undefined &&
206
- (name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 208 /* SyntaxKind.ArrayBindingPattern */))
210
+ (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 209 /* SyntaxKind.ArrayBindingPattern */))
207
211
  assignBindingElementTypes(c, name, c.symbolTypes.get(id));
208
212
  }
209
213
  export function getTypeOfObjectLiteralMethod(c, node, checkMode) {
@@ -245,23 +249,23 @@ export function checkFunctionLikeBody(c, node) {
245
249
  // Function and class method declarations without a body or return type return `any`.
246
250
  if (returnTypeNode === undefined &&
247
251
  nodeIsMissing(body) &&
248
- (node.kind === 263 /* SyntaxKind.FunctionDeclaration */ ||
249
- (node.kind === 175 /* SyntaxKind.MethodDeclaration */ && node.parent.kind !== 211 /* SyntaxKind.ObjectLiteralExpression */)) &&
252
+ (node.kind === 264 /* SyntaxKind.FunctionDeclaration */ ||
253
+ (node.kind === 176 /* SyntaxKind.MethodDeclaration */ && node.parent.kind !== 212 /* SyntaxKind.ObjectLiteralExpression */)) &&
250
254
  !isPrivateWithinAmbient(node))
251
255
  reportImplicitAny(c, node, c.anyType);
252
256
  if (body === undefined)
253
257
  return;
254
- const returnType = node.kind !== 177 /* SyntaxKind.Constructor */ ? getReturnTypeFromAnnotation(c, node) : undefined;
258
+ const returnType = node.kind !== 178 /* SyntaxKind.Constructor */ ? getReturnTypeFromAnnotation(c, node) : undefined;
255
259
  // Errors only found while inferring the return type (such as of yielded values) need it resolved.
256
260
  if (returnTypeNode === undefined &&
257
261
  (isFunctionExpressionOrArrowFunction(node) ||
258
262
  isObjectLiteralMethod(node) ||
259
- ((functionFlags & 1 /* FunctionFlags.Generator */) !== 0 && node.kind !== 177 /* SyntaxKind.Constructor */)))
263
+ ((functionFlags & 1 /* FunctionFlags.Generator */) !== 0 && node.kind !== 178 /* SyntaxKind.Constructor */)))
260
264
  getReturnTypeOfSignature(c, getSignatureFromDeclaration(c, node));
261
- if (body.kind === 242 /* SyntaxKind.Block */) {
265
+ if (body.kind === 243 /* SyntaxKind.Block */) {
262
266
  for (const s of getStatements(body).nodes)
263
267
  checkSourceElement(c, s);
264
- if (node.kind !== 177 /* SyntaxKind.Constructor */ && node.kind !== 179 /* SyntaxKind.SetAccessor */)
268
+ if (node.kind !== 178 /* SyntaxKind.Constructor */ && node.kind !== 180 /* SyntaxKind.SetAccessor */)
265
269
  checkAllCodePathsInNonVoidFunctionReturnOrThrow(c, node, returnType);
266
270
  }
267
271
  else {
@@ -276,7 +280,7 @@ function checkSignatureReturnType(c, node, returnTypeNode, functionFlags) {
276
280
  if ((functionFlags & (4 /* FunctionFlags.Invalid */ | 1 /* FunctionFlags.Generator */)) === 1 /* FunctionFlags.Generator */) {
277
281
  const returnType = getTypeFromTypeNode(c, returnTypeNode);
278
282
  if (returnType === c.voidType)
279
- c.error(returnTypeNode, 665 /* Diagnostics.A_generator_cannot_have_a_void_type_annotation */);
283
+ c.error(returnTypeNode, 672 /* Diagnostics.A_generator_cannot_have_a_void_type_annotation */);
280
284
  else
281
285
  checkGeneratorInstantiationAssignabilityToReturnType(c, returnType, functionFlags, returnTypeNode);
282
286
  }
@@ -304,20 +308,20 @@ function checkAllCodePathsInNonVoidFunctionReturnOrThrow(c, func, returnType) {
304
308
  return;
305
309
  // Signatures, expression bodies and bodies that end in a return or throw have nothing to check.
306
310
  const body = getBody(func);
307
- if (func.kind === 174 /* SyntaxKind.MethodSignature */ ||
311
+ if (func.kind === 175 /* SyntaxKind.MethodSignature */ ||
308
312
  body === undefined ||
309
313
  nodeIsMissing(body) ||
310
- body.kind !== 242 /* SyntaxKind.Block */ ||
314
+ body.kind !== 243 /* SyntaxKind.Block */ ||
311
315
  !functionHasImplicitReturn(c, func))
312
316
  return;
313
317
  const hasExplicitReturn = (func.flags & 512 /* NodeFlags.HasExplicitReturn */) !== 0;
314
318
  const errorNode = getType(func) ?? getFullSignatureTypeNode(func) ?? func;
315
319
  if (t !== undefined && (t.flags & 262144 /* TypeFlags.Never */) !== 0)
316
- c.error(errorNode, 692 /* Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point */);
320
+ c.error(errorNode, 699 /* Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point */);
317
321
  else if (t !== undefined && !hasExplicitReturn)
318
- c.error(errorNode, 531 /* Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value */);
322
+ c.error(errorNode, 538 /* Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value */);
319
323
  else if (t !== undefined && c.strictNullChecks && !isTypeAssignableTo(c, c.undefinedType, t))
320
- c.error(errorNode, 540 /* Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined */);
324
+ c.error(errorNode, 547 /* Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined */);
321
325
  else if (c.compilerOptions.noImplicitReturns === true) {
322
326
  if (t === undefined) {
323
327
  // Without an annotation, only functions that return values other than void or any are checked.
@@ -327,7 +331,7 @@ function checkAllCodePathsInNonVoidFunctionReturnOrThrow(c, func, returnType) {
327
331
  if (isUnwrappedReturnTypeUndefinedVoidOrAny(c, func, inferredReturnType))
328
332
  return;
329
333
  }
330
- c.error(errorNode, 1701 /* Diagnostics.Not_all_code_paths_return_a_value */);
334
+ c.error(errorNode, 1720 /* Diagnostics.Not_all_code_paths_return_a_value */);
331
335
  }
332
336
  }
333
337
  export function isUnwrappedReturnTypeUndefinedVoidOrAny(c, func, returnType) {
@@ -346,7 +350,7 @@ export function checkReturnExpression(c, container, unwrappedReturnType, node, e
346
350
  const functionFlags = getFunctionFlags(container);
347
351
  if (expr !== undefined) {
348
352
  const unwrappedExpr = skipParentheses(expr);
349
- if (unwrappedExpr.kind === 228 /* SyntaxKind.ConditionalExpression */) {
353
+ if (unwrappedExpr.kind === 229 /* SyntaxKind.ConditionalExpression */) {
350
354
  const conditional = unwrappedExpr;
351
355
  const whenTrue = conditional.whenTrue;
352
356
  const whenFalse = conditional.whenFalse;
@@ -355,7 +359,7 @@ export function checkReturnExpression(c, container, unwrappedReturnType, node, e
355
359
  return;
356
360
  }
357
361
  }
358
- const inReturnStatement = node.kind === 254 /* SyntaxKind.ReturnStatement */;
362
+ const inReturnStatement = node.kind === 255 /* SyntaxKind.ReturnStatement */;
359
363
  const unwrappedExprType = (functionFlags & 2 /* FunctionFlags.Async */) !== 0
360
364
  ? checkAwaitedType(c, exprType, false, node, 43 /* Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member */)
361
365
  : exprType;
@@ -369,13 +373,16 @@ export function checkAwaitExpression(c, node) {
369
373
  const operandType = checkExpression(c, getExpression(node));
370
374
  const awaitedType = checkAwaitedType(c, operandType, true, node, 256 /* Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member */);
371
375
  if (awaitedType === operandType && !isErrorType(c, awaitedType) && (operandType.flags & 3 /* TypeFlags.AnyOrUnknown */) === 0)
372
- c.addSuggestion(createDiagnosticForNode(node, 1884 /* Diagnostics.X_await_has_no_effect_on_the_type_of_this_expression */, []));
376
+ c.addSuggestion(createDiagnosticForNode(node, 1966 /* Diagnostics.X_await_has_no_effect_on_the_type_of_this_expression */, []));
373
377
  return awaitedType;
374
378
  }
375
379
  // ---- Generators
376
380
  export function checkYieldExpression(c, node) {
377
381
  checkGrammarYieldOfExpression(c, node);
378
382
  const yieldExpr = node;
383
+ // The operand is checked also outside a generator.
384
+ const operand = yieldExpr.expression;
385
+ const yieldExpressionType = operand !== undefined ? checkExpression(c, operand) : c.undefinedWideningType;
379
386
  const func = getContainingFunctionLike(node);
380
387
  if (func === undefined)
381
388
  return c.anyType;
@@ -394,8 +401,6 @@ export function checkYieldExpression(c, node) {
394
401
  const iterationTypes = returnType !== undefined ? getIterationTypesOfGeneratorFunctionReturnType(c, returnType, isAsync) : undefined;
395
402
  const signatureYieldType = iterationTypes?.yieldType ?? c.anyType;
396
403
  const signatureNextType = iterationTypes?.nextType ?? c.anyType;
397
- const operand = yieldExpr.expression;
398
- const yieldExpressionType = operand !== undefined ? checkExpression(c, operand) : c.undefinedWideningType;
399
404
  const yieldedType = getYieldedTypeOfYieldExpression(c, yieldExpr, yieldExpressionType, signatureNextType, isAsync);
400
405
  if (returnType !== undefined && yieldedType !== undefined)
401
406
  checkTypeAssignableToAndOptionallyElaborate(c, yieldedType, signatureYieldType, operand ?? node, operand);
@@ -409,7 +414,7 @@ export function checkYieldExpression(c, node) {
409
414
  if (c.noImplicitAny && !expressionResultIsUnused(node)) {
410
415
  const contextualType = getContextualType(c, node);
411
416
  if (contextualType === undefined || (contextualType.flags & 1 /* TypeFlags.Any */) !== 0)
412
- c.error(node, 1728 /* Diagnostics.X_yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation */);
417
+ c.error(node, 1747 /* Diagnostics.X_yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation */);
413
418
  }
414
419
  return c.anyType;
415
420
  }
@@ -433,16 +438,16 @@ function expressionResultIsUnused(nodeIn) {
433
438
  let node = nodeIn;
434
439
  for (;;) {
435
440
  const parent = node.parent;
436
- if (parent.kind === 218 /* SyntaxKind.ParenthesizedExpression */) {
441
+ if (parent.kind === 219 /* SyntaxKind.ParenthesizedExpression */) {
437
442
  node = parent;
438
443
  continue;
439
444
  }
440
- if (parent.kind === 245 /* SyntaxKind.ExpressionStatement */ ||
441
- parent.kind === 223 /* SyntaxKind.VoidExpression */ ||
442
- (parent.kind === 249 /* SyntaxKind.ForStatement */ &&
445
+ if (parent.kind === 246 /* SyntaxKind.ExpressionStatement */ ||
446
+ parent.kind === 224 /* SyntaxKind.VoidExpression */ ||
447
+ (parent.kind === 250 /* SyntaxKind.ForStatement */ &&
443
448
  (parent.initializer === node || parent.incrementor === node)))
444
449
  return true;
445
- if (parent.kind === 227 /* SyntaxKind.BinaryExpression */ &&
450
+ if (parent.kind === 228 /* SyntaxKind.BinaryExpression */ &&
446
451
  parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) {
447
452
  // The left side of a comma is unused; the right side is when the comma is.
448
453
  if (node === parent.left)
@@ -463,43 +468,43 @@ function getContainingFunctionLike(node) {
463
468
  /** Whether checking `node` depends on its contextual type. */
464
469
  export function isContextSensitive(c, node) {
465
470
  switch (node.kind) {
466
- case 219 /* SyntaxKind.FunctionExpression */:
467
- case 220 /* SyntaxKind.ArrowFunction */:
468
- case 175 /* SyntaxKind.MethodDeclaration */:
469
- case 263 /* SyntaxKind.FunctionDeclaration */:
471
+ case 220 /* SyntaxKind.FunctionExpression */:
472
+ case 221 /* SyntaxKind.ArrowFunction */:
473
+ case 176 /* SyntaxKind.MethodDeclaration */:
474
+ case 264 /* SyntaxKind.FunctionDeclaration */:
470
475
  return isContextSensitiveFunctionLikeDeclaration(c, node);
471
- case 211 /* SyntaxKind.ObjectLiteralExpression */:
476
+ case 212 /* SyntaxKind.ObjectLiteralExpression */:
472
477
  for (const p of getProperties(node).nodes)
473
478
  if (isContextSensitive(c, p))
474
479
  return true;
475
480
  return false;
476
- case 210 /* SyntaxKind.ArrayLiteralExpression */:
481
+ case 211 /* SyntaxKind.ArrayLiteralExpression */:
477
482
  for (const e of getElements(node).nodes)
478
483
  if (isContextSensitive(c, e))
479
484
  return true;
480
485
  return false;
481
- case 228 /* SyntaxKind.ConditionalExpression */: {
486
+ case 229 /* SyntaxKind.ConditionalExpression */: {
482
487
  const cond = node;
483
488
  return isContextSensitive(c, cond.whenTrue) || isContextSensitive(c, cond.whenFalse);
484
489
  }
485
- case 227 /* SyntaxKind.BinaryExpression */: {
490
+ case 228 /* SyntaxKind.BinaryExpression */: {
486
491
  const binary = node;
487
492
  const op = binary.operatorToken.kind;
488
493
  return ((op === 56 /* SyntaxKind.BarBarToken */ || op === 60 /* SyntaxKind.QuestionQuestionToken */) &&
489
494
  (isContextSensitive(c, binary.left) || isContextSensitive(c, binary.right)));
490
495
  }
491
- case 303 /* SyntaxKind.PropertyAssignment */:
496
+ case 304 /* SyntaxKind.PropertyAssignment */:
492
497
  return isContextSensitive(c, getInitializer(node));
493
- case 218 /* SyntaxKind.ParenthesizedExpression */:
498
+ case 219 /* SyntaxKind.ParenthesizedExpression */:
494
499
  return isContextSensitive(c, getExpression(node));
495
- case 293 /* SyntaxKind.JsxAttributes */:
500
+ case 294 /* SyntaxKind.JsxAttributes */:
496
501
  return isJsxAttributesContextSensitive(c, node);
497
- case 292 /* SyntaxKind.JsxAttribute */: {
502
+ case 293 /* SyntaxKind.JsxAttribute */: {
498
503
  // Without an initializer an attribute is `true`.
499
504
  const initializer = getInitializer(node);
500
505
  return initializer !== undefined && isContextSensitive(c, initializer);
501
506
  }
502
- case 295 /* SyntaxKind.JsxExpression */: {
507
+ case 296 /* SyntaxKind.JsxExpression */: {
503
508
  const expression = getExpression(node);
504
509
  return expression !== undefined && isContextSensitive(c, expression);
505
510
  }
@@ -518,16 +523,16 @@ function isContextSensitiveFunctionLikeDeclaration(c, node) {
518
523
  */
519
524
  export function getTypePredicateFromBody(c, fn) {
520
525
  switch (fn.kind) {
521
- case 177 /* SyntaxKind.Constructor */:
522
- case 178 /* SyntaxKind.GetAccessor */:
523
- case 179 /* SyntaxKind.SetAccessor */:
526
+ case 178 /* SyntaxKind.Constructor */:
527
+ case 179 /* SyntaxKind.GetAccessor */:
528
+ case 180 /* SyntaxKind.SetAccessor */:
524
529
  return undefined;
525
530
  }
526
531
  if (getFunctionFlags(fn) !== 0 /* FunctionFlags.Normal */)
527
532
  return undefined;
528
533
  const body = getBody(fn);
529
534
  let singleReturn = undefined;
530
- if (body !== undefined && body.kind !== 242 /* SyntaxKind.Block */)
535
+ if (body !== undefined && body.kind !== 243 /* SyntaxKind.Block */)
531
536
  singleReturn = body;
532
537
  else {
533
538
  if (body === undefined)
@@ -569,7 +574,7 @@ function checkIfExpressionRefinesAnyParameter(c, fn, exprIn) {
569
574
  }
570
575
  function checkIfExpressionRefinesParameter(c, fn, expr, name, initType) {
571
576
  let antecedent = getFlowNode(expr);
572
- if (antecedent === undefined && expr.parent.kind === 254 /* SyntaxKind.ReturnStatement */)
577
+ if (antecedent === undefined && expr.parent.kind === 255 /* SyntaxKind.ReturnStatement */)
573
578
  antecedent = getFlowNode(expr.parent);
574
579
  if (antecedent === undefined)
575
580
  antecedent = new FlowNode(2 /* FlowFlags.Start */, undefined, undefined);
@@ -588,7 +593,7 @@ function hasContextSensitiveReturnExpression(c, node) {
588
593
  const body = getBody(node);
589
594
  if (body === undefined)
590
595
  return false;
591
- if (body.kind !== 242 /* SyntaxKind.Block */)
596
+ if (body.kind !== 243 /* SyntaxKind.Block */)
592
597
  return isContextSensitive(c, body);
593
598
  const collector = new ReturnCollector();
594
599
  collector.visitStatements(body);
@@ -616,7 +621,7 @@ class YieldFinder extends NodeVisitor {
616
621
  this.c = c;
617
622
  }
618
623
  visitNode(node) {
619
- if (node.kind === 230 /* SyntaxKind.YieldExpression */) {
624
+ if (node.kind === 231 /* SyntaxKind.YieldExpression */) {
620
625
  const expression = getExpression(node);
621
626
  if (expression !== undefined && isContextSensitive(this.c, expression)) {
622
627
  this.found = true;
@@ -630,15 +635,15 @@ class YieldFinder extends NodeVisitor {
630
635
  }
631
636
  function isFunctionLikeOrClass(node) {
632
637
  switch (node.kind) {
633
- case 263 /* SyntaxKind.FunctionDeclaration */:
634
- case 219 /* SyntaxKind.FunctionExpression */:
635
- case 220 /* SyntaxKind.ArrowFunction */:
636
- case 175 /* SyntaxKind.MethodDeclaration */:
637
- case 178 /* SyntaxKind.GetAccessor */:
638
- case 179 /* SyntaxKind.SetAccessor */:
639
- case 177 /* SyntaxKind.Constructor */:
640
- case 264 /* SyntaxKind.ClassDeclaration */:
641
- case 232 /* SyntaxKind.ClassExpression */:
638
+ case 264 /* SyntaxKind.FunctionDeclaration */:
639
+ case 220 /* SyntaxKind.FunctionExpression */:
640
+ case 221 /* SyntaxKind.ArrowFunction */:
641
+ case 176 /* SyntaxKind.MethodDeclaration */:
642
+ case 179 /* SyntaxKind.GetAccessor */:
643
+ case 180 /* SyntaxKind.SetAccessor */:
644
+ case 178 /* SyntaxKind.Constructor */:
645
+ case 265 /* SyntaxKind.ClassDeclaration */:
646
+ case 233 /* SyntaxKind.ClassExpression */:
642
647
  return true;
643
648
  }
644
649
  return false;
@@ -663,7 +668,7 @@ export function getReturnTypeFromBodyEx(c, func, checkMode) {
663
668
  let yieldType;
664
669
  let nextType;
665
670
  let fallbackReturnType = c.voidType;
666
- if (body.kind !== 242 /* SyntaxKind.Block */) {
671
+ if (body.kind !== 243 /* SyntaxKind.Block */) {
667
672
  returnType = checkExpressionCachedEx(c, body, checkMode);
668
673
  if (isConstContext(c, body))
669
674
  returnType = getRegularTypeOfLiteralType(c, returnType);
@@ -793,7 +798,7 @@ function checkAndAggregateReturnExpressionTypes(c, func, checkMode) {
793
798
  }
794
799
  expr = skipParentheses(expr);
795
800
  // `return await` unwraps in async functions, and bare calls of the function itself don't contribute.
796
- if (isAsync && expr.kind === 224 /* SyntaxKind.AwaitExpression */)
801
+ if (isAsync && expr.kind === 225 /* SyntaxKind.AwaitExpression */)
797
802
  expr = skipParentheses(getExpression(expr));
798
803
  if (isRecursiveCall(c, func, expr)) {
799
804
  hasReturnOfTypeNever = true;
@@ -820,7 +825,7 @@ function checkAndAggregateReturnExpressionTypes(c, func, checkMode) {
820
825
  return aggregatedTypes;
821
826
  }
822
827
  function isRecursiveCall(c, func, expr) {
823
- if (expr.kind !== 214 /* SyntaxKind.CallExpression */)
828
+ if (expr.kind !== 215 /* SyntaxKind.CallExpression */)
824
829
  return false;
825
830
  const callee = getExpression(expr);
826
831
  if (callee.kind !== 79 /* SyntaxKind.Identifier */)
@@ -835,11 +840,11 @@ function isRecursiveCall(c, func, expr) {
835
840
  }
836
841
  function mayReturnNever(func) {
837
842
  switch (func.kind) {
838
- case 219 /* SyntaxKind.FunctionExpression */:
839
- case 220 /* SyntaxKind.ArrowFunction */:
843
+ case 220 /* SyntaxKind.FunctionExpression */:
844
+ case 221 /* SyntaxKind.ArrowFunction */:
840
845
  return true;
841
- case 175 /* SyntaxKind.MethodDeclaration */:
842
- return func.parent.kind === 211 /* SyntaxKind.ObjectLiteralExpression */;
846
+ case 176 /* SyntaxKind.MethodDeclaration */:
847
+ return func.parent.kind === 212 /* SyntaxKind.ObjectLiteralExpression */;
843
848
  }
844
849
  return false;
845
850
  }
@@ -876,23 +881,23 @@ class YieldCollector extends NodeVisitor {
876
881
  yields = [];
877
882
  visit(node) {
878
883
  switch (node.kind) {
879
- case 230 /* SyntaxKind.YieldExpression */: {
884
+ case 231 /* SyntaxKind.YieldExpression */: {
880
885
  this.yields.push(node);
881
886
  const operand = node.expression;
882
887
  if (operand !== undefined)
883
888
  this.visit(operand);
884
889
  return;
885
890
  }
886
- case 267 /* SyntaxKind.EnumDeclaration */:
887
- case 265 /* SyntaxKind.InterfaceDeclaration */:
888
- case 268 /* SyntaxKind.ModuleDeclaration */:
889
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
891
+ case 268 /* SyntaxKind.EnumDeclaration */:
892
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
893
+ case 269 /* SyntaxKind.ModuleDeclaration */:
894
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
890
895
  return;
891
896
  }
892
897
  if (isFunctionLike(node)) {
893
898
  // Nested functions are skipped, but not their computed names.
894
899
  const name = getName(node);
895
- if (name !== undefined && name.kind === 168 /* SyntaxKind.ComputedPropertyName */)
900
+ if (name !== undefined && name.kind === 169 /* SyntaxKind.ComputedPropertyName */)
896
901
  this.visit(getExpression(name));
897
902
  return;
898
903
  }
@@ -913,22 +918,22 @@ export class ReturnCollector {
913
918
  }
914
919
  visit(node) {
915
920
  switch (node.kind) {
916
- case 254 /* SyntaxKind.ReturnStatement */:
921
+ case 255 /* SyntaxKind.ReturnStatement */:
917
922
  this.returns.push(node);
918
923
  return;
919
- case 263 /* SyntaxKind.FunctionDeclaration */:
920
- case 219 /* SyntaxKind.FunctionExpression */:
921
- case 220 /* SyntaxKind.ArrowFunction */:
922
- case 264 /* SyntaxKind.ClassDeclaration */:
923
- case 232 /* SyntaxKind.ClassExpression */:
924
- case 175 /* SyntaxKind.MethodDeclaration */:
925
- case 178 /* SyntaxKind.GetAccessor */:
926
- case 179 /* SyntaxKind.SetAccessor */:
927
- case 177 /* SyntaxKind.Constructor */:
928
- case 265 /* SyntaxKind.InterfaceDeclaration */:
929
- case 266 /* SyntaxKind.TypeAliasDeclaration */:
930
- case 267 /* SyntaxKind.EnumDeclaration */:
931
- case 268 /* SyntaxKind.ModuleDeclaration */:
924
+ case 264 /* SyntaxKind.FunctionDeclaration */:
925
+ case 220 /* SyntaxKind.FunctionExpression */:
926
+ case 221 /* SyntaxKind.ArrowFunction */:
927
+ case 265 /* SyntaxKind.ClassDeclaration */:
928
+ case 233 /* SyntaxKind.ClassExpression */:
929
+ case 176 /* SyntaxKind.MethodDeclaration */:
930
+ case 179 /* SyntaxKind.GetAccessor */:
931
+ case 180 /* SyntaxKind.SetAccessor */:
932
+ case 178 /* SyntaxKind.Constructor */:
933
+ case 266 /* SyntaxKind.InterfaceDeclaration */:
934
+ case 267 /* SyntaxKind.TypeAliasDeclaration */:
935
+ case 268 /* SyntaxKind.EnumDeclaration */:
936
+ case 269 /* SyntaxKind.ModuleDeclaration */:
932
937
  return;
933
938
  }
934
939
  if (isStatementContainer(node))
@@ -937,21 +942,21 @@ export class ReturnCollector {
937
942
  }
938
943
  function isStatementContainer(node) {
939
944
  switch (node.kind) {
940
- case 242 /* SyntaxKind.Block */:
941
- case 246 /* SyntaxKind.IfStatement */:
942
- case 247 /* SyntaxKind.DoStatement */:
943
- case 248 /* SyntaxKind.WhileStatement */:
944
- case 249 /* SyntaxKind.ForStatement */:
945
- case 250 /* SyntaxKind.ForInStatement */:
946
- case 251 /* SyntaxKind.ForOfStatement */:
947
- case 255 /* SyntaxKind.WithStatement */:
948
- case 256 /* SyntaxKind.SwitchStatement */:
949
- case 270 /* SyntaxKind.CaseBlock */:
950
- case 297 /* SyntaxKind.CaseClause */:
951
- case 298 /* SyntaxKind.DefaultClause */:
952
- case 257 /* SyntaxKind.LabeledStatement */:
953
- case 259 /* SyntaxKind.TryStatement */:
954
- case 300 /* SyntaxKind.CatchClause */:
945
+ case 243 /* SyntaxKind.Block */:
946
+ case 247 /* SyntaxKind.IfStatement */:
947
+ case 248 /* SyntaxKind.DoStatement */:
948
+ case 249 /* SyntaxKind.WhileStatement */:
949
+ case 250 /* SyntaxKind.ForStatement */:
950
+ case 251 /* SyntaxKind.ForInStatement */:
951
+ case 252 /* SyntaxKind.ForOfStatement */:
952
+ case 256 /* SyntaxKind.WithStatement */:
953
+ case 257 /* SyntaxKind.SwitchStatement */:
954
+ case 271 /* SyntaxKind.CaseBlock */:
955
+ case 298 /* SyntaxKind.CaseClause */:
956
+ case 299 /* SyntaxKind.DefaultClause */:
957
+ case 258 /* SyntaxKind.LabeledStatement */:
958
+ case 260 /* SyntaxKind.TryStatement */:
959
+ case 301 /* SyntaxKind.CatchClause */:
955
960
  return true;
956
961
  }
957
962
  return false;
@@ -974,11 +979,12 @@ function assignParameterType(c, declaration) {
974
979
  const id = getSymbolId(symbol);
975
980
  if (c.symbolTypes.get(id) !== undefined)
976
981
  return;
977
- const t = getTypeOfSymbol(c, symbol);
982
+ // Without a context, the parameter's own type, reporting its implicit any errors.
983
+ const t = getWidenedTypeForVariableLikeDeclaration(c, declaration, true);
978
984
  c.symbolTypes.set(id, addOptionality(c, t, false, getInitializer(declaration) === undefined && isOptionalDeclaration(declaration)));
979
985
  const name = getName(declaration);
980
986
  if (name !== undefined &&
981
- (name.kind === 207 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 208 /* SyntaxKind.ArrayBindingPattern */)) {
987
+ (name.kind === 208 /* SyntaxKind.ObjectBindingPattern */ || name.kind === 209 /* SyntaxKind.ArrayBindingPattern */)) {
982
988
  // Without a better inference than `unknown`, a binding pattern implies the type.
983
989
  if (c.symbolTypes.get(id) === c.unknownType)
984
990
  c.symbolTypes.set(id, getTypeFromBindingPattern(c, name, false, false));
@@ -988,7 +994,7 @@ function assignParameterType(c, declaration) {
988
994
  /** Pushes a contextually assigned parameter type into the binding elements of its pattern. */
989
995
  function assignBindingElementTypes(c, pattern, parentType) {
990
996
  for (const element of getElements(pattern).nodes) {
991
- if (element.kind !== 209 /* SyntaxKind.BindingElement */)
997
+ if (element.kind !== 210 /* SyntaxKind.BindingElement */)
992
998
  continue;
993
999
  const name = getName(element);
994
1000
  if (name === undefined)
@@ -1,15 +1,6 @@
1
1
  import { type Node } from './ast.js';
2
2
  import type { Checker } from './checker.js';
3
3
  import { type Diagnostic, type DiagnosticMessage } from './diagnostics.js';
4
- /** A collision check that waits until the file is checked, when the flags it reads are complete. */
5
- export declare class DeferredCollisionCheck {
6
- readonly node: Node;
7
- /** `Reflect` rather than `WeakMap` and `WeakSet`. */
8
- readonly reflect: boolean;
9
- constructor(node: Node,
10
- /** `Reflect` rather than `WeakMap` and `WeakSet`. */
11
- reflect: boolean);
12
- }
13
4
  /** An error that is not reported under noEmit, since it is about the emitted code. */
14
5
  export declare function errorSkippedOnNoEmit(c: Checker, node: Node, message: DiagnosticMessage, ...args: string[]): Diagnostic;
15
6
  /** Checks the name of a declaration against the names the emitted code reserves. */
@@ -21,5 +12,3 @@ export declare function checkCollisionsForDeclarationName(c: Checker, node: Node
21
12
  export declare function markPrivateIdentifierScope(c: Checker, node: Node): void;
22
13
  /** `super.x` in a static initializer before ES2022 is emitted with `Reflect`: marks the block scopes around it. */
23
14
  export declare function markSuperPropertyInStaticInitializer(c: Checker, node: Node): void;
24
- /** Reports the `WeakMap`, `WeakSet` and `Reflect` collisions found while checking the file. */
25
- export declare function produceDeferredCollisionChecks(c: Checker): void;