@typescript-deploys/pr-build 5.9.0-pr-62111-2 → 6.0.0-pr-62243-2

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.
package/lib/_tsc.js CHANGED
@@ -17,8 +17,8 @@ and limitations under the License.
17
17
  "use strict";
18
18
 
19
19
  // src/compiler/corePublic.ts
20
- var versionMajorMinor = "5.9";
21
- var version = `${versionMajorMinor}.0-insiders.20250723`;
20
+ var versionMajorMinor = "6.0";
21
+ var version = `${versionMajorMinor}.0-insiders.20250809`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6014,15 +6014,16 @@ var Diagnostics = {
6014
6014
  An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1283, 1 /* Error */, "An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolve_1283", "An 'export =' declaration must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
6015
6015
  An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type: diag(1284, 1 /* Error */, "An_export_default_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_1284", "An 'export default' must reference a value when 'verbatimModuleSyntax' is enabled, but '{0}' only refers to a type."),
6016
6016
  An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration: diag(1285, 1 /* Error */, "An_export_default_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_1285", "An 'export default' must reference a real value when 'verbatimModuleSyntax' is enabled, but '{0}' resolves to a type-only declaration."),
6017
- ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1286, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled_1286", "ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
6017
+ ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax: diag(1286, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_1286", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'."),
6018
6018
  A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled: diag(1287, 1 /* Error */, "A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimM_1287", "A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled."),
6019
6019
  An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled: diag(1288, 1 /* Error */, "An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabl_1288", "An import alias cannot resolve to a type or type-only declaration when 'verbatimModuleSyntax' is enabled."),
6020
6020
  _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1289, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1289", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
6021
6021
  _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
6022
6022
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
6023
6023
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
6024
- ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
6024
+ ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ECMAScript module syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
6025
6025
  This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
6026
+ ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript: diag(1295, 1 /* Error */, "ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjus_1295", "ECMAScript imports and exports cannot be written in a CommonJS file under 'verbatimModuleSyntax'. Adjust the 'type' field in the nearest 'package.json' to make this file an ECMAScript module, or adjust your 'verbatimModuleSyntax', 'module', and 'moduleResolution' settings in TypeScript."),
6026
6027
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
6027
6028
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
6028
6029
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -14264,12 +14265,15 @@ function forEachYieldExpression(body, visitor) {
14264
14265
  function traverse(node) {
14265
14266
  switch (node.kind) {
14266
14267
  case 230 /* YieldExpression */:
14267
- visitor(node);
14268
+ const value = visitor(node);
14269
+ if (value) {
14270
+ return value;
14271
+ }
14268
14272
  const operand = node.expression;
14269
- if (operand) {
14270
- traverse(operand);
14273
+ if (!operand) {
14274
+ return;
14271
14275
  }
14272
- return;
14276
+ return traverse(operand);
14273
14277
  case 267 /* EnumDeclaration */:
14274
14278
  case 265 /* InterfaceDeclaration */:
14275
14279
  case 268 /* ModuleDeclaration */:
@@ -14278,11 +14282,10 @@ function forEachYieldExpression(body, visitor) {
14278
14282
  default:
14279
14283
  if (isFunctionLike(node)) {
14280
14284
  if (node.name && node.name.kind === 168 /* ComputedPropertyName */) {
14281
- traverse(node.name.expression);
14282
- return;
14285
+ return traverse(node.name.expression);
14283
14286
  }
14284
14287
  } else if (!isPartOfTypeNode(node)) {
14285
- forEachChild(node, traverse);
14288
+ return forEachChild(node, traverse);
14286
14289
  }
14287
14290
  }
14288
14291
  }
@@ -15849,6 +15852,9 @@ function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) {
15849
15852
  function isKnownSymbol(symbol) {
15850
15853
  return startsWith(symbol.escapedName, "__@");
15851
15854
  }
15855
+ function isPrivateIdentifierSymbol(symbol) {
15856
+ return startsWith(symbol.escapedName, "__#");
15857
+ }
15852
15858
  function isProtoSetter(node) {
15853
15859
  return isIdentifier(node) ? idText(node) === "__proto__" : isStringLiteral(node) && node.text === "__proto__";
15854
15860
  }
@@ -19129,7 +19135,7 @@ function hasContextSensitiveParameters(node) {
19129
19135
  if (node.kind !== 220 /* ArrowFunction */) {
19130
19136
  const parameter = firstOrUndefined(node.parameters);
19131
19137
  if (!(parameter && parameterIsThisKeyword(parameter))) {
19132
- return true;
19138
+ return !!(node.flags & 256 /* ContainsThis */);
19133
19139
  }
19134
19140
  }
19135
19141
  }
@@ -42643,6 +42649,7 @@ function createBinder() {
42643
42649
  const saveExceptionTarget = currentExceptionTarget;
42644
42650
  const saveActiveLabelList = activeLabelList;
42645
42651
  const saveHasExplicitReturn = hasExplicitReturn;
42652
+ const saveSeenThisKeyword = seenThisKeyword;
42646
42653
  const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 176 /* ClassStaticBlockDeclaration */;
42647
42654
  if (!isImmediatelyInvoked) {
42648
42655
  currentFlow = createFlowNode(
@@ -42662,13 +42669,17 @@ function createBinder() {
42662
42669
  currentContinueTarget = void 0;
42663
42670
  activeLabelList = void 0;
42664
42671
  hasExplicitReturn = false;
42672
+ seenThisKeyword = false;
42665
42673
  bindChildren(node);
42666
- node.flags &= ~5632 /* ReachabilityAndEmitFlags */;
42674
+ node.flags &= ~(5632 /* ReachabilityAndEmitFlags */ | 256 /* ContainsThis */);
42667
42675
  if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && nodeIsPresent(node.body)) {
42668
42676
  node.flags |= 512 /* HasImplicitReturn */;
42669
42677
  if (hasExplicitReturn) node.flags |= 1024 /* HasExplicitReturn */;
42670
42678
  node.endFlowNode = currentFlow;
42671
42679
  }
42680
+ if (seenThisKeyword) {
42681
+ node.flags |= 256 /* ContainsThis */;
42682
+ }
42672
42683
  if (node.kind === 308 /* SourceFile */) {
42673
42684
  node.flags |= emitFlags;
42674
42685
  node.endFlowNode = currentFlow;
@@ -42689,11 +42700,14 @@ function createBinder() {
42689
42700
  currentExceptionTarget = saveExceptionTarget;
42690
42701
  activeLabelList = saveActiveLabelList;
42691
42702
  hasExplicitReturn = saveHasExplicitReturn;
42703
+ seenThisKeyword = node.kind === 220 /* ArrowFunction */ ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
42692
42704
  } else if (containerFlags & 64 /* IsInterface */) {
42705
+ const saveSeenThisKeyword = seenThisKeyword;
42693
42706
  seenThisKeyword = false;
42694
42707
  bindChildren(node);
42695
42708
  Debug.assertNotNode(node, isIdentifier);
42696
42709
  node.flags = seenThisKeyword ? node.flags | 256 /* ContainsThis */ : node.flags & ~256 /* ContainsThis */;
42710
+ seenThisKeyword = saveSeenThisKeyword;
42697
42711
  } else {
42698
42712
  bindChildren(node);
42699
42713
  }
@@ -44181,6 +44195,9 @@ function createBinder() {
44181
44195
  }
44182
44196
  // falls through
44183
44197
  case 110 /* ThisKeyword */:
44198
+ if (node.kind === 110 /* ThisKeyword */) {
44199
+ seenThisKeyword = true;
44200
+ }
44184
44201
  if (currentFlow && (isExpression(node) || parent.kind === 305 /* ShorthandPropertyAssignment */)) {
44185
44202
  node.flowNode = currentFlow;
44186
44203
  }
@@ -45103,6 +45120,8 @@ function getContainerFlags(node) {
45103
45120
  // falls through
45104
45121
  case 177 /* Constructor */:
45105
45122
  case 263 /* FunctionDeclaration */:
45123
+ case 176 /* ClassStaticBlockDeclaration */:
45124
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45106
45125
  case 174 /* MethodSignature */:
45107
45126
  case 180 /* CallSignature */:
45108
45127
  case 324 /* JSDocSignature */:
@@ -45110,17 +45129,14 @@ function getContainerFlags(node) {
45110
45129
  case 185 /* FunctionType */:
45111
45130
  case 181 /* ConstructSignature */:
45112
45131
  case 186 /* ConstructorType */:
45113
- case 176 /* ClassStaticBlockDeclaration */:
45114
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45132
+ return 1 /* IsContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
45115
45133
  case 352 /* JSDocImportTag */:
45116
- return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
45134
+ return 1 /* IsContainer */ | 32 /* HasLocals */;
45117
45135
  case 219 /* FunctionExpression */:
45118
45136
  case 220 /* ArrowFunction */:
45119
45137
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
45120
45138
  case 269 /* ModuleBlock */:
45121
45139
  return 4 /* IsControlFlowContainer */;
45122
- case 173 /* PropertyDeclaration */:
45123
- return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
45124
45140
  case 300 /* CatchClause */:
45125
45141
  case 249 /* ForStatement */:
45126
45142
  case 250 /* ForInStatement */:
@@ -47515,6 +47531,15 @@ function createTypeChecker(host) {
47515
47531
  diagnostics.add(diagnostic);
47516
47532
  return diagnostic;
47517
47533
  }
47534
+ function getVerbatimModuleSyntaxErrorMessage(node) {
47535
+ const sourceFile = getSourceFileOfNode(node);
47536
+ const fileName = sourceFile.fileName;
47537
+ if (fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */])) {
47538
+ return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax;
47539
+ } else {
47540
+ return Diagnostics.ECMAScript_imports_and_exports_cannot_be_written_in_a_CommonJS_file_under_verbatimModuleSyntax_Adjust_the_type_field_in_the_nearest_package_json_to_make_this_file_an_ECMAScript_module_or_adjust_your_verbatimModuleSyntax_module_and_moduleResolution_settings_in_TypeScript;
47541
+ }
47542
+ }
47518
47543
  function addErrorOrSuggestion(isError, diagnostic) {
47519
47544
  if (isError) {
47520
47545
  diagnostics.add(diagnostic);
@@ -52058,6 +52083,9 @@ function createTypeChecker(host) {
52058
52083
  if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 /* Private */ | 4 /* Protected */) && context.tracker.reportPrivateInBaseOfClassExpression) {
52059
52084
  context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName));
52060
52085
  }
52086
+ if (isPrivateIdentifierSymbol(propertySymbol) && context.tracker.reportPrivateInBaseOfClassExpression) {
52087
+ context.tracker.reportPrivateInBaseOfClassExpression(idText(propertySymbol.valueDeclaration.name));
52088
+ }
52061
52089
  }
52062
52090
  if (checkTruncationLength(context) && i + 2 < properties.length - 1) {
52063
52091
  context.out.truncated = true;
@@ -63722,7 +63750,8 @@ function createTypeChecker(host) {
63722
63750
  const { initializer } = node;
63723
63751
  return !!initializer && isContextSensitive(initializer);
63724
63752
  }
63725
- case 295 /* JsxExpression */: {
63753
+ case 295 /* JsxExpression */:
63754
+ case 230 /* YieldExpression */: {
63726
63755
  const { expression } = node;
63727
63756
  return !!expression && isContextSensitive(expression);
63728
63757
  }
@@ -63730,7 +63759,7 @@ function createTypeChecker(host) {
63730
63759
  return false;
63731
63760
  }
63732
63761
  function isContextSensitiveFunctionLikeDeclaration(node) {
63733
- return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
63762
+ return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node) || !!(getFunctionFlags(node) & 1 /* Generator */ && node.body && forEachYieldExpression(node.body, isContextSensitive));
63734
63763
  }
63735
63764
  function hasContextSensitiveReturnExpression(node) {
63736
63765
  if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) {
@@ -85883,9 +85912,9 @@ function createTypeChecker(host) {
85883
85912
  }
85884
85913
  }
85885
85914
  if (compilerOptions.verbatimModuleSyntax && node.kind !== 272 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
85886
- error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
85915
+ error(node, getVerbatimModuleSyntaxErrorMessage(node));
85887
85916
  } else if (moduleKind === 200 /* Preserve */ && node.kind !== 272 /* ImportEqualsDeclaration */ && node.kind !== 261 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
85888
- error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
85917
+ error(node, Diagnostics.ECMAScript_module_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
85889
85918
  }
85890
85919
  if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
85891
85920
  const constEnumDeclaration = target.valueDeclaration;
@@ -86244,7 +86273,7 @@ function createTypeChecker(host) {
86244
86273
  checkExpressionCached(node.expression);
86245
86274
  }
86246
86275
  if (isIllegalExportDefaultInCJS) {
86247
- error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
86276
+ error(node, getVerbatimModuleSyntaxErrorMessage(node));
86248
86277
  }
86249
86278
  checkExternalModuleExports(container);
86250
86279
  if (node.flags & 33554432 /* Ambient */ && !isEntityNameExpression(node.expression)) {
@@ -90112,7 +90141,7 @@ function createTypeChecker(host) {
90112
90141
  }
90113
90142
  function checkGrammarImportCallExpression(node) {
90114
90143
  if (compilerOptions.verbatimModuleSyntax && moduleKind === 1 /* CommonJS */) {
90115
- return grammarErrorOnNode(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
90144
+ return grammarErrorOnNode(node, getVerbatimModuleSyntaxErrorMessage(node));
90116
90145
  }
90117
90146
  if (node.expression.kind === 237 /* MetaProperty */) {
90118
90147
  if (moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {