@typescript-deploys/pr-build 4.8.0-pr-49481-2 → 4.8.0-pr-49481-8

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
@@ -2239,7 +2239,7 @@ var ts;
2239
2239
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2240
2240
  }
2241
2241
  if (isFlags) {
2242
- var result = "";
2242
+ var result = [];
2243
2243
  var remainingFlags = value;
2244
2244
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2245
2245
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2247,12 +2247,12 @@ var ts;
2247
2247
  break;
2248
2248
  }
2249
2249
  if (enumValue !== 0 && enumValue & value) {
2250
- result = "" + result + (result ? "|" : "") + enumName;
2250
+ result.push(enumName);
2251
2251
  remainingFlags &= ~enumValue;
2252
2252
  }
2253
2253
  }
2254
2254
  if (remainingFlags === 0) {
2255
- return result;
2255
+ return result.join("|");
2256
2256
  }
2257
2257
  }
2258
2258
  else {
@@ -2266,7 +2266,12 @@ var ts;
2266
2266
  return value.toString();
2267
2267
  }
2268
2268
  Debug.formatEnum = formatEnum;
2269
+ var enumMemberCache = new ts.Map();
2269
2270
  function getEnumMembers(enumObject) {
2271
+ var existing = enumMemberCache.get(enumObject);
2272
+ if (existing) {
2273
+ return existing;
2274
+ }
2270
2275
  var result = [];
2271
2276
  for (var name in enumObject) {
2272
2277
  var value = enumObject[name];
@@ -2274,7 +2279,9 @@ var ts;
2274
2279
  result.push([value, name]);
2275
2280
  }
2276
2281
  }
2277
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2282
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2283
+ enumMemberCache.set(enumObject, sorted);
2284
+ return sorted;
2278
2285
  }
2279
2286
  function formatSyntaxKind(kind) {
2280
2287
  return formatEnum(kind, ts.SyntaxKind, false);
@@ -5639,6 +5646,7 @@ var ts;
5639
5646
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
5640
5647
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
5641
5648
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
5649
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
5642
5650
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
5643
5651
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
5644
5652
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -37014,7 +37022,7 @@ var ts;
37014
37022
  case 317:
37015
37023
  return (ts.isJSDocConstructSignature(node) ? "__new" : "__call");
37016
37024
  case 164:
37017
- ts.Debug.assert(node.parent.kind === 317, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
37025
+ ts.Debug.assert(node.parent.kind === 317, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
37018
37026
  var functionType = node.parent;
37019
37027
  var index = functionType.parameters.indexOf(node);
37020
37028
  return "arg" + index;
@@ -54597,8 +54605,12 @@ var ts;
54597
54605
  }
54598
54606
  reportRelationError(headMessage, source, target);
54599
54607
  if (source.flags & 262144 && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
54600
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
54601
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
54608
+ var syntheticParam = cloneTypeParameter(source);
54609
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
54610
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
54611
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
54612
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
54613
+ }
54602
54614
  }
54603
54615
  }
54604
54616
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -89008,7 +89020,7 @@ var ts;
89008
89020
  return getTypeAliasDeclarationVisibilityError;
89009
89021
  }
89010
89022
  else {
89011
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
89023
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
89012
89024
  }
89013
89025
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
89014
89026
  if (node.kind === 254 || node.kind === 203) {
@@ -89205,7 +89217,7 @@ var ts;
89205
89217
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
89206
89218
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
89207
89219
  default:
89208
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
89220
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
89209
89221
  }
89210
89222
  }
89211
89223
  function getTypeParameterConstraintVisibilityError() {
@@ -89909,7 +89921,7 @@ var ts;
89909
89921
  while (ts.length(lateMarkedStatements)) {
89910
89922
  var i = lateMarkedStatements.shift();
89911
89923
  if (!ts.isLateVisibilityPaintedStatement(i)) {
89912
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
89924
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
89913
89925
  }
89914
89926
  var priorNeedsDeclare = needsDeclare;
89915
89927
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -90074,7 +90086,7 @@ var ts;
90074
90086
  return cleanup(input);
90075
90087
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
90076
90088
  }
90077
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
90089
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
90078
90090
  }
90079
90091
  }
90080
90092
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -90361,7 +90373,7 @@ var ts;
90361
90373
  }))));
90362
90374
  }
90363
90375
  }
90364
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
90376
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
90365
90377
  function cleanup(node) {
90366
90378
  if (isEnclosingDeclaration(input)) {
90367
90379
  enclosingDeclaration = previousEnclosingDeclaration;
package/lib/tsserver.js CHANGED
@@ -2657,7 +2657,7 @@ var ts;
2657
2657
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2658
2658
  }
2659
2659
  if (isFlags) {
2660
- var result = "";
2660
+ var result = [];
2661
2661
  var remainingFlags = value;
2662
2662
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2663
2663
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2665,12 +2665,12 @@ var ts;
2665
2665
  break;
2666
2666
  }
2667
2667
  if (enumValue !== 0 && enumValue & value) {
2668
- result = "" + result + (result ? "|" : "") + enumName;
2668
+ result.push(enumName);
2669
2669
  remainingFlags &= ~enumValue;
2670
2670
  }
2671
2671
  }
2672
2672
  if (remainingFlags === 0) {
2673
- return result;
2673
+ return result.join("|");
2674
2674
  }
2675
2675
  }
2676
2676
  else {
@@ -2684,7 +2684,15 @@ var ts;
2684
2684
  return value.toString();
2685
2685
  }
2686
2686
  Debug.formatEnum = formatEnum;
2687
+ var enumMemberCache = new ts.Map();
2687
2688
  function getEnumMembers(enumObject) {
2689
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2690
+ // to reuse later. This saves us from reconstructing this each and every time we call
2691
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2692
+ var existing = enumMemberCache.get(enumObject);
2693
+ if (existing) {
2694
+ return existing;
2695
+ }
2688
2696
  var result = [];
2689
2697
  for (var name in enumObject) {
2690
2698
  var value = enumObject[name];
@@ -2692,7 +2700,9 @@ var ts;
2692
2700
  result.push([value, name]);
2693
2701
  }
2694
2702
  }
2695
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2703
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2704
+ enumMemberCache.set(enumObject, sorted);
2705
+ return sorted;
2696
2706
  }
2697
2707
  function formatSyntaxKind(kind) {
2698
2708
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4331,6 +4341,7 @@ var ts;
4331
4341
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4332
4342
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4333
4343
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4344
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4334
4345
  /** @deprecated Use SyntaxKind.JSDoc */
4335
4346
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4336
4347
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4405,7 +4416,6 @@ var ts;
4405
4416
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4406
4417
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4407
4418
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4408
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4409
4419
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4410
4420
  var NodeFlags;
4411
4421
  (function (NodeFlags) {
@@ -8468,6 +8478,7 @@ var ts;
8468
8478
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8469
8479
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8470
8480
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8481
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8471
8482
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8472
8483
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8473
8484
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -45196,7 +45207,7 @@ var ts;
45196
45207
  case 164 /* Parameter */:
45197
45208
  // Parameters with names are handled at the top of this function. Parameters
45198
45209
  // without names can only come from JSDocFunctionTypes.
45199
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45210
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45200
45211
  var functionType = node.parent;
45201
45212
  var index = functionType.parameters.indexOf(node);
45202
45213
  return "arg" + index;
@@ -65473,8 +65484,12 @@ var ts;
65473
65484
  }
65474
65485
  reportRelationError(headMessage, source, target);
65475
65486
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65476
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65477
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65487
+ var syntheticParam = cloneTypeParameter(source);
65488
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65489
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65490
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65491
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65492
+ }
65478
65493
  }
65479
65494
  }
65480
65495
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -108457,7 +108472,7 @@ var ts;
108457
108472
  return getTypeAliasDeclarationVisibilityError;
108458
108473
  }
108459
108474
  else {
108460
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108475
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108461
108476
  }
108462
108477
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108463
108478
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108668,7 +108683,7 @@ var ts;
108668
108683
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108669
108684
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108670
108685
  default:
108671
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108686
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108672
108687
  }
108673
108688
  }
108674
108689
  function getTypeParameterConstraintVisibilityError() {
@@ -109434,7 +109449,7 @@ var ts;
109434
109449
  while (ts.length(lateMarkedStatements)) {
109435
109450
  var i = lateMarkedStatements.shift();
109436
109451
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109437
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109452
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109438
109453
  }
109439
109454
  var priorNeedsDeclare = needsDeclare;
109440
109455
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109617,7 +109632,7 @@ var ts;
109617
109632
  return cleanup(input);
109618
109633
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109619
109634
  }
109620
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109635
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109621
109636
  }
109622
109637
  }
109623
109638
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -109939,7 +109954,7 @@ var ts;
109939
109954
  }
109940
109955
  }
109941
109956
  // Anything left unhandled is an error, so this should be unreachable
109942
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
109957
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
109943
109958
  function cleanup(node) {
109944
109959
  if (isEnclosingDeclaration(input)) {
109945
109960
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150068,7 +150083,7 @@ var ts;
150068
150083
  return {
150069
150084
  indentation: indentation,
150070
150085
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150071
- suffix: insertTrailingComma ? "," : ""
150086
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150072
150087
  };
150073
150088
  };
150074
150089
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -154770,6 +154785,7 @@ var ts;
154770
154785
  ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
154771
154786
  ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
154772
154787
  ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
154788
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
154773
154789
  ];
154774
154790
  codefix.registerCodeFix({
154775
154791
  errorCodes: errorCodes,
@@ -154780,7 +154796,7 @@ var ts;
154780
154796
  return;
154781
154797
  }
154782
154798
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
154783
- return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
154799
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
154784
154800
  },
154785
154801
  fixIds: [fixId],
154786
154802
  getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
@@ -154791,13 +154807,10 @@ var ts;
154791
154807
  }); },
154792
154808
  });
154793
154809
  function getDiagnosticRelatedInfo(program, sourceFile, span) {
154794
- var diags = program.getSemanticDiagnostics(sourceFile).filter(function (diag) { return diag.start === span.start && diag.length === span.length; });
154795
- if (!ts.length(diags))
154796
- return;
154797
- var diag = diags[0];
154798
- if (!diag.relatedInformation)
154810
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
154811
+ if (!diag || !diag.relatedInformation)
154799
154812
  return;
154800
- var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
154813
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
154801
154814
  if (!related)
154802
154815
  return;
154803
154816
  return related;
@@ -158739,7 +158752,7 @@ var ts;
158739
158752
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
158740
158753
  case 168 /* MethodSignature */:
158741
158754
  return ts.factory.createMethodSignature(modifiers, name,
158742
- /*questionToken*/ undefined, typeParameters, parameters, type);
158755
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
158743
158756
  case 256 /* FunctionDeclaration */:
158744
158757
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
158745
158758
  default:
@@ -425,6 +425,7 @@ declare namespace ts {
425
425
  JSDocFunctionType = 317,
426
426
  JSDocVariadicType = 318,
427
427
  JSDocNamepathType = 319,
428
+ JSDoc = 320,
428
429
  /** @deprecated Use SyntaxKind.JSDoc */
429
430
  JSDocComment = 320,
430
431
  JSDocText = 321,
@@ -493,7 +494,6 @@ declare namespace ts {
493
494
  LastJSDocNode = 347,
494
495
  FirstJSDocTagNode = 327,
495
496
  LastJSDocTagNode = 347,
496
- JSDoc = 320
497
497
  }
498
498
  export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
499
499
  export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
@@ -2851,7 +2851,7 @@ var ts;
2851
2851
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2852
2852
  }
2853
2853
  if (isFlags) {
2854
- var result = "";
2854
+ var result = [];
2855
2855
  var remainingFlags = value;
2856
2856
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2857
2857
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2859,12 +2859,12 @@ var ts;
2859
2859
  break;
2860
2860
  }
2861
2861
  if (enumValue !== 0 && enumValue & value) {
2862
- result = "" + result + (result ? "|" : "") + enumName;
2862
+ result.push(enumName);
2863
2863
  remainingFlags &= ~enumValue;
2864
2864
  }
2865
2865
  }
2866
2866
  if (remainingFlags === 0) {
2867
- return result;
2867
+ return result.join("|");
2868
2868
  }
2869
2869
  }
2870
2870
  else {
@@ -2878,7 +2878,15 @@ var ts;
2878
2878
  return value.toString();
2879
2879
  }
2880
2880
  Debug.formatEnum = formatEnum;
2881
+ var enumMemberCache = new ts.Map();
2881
2882
  function getEnumMembers(enumObject) {
2883
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2884
+ // to reuse later. This saves us from reconstructing this each and every time we call
2885
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2886
+ var existing = enumMemberCache.get(enumObject);
2887
+ if (existing) {
2888
+ return existing;
2889
+ }
2882
2890
  var result = [];
2883
2891
  for (var name in enumObject) {
2884
2892
  var value = enumObject[name];
@@ -2886,7 +2894,9 @@ var ts;
2886
2894
  result.push([value, name]);
2887
2895
  }
2888
2896
  }
2889
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2897
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2898
+ enumMemberCache.set(enumObject, sorted);
2899
+ return sorted;
2890
2900
  }
2891
2901
  function formatSyntaxKind(kind) {
2892
2902
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4525,6 +4535,7 @@ var ts;
4525
4535
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4526
4536
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4527
4537
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4538
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4528
4539
  /** @deprecated Use SyntaxKind.JSDoc */
4529
4540
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4530
4541
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4599,7 +4610,6 @@ var ts;
4599
4610
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4600
4611
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4601
4612
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4602
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4603
4613
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4604
4614
  var NodeFlags;
4605
4615
  (function (NodeFlags) {
@@ -8662,6 +8672,7 @@ var ts;
8662
8672
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8663
8673
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8664
8674
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8675
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8665
8676
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8666
8677
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8667
8678
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -45390,7 +45401,7 @@ var ts;
45390
45401
  case 164 /* Parameter */:
45391
45402
  // Parameters with names are handled at the top of this function. Parameters
45392
45403
  // without names can only come from JSDocFunctionTypes.
45393
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45404
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45394
45405
  var functionType = node.parent;
45395
45406
  var index = functionType.parameters.indexOf(node);
45396
45407
  return "arg" + index;
@@ -65667,8 +65678,12 @@ var ts;
65667
65678
  }
65668
65679
  reportRelationError(headMessage, source, target);
65669
65680
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65670
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65671
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65681
+ var syntheticParam = cloneTypeParameter(source);
65682
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65683
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65684
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65685
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65686
+ }
65672
65687
  }
65673
65688
  }
65674
65689
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -108651,7 +108666,7 @@ var ts;
108651
108666
  return getTypeAliasDeclarationVisibilityError;
108652
108667
  }
108653
108668
  else {
108654
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108669
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108655
108670
  }
108656
108671
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108657
108672
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108862,7 +108877,7 @@ var ts;
108862
108877
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108863
108878
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108864
108879
  default:
108865
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108880
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108866
108881
  }
108867
108882
  }
108868
108883
  function getTypeParameterConstraintVisibilityError() {
@@ -109628,7 +109643,7 @@ var ts;
109628
109643
  while (ts.length(lateMarkedStatements)) {
109629
109644
  var i = lateMarkedStatements.shift();
109630
109645
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109631
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109646
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109632
109647
  }
109633
109648
  var priorNeedsDeclare = needsDeclare;
109634
109649
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109811,7 +109826,7 @@ var ts;
109811
109826
  return cleanup(input);
109812
109827
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109813
109828
  }
109814
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109829
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109815
109830
  }
109816
109831
  }
109817
109832
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110133,7 +110148,7 @@ var ts;
110133
110148
  }
110134
110149
  }
110135
110150
  // Anything left unhandled is an error, so this should be unreachable
110136
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110151
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110137
110152
  function cleanup(node) {
110138
110153
  if (isEnclosingDeclaration(input)) {
110139
110154
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150681,7 +150696,7 @@ var ts;
150681
150696
  return {
150682
150697
  indentation: indentation,
150683
150698
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150684
- suffix: insertTrailingComma ? "," : ""
150699
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150685
150700
  };
150686
150701
  };
150687
150702
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -155383,6 +155398,7 @@ var ts;
155383
155398
  ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
155384
155399
  ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
155385
155400
  ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
155401
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
155386
155402
  ];
155387
155403
  codefix.registerCodeFix({
155388
155404
  errorCodes: errorCodes,
@@ -155393,7 +155409,7 @@ var ts;
155393
155409
  return;
155394
155410
  }
155395
155411
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
155396
- return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
155412
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
155397
155413
  },
155398
155414
  fixIds: [fixId],
155399
155415
  getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
@@ -155404,13 +155420,10 @@ var ts;
155404
155420
  }); },
155405
155421
  });
155406
155422
  function getDiagnosticRelatedInfo(program, sourceFile, span) {
155407
- var diags = program.getSemanticDiagnostics(sourceFile).filter(function (diag) { return diag.start === span.start && diag.length === span.length; });
155408
- if (!ts.length(diags))
155409
- return;
155410
- var diag = diags[0];
155411
- if (!diag.relatedInformation)
155423
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
155424
+ if (!diag || !diag.relatedInformation)
155412
155425
  return;
155413
- var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
155426
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
155414
155427
  if (!related)
155415
155428
  return;
155416
155429
  return related;
@@ -159352,7 +159365,7 @@ var ts;
159352
159365
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159353
159366
  case 168 /* MethodSignature */:
159354
159367
  return ts.factory.createMethodSignature(modifiers, name,
159355
- /*questionToken*/ undefined, typeParameters, parameters, type);
159368
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159356
159369
  case 256 /* FunctionDeclaration */:
159357
159370
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159358
159371
  default:
@@ -425,6 +425,7 @@ declare namespace ts {
425
425
  JSDocFunctionType = 317,
426
426
  JSDocVariadicType = 318,
427
427
  JSDocNamepathType = 319,
428
+ JSDoc = 320,
428
429
  /** @deprecated Use SyntaxKind.JSDoc */
429
430
  JSDocComment = 320,
430
431
  JSDocText = 321,
@@ -493,7 +494,6 @@ declare namespace ts {
493
494
  LastJSDocNode = 347,
494
495
  FirstJSDocTagNode = 327,
495
496
  LastJSDocTagNode = 347,
496
- JSDoc = 320
497
497
  }
498
498
  export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
499
499
  export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
package/lib/typescript.js CHANGED
@@ -2851,7 +2851,7 @@ var ts;
2851
2851
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2852
2852
  }
2853
2853
  if (isFlags) {
2854
- var result = "";
2854
+ var result = [];
2855
2855
  var remainingFlags = value;
2856
2856
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2857
2857
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2859,12 +2859,12 @@ var ts;
2859
2859
  break;
2860
2860
  }
2861
2861
  if (enumValue !== 0 && enumValue & value) {
2862
- result = "" + result + (result ? "|" : "") + enumName;
2862
+ result.push(enumName);
2863
2863
  remainingFlags &= ~enumValue;
2864
2864
  }
2865
2865
  }
2866
2866
  if (remainingFlags === 0) {
2867
- return result;
2867
+ return result.join("|");
2868
2868
  }
2869
2869
  }
2870
2870
  else {
@@ -2878,7 +2878,15 @@ var ts;
2878
2878
  return value.toString();
2879
2879
  }
2880
2880
  Debug.formatEnum = formatEnum;
2881
+ var enumMemberCache = new ts.Map();
2881
2882
  function getEnumMembers(enumObject) {
2883
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2884
+ // to reuse later. This saves us from reconstructing this each and every time we call
2885
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2886
+ var existing = enumMemberCache.get(enumObject);
2887
+ if (existing) {
2888
+ return existing;
2889
+ }
2882
2890
  var result = [];
2883
2891
  for (var name in enumObject) {
2884
2892
  var value = enumObject[name];
@@ -2886,7 +2894,9 @@ var ts;
2886
2894
  result.push([value, name]);
2887
2895
  }
2888
2896
  }
2889
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2897
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2898
+ enumMemberCache.set(enumObject, sorted);
2899
+ return sorted;
2890
2900
  }
2891
2901
  function formatSyntaxKind(kind) {
2892
2902
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4525,6 +4535,7 @@ var ts;
4525
4535
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4526
4536
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4527
4537
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4538
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4528
4539
  /** @deprecated Use SyntaxKind.JSDoc */
4529
4540
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4530
4541
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4599,7 +4610,6 @@ var ts;
4599
4610
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4600
4611
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4601
4612
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4602
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4603
4613
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4604
4614
  var NodeFlags;
4605
4615
  (function (NodeFlags) {
@@ -8662,6 +8672,7 @@ var ts;
8662
8672
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8663
8673
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8664
8674
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8675
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8665
8676
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8666
8677
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8667
8678
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -45390,7 +45401,7 @@ var ts;
45390
45401
  case 164 /* Parameter */:
45391
45402
  // Parameters with names are handled at the top of this function. Parameters
45392
45403
  // without names can only come from JSDocFunctionTypes.
45393
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45404
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45394
45405
  var functionType = node.parent;
45395
45406
  var index = functionType.parameters.indexOf(node);
45396
45407
  return "arg" + index;
@@ -65667,8 +65678,12 @@ var ts;
65667
65678
  }
65668
65679
  reportRelationError(headMessage, source, target);
65669
65680
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65670
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65671
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65681
+ var syntheticParam = cloneTypeParameter(source);
65682
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65683
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65684
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65685
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65686
+ }
65672
65687
  }
65673
65688
  }
65674
65689
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -108651,7 +108666,7 @@ var ts;
108651
108666
  return getTypeAliasDeclarationVisibilityError;
108652
108667
  }
108653
108668
  else {
108654
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108669
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108655
108670
  }
108656
108671
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108657
108672
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108862,7 +108877,7 @@ var ts;
108862
108877
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108863
108878
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108864
108879
  default:
108865
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108880
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108866
108881
  }
108867
108882
  }
108868
108883
  function getTypeParameterConstraintVisibilityError() {
@@ -109628,7 +109643,7 @@ var ts;
109628
109643
  while (ts.length(lateMarkedStatements)) {
109629
109644
  var i = lateMarkedStatements.shift();
109630
109645
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109631
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109646
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109632
109647
  }
109633
109648
  var priorNeedsDeclare = needsDeclare;
109634
109649
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109811,7 +109826,7 @@ var ts;
109811
109826
  return cleanup(input);
109812
109827
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109813
109828
  }
109814
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109829
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109815
109830
  }
109816
109831
  }
109817
109832
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110133,7 +110148,7 @@ var ts;
110133
110148
  }
110134
110149
  }
110135
110150
  // Anything left unhandled is an error, so this should be unreachable
110136
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110151
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110137
110152
  function cleanup(node) {
110138
110153
  if (isEnclosingDeclaration(input)) {
110139
110154
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150681,7 +150696,7 @@ var ts;
150681
150696
  return {
150682
150697
  indentation: indentation,
150683
150698
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150684
- suffix: insertTrailingComma ? "," : ""
150699
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150685
150700
  };
150686
150701
  };
150687
150702
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -155383,6 +155398,7 @@ var ts;
155383
155398
  ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
155384
155399
  ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
155385
155400
  ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
155401
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
155386
155402
  ];
155387
155403
  codefix.registerCodeFix({
155388
155404
  errorCodes: errorCodes,
@@ -155393,7 +155409,7 @@ var ts;
155393
155409
  return;
155394
155410
  }
155395
155411
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
155396
- return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
155412
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
155397
155413
  },
155398
155414
  fixIds: [fixId],
155399
155415
  getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
@@ -155404,13 +155420,10 @@ var ts;
155404
155420
  }); },
155405
155421
  });
155406
155422
  function getDiagnosticRelatedInfo(program, sourceFile, span) {
155407
- var diags = program.getSemanticDiagnostics(sourceFile).filter(function (diag) { return diag.start === span.start && diag.length === span.length; });
155408
- if (!ts.length(diags))
155409
- return;
155410
- var diag = diags[0];
155411
- if (!diag.relatedInformation)
155423
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
155424
+ if (!diag || !diag.relatedInformation)
155412
155425
  return;
155413
- var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
155426
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
155414
155427
  if (!related)
155415
155428
  return;
155416
155429
  return related;
@@ -159352,7 +159365,7 @@ var ts;
159352
159365
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159353
159366
  case 168 /* MethodSignature */:
159354
159367
  return ts.factory.createMethodSignature(modifiers, name,
159355
- /*questionToken*/ undefined, typeParameters, parameters, type);
159368
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159356
159369
  case 256 /* FunctionDeclaration */:
159357
159370
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159358
159371
  default:
@@ -425,6 +425,7 @@ declare namespace ts {
425
425
  JSDocFunctionType = 317,
426
426
  JSDocVariadicType = 318,
427
427
  JSDocNamepathType = 319,
428
+ JSDoc = 320,
428
429
  /** @deprecated Use SyntaxKind.JSDoc */
429
430
  JSDocComment = 320,
430
431
  JSDocText = 321,
@@ -493,7 +494,6 @@ declare namespace ts {
493
494
  LastJSDocNode = 347,
494
495
  FirstJSDocTagNode = 327,
495
496
  LastJSDocTagNode = 347,
496
- JSDoc = 320
497
497
  }
498
498
  export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia;
499
499
  export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral;
@@ -2851,7 +2851,7 @@ var ts;
2851
2851
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2852
2852
  }
2853
2853
  if (isFlags) {
2854
- var result = "";
2854
+ var result = [];
2855
2855
  var remainingFlags = value;
2856
2856
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2857
2857
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2859,12 +2859,12 @@ var ts;
2859
2859
  break;
2860
2860
  }
2861
2861
  if (enumValue !== 0 && enumValue & value) {
2862
- result = "" + result + (result ? "|" : "") + enumName;
2862
+ result.push(enumName);
2863
2863
  remainingFlags &= ~enumValue;
2864
2864
  }
2865
2865
  }
2866
2866
  if (remainingFlags === 0) {
2867
- return result;
2867
+ return result.join("|");
2868
2868
  }
2869
2869
  }
2870
2870
  else {
@@ -2878,7 +2878,15 @@ var ts;
2878
2878
  return value.toString();
2879
2879
  }
2880
2880
  Debug.formatEnum = formatEnum;
2881
+ var enumMemberCache = new ts.Map();
2881
2882
  function getEnumMembers(enumObject) {
2883
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2884
+ // to reuse later. This saves us from reconstructing this each and every time we call
2885
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2886
+ var existing = enumMemberCache.get(enumObject);
2887
+ if (existing) {
2888
+ return existing;
2889
+ }
2882
2890
  var result = [];
2883
2891
  for (var name in enumObject) {
2884
2892
  var value = enumObject[name];
@@ -2886,7 +2894,9 @@ var ts;
2886
2894
  result.push([value, name]);
2887
2895
  }
2888
2896
  }
2889
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2897
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2898
+ enumMemberCache.set(enumObject, sorted);
2899
+ return sorted;
2890
2900
  }
2891
2901
  function formatSyntaxKind(kind) {
2892
2902
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4525,6 +4535,7 @@ var ts;
4525
4535
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4526
4536
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4527
4537
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4538
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4528
4539
  /** @deprecated Use SyntaxKind.JSDoc */
4529
4540
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4530
4541
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4599,7 +4610,6 @@ var ts;
4599
4610
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4600
4611
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4601
4612
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4602
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4603
4613
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4604
4614
  var NodeFlags;
4605
4615
  (function (NodeFlags) {
@@ -8662,6 +8672,7 @@ var ts;
8662
8672
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8663
8673
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8664
8674
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8675
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8665
8676
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8666
8677
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8667
8678
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -45390,7 +45401,7 @@ var ts;
45390
45401
  case 164 /* Parameter */:
45391
45402
  // Parameters with names are handled at the top of this function. Parameters
45392
45403
  // without names can only come from JSDocFunctionTypes.
45393
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45404
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45394
45405
  var functionType = node.parent;
45395
45406
  var index = functionType.parameters.indexOf(node);
45396
45407
  return "arg" + index;
@@ -65667,8 +65678,12 @@ var ts;
65667
65678
  }
65668
65679
  reportRelationError(headMessage, source, target);
65669
65680
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65670
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65671
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65681
+ var syntheticParam = cloneTypeParameter(source);
65682
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65683
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65684
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65685
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65686
+ }
65672
65687
  }
65673
65688
  }
65674
65689
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -108651,7 +108666,7 @@ var ts;
108651
108666
  return getTypeAliasDeclarationVisibilityError;
108652
108667
  }
108653
108668
  else {
108654
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108669
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108655
108670
  }
108656
108671
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108657
108672
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108862,7 +108877,7 @@ var ts;
108862
108877
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108863
108878
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108864
108879
  default:
108865
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108880
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108866
108881
  }
108867
108882
  }
108868
108883
  function getTypeParameterConstraintVisibilityError() {
@@ -109628,7 +109643,7 @@ var ts;
109628
109643
  while (ts.length(lateMarkedStatements)) {
109629
109644
  var i = lateMarkedStatements.shift();
109630
109645
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109631
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109646
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109632
109647
  }
109633
109648
  var priorNeedsDeclare = needsDeclare;
109634
109649
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109811,7 +109826,7 @@ var ts;
109811
109826
  return cleanup(input);
109812
109827
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109813
109828
  }
109814
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109829
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109815
109830
  }
109816
109831
  }
109817
109832
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110133,7 +110148,7 @@ var ts;
110133
110148
  }
110134
110149
  }
110135
110150
  // Anything left unhandled is an error, so this should be unreachable
110136
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110151
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110137
110152
  function cleanup(node) {
110138
110153
  if (isEnclosingDeclaration(input)) {
110139
110154
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150681,7 +150696,7 @@ var ts;
150681
150696
  return {
150682
150697
  indentation: indentation,
150683
150698
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150684
- suffix: insertTrailingComma ? "," : ""
150699
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150685
150700
  };
150686
150701
  };
150687
150702
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -155383,6 +155398,7 @@ var ts;
155383
155398
  ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties.code,
155384
155399
  ts.Diagnostics.Property_0_is_incompatible_with_index_signature.code,
155385
155400
  ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_type_2.code,
155401
+ ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code,
155386
155402
  ];
155387
155403
  codefix.registerCodeFix({
155388
155404
  errorCodes: errorCodes,
@@ -155393,7 +155409,7 @@ var ts;
155393
155409
  return;
155394
155410
  }
155395
155411
  var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addMissingConstraint(t, related); });
155396
- return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)];
155412
+ return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_extends_constraint, fixId, ts.Diagnostics.Add_extends_constraint_to_all_type_parameters)];
155397
155413
  },
155398
155414
  fixIds: [fixId],
155399
155415
  getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
@@ -155404,13 +155420,10 @@ var ts;
155404
155420
  }); },
155405
155421
  });
155406
155422
  function getDiagnosticRelatedInfo(program, sourceFile, span) {
155407
- var diags = program.getSemanticDiagnostics(sourceFile).filter(function (diag) { return diag.start === span.start && diag.length === span.length; });
155408
- if (!ts.length(diags))
155409
- return;
155410
- var diag = diags[0];
155411
- if (!diag.relatedInformation)
155423
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
155424
+ if (!diag || !diag.relatedInformation)
155412
155425
  return;
155413
- var related = ts.filter(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; })[0];
155426
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
155414
155427
  if (!related)
155415
155428
  return;
155416
155429
  return related;
@@ -159352,7 +159365,7 @@ var ts;
159352
159365
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159353
159366
  case 168 /* MethodSignature */:
159354
159367
  return ts.factory.createMethodSignature(modifiers, name,
159355
- /*questionToken*/ undefined, typeParameters, parameters, type);
159368
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159356
159369
  case 256 /* FunctionDeclaration */:
159357
159370
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159358
159371
  default:
@@ -2646,7 +2646,7 @@ var ts;
2646
2646
  return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
2647
2647
  }
2648
2648
  if (isFlags) {
2649
- var result = "";
2649
+ var result = [];
2650
2650
  var remainingFlags = value;
2651
2651
  for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
2652
2652
  var _a = members_1[_i], enumValue = _a[0], enumName = _a[1];
@@ -2654,12 +2654,12 @@ var ts;
2654
2654
  break;
2655
2655
  }
2656
2656
  if (enumValue !== 0 && enumValue & value) {
2657
- result = "" + result + (result ? "|" : "") + enumName;
2657
+ result.push(enumName);
2658
2658
  remainingFlags &= ~enumValue;
2659
2659
  }
2660
2660
  }
2661
2661
  if (remainingFlags === 0) {
2662
- return result;
2662
+ return result.join("|");
2663
2663
  }
2664
2664
  }
2665
2665
  else {
@@ -2673,7 +2673,15 @@ var ts;
2673
2673
  return value.toString();
2674
2674
  }
2675
2675
  Debug.formatEnum = formatEnum;
2676
+ var enumMemberCache = new ts.Map();
2676
2677
  function getEnumMembers(enumObject) {
2678
+ // Assuming enum objects do not change at runtime, we can cache the enum members list
2679
+ // to reuse later. This saves us from reconstructing this each and every time we call
2680
+ // a formatting function (which can be expensive for large enums like SyntaxKind).
2681
+ var existing = enumMemberCache.get(enumObject);
2682
+ if (existing) {
2683
+ return existing;
2684
+ }
2677
2685
  var result = [];
2678
2686
  for (var name in enumObject) {
2679
2687
  var value = enumObject[name];
@@ -2681,7 +2689,9 @@ var ts;
2681
2689
  result.push([value, name]);
2682
2690
  }
2683
2691
  }
2684
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2692
+ var sorted = ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
2693
+ enumMemberCache.set(enumObject, sorted);
2694
+ return sorted;
2685
2695
  }
2686
2696
  function formatSyntaxKind(kind) {
2687
2697
  return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
@@ -4320,6 +4330,7 @@ var ts;
4320
4330
  SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType";
4321
4331
  SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType";
4322
4332
  SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType";
4333
+ SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4323
4334
  /** @deprecated Use SyntaxKind.JSDoc */
4324
4335
  SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment";
4325
4336
  SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText";
@@ -4394,7 +4405,6 @@ var ts;
4394
4405
  SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode";
4395
4406
  /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
4396
4407
  /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword";
4397
- SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc";
4398
4408
  })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
4399
4409
  var NodeFlags;
4400
4410
  (function (NodeFlags) {
@@ -8457,6 +8467,7 @@ var ts;
8457
8467
  The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8458
8468
  The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
8459
8469
  Add_extends_constraint: diag(2211, ts.DiagnosticCategory.Message, "Add_extends_constraint_2211", "Add `extends` constraint."),
8470
+ Add_extends_constraint_to_all_type_parameters: diag(2212, ts.DiagnosticCategory.Message, "Add_extends_constraint_to_all_type_parameters_2212", "Add `extends` constraint to all type parameters"),
8460
8471
  Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
8461
8472
  Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
8462
8473
  Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -45185,7 +45196,7 @@ var ts;
45185
45196
  case 164 /* Parameter */:
45186
45197
  // Parameters with names are handled at the top of this function. Parameters
45187
45198
  // without names can only come from JSDocFunctionTypes.
45188
- ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
45199
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45189
45200
  var functionType = node.parent;
45190
45201
  var index = functionType.parameters.indexOf(node);
45191
45202
  return "arg" + index;
@@ -65462,8 +65473,12 @@ var ts;
65462
65473
  }
65463
65474
  reportRelationError(headMessage, source, target);
65464
65475
  if (source.flags & 262144 /* TypeParameter */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source)) {
65465
- var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65466
- associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65476
+ var syntheticParam = cloneTypeParameter(source);
65477
+ syntheticParam.constraint = instantiateType(target, makeUnaryTypeMapper(source, syntheticParam));
65478
+ if (hasNonCircularBaseConstraint(syntheticParam)) {
65479
+ var targetConstraintString = typeToString(target, source.symbol.declarations[0]);
65480
+ associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint, targetConstraintString));
65481
+ }
65467
65482
  }
65468
65483
  }
65469
65484
  function traceUnionsOrIntersectionsTooLarge(source, target) {
@@ -108446,7 +108461,7 @@ var ts;
108446
108461
  return getTypeAliasDeclarationVisibilityError;
108447
108462
  }
108448
108463
  else {
108449
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108464
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108450
108465
  }
108451
108466
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108452
108467
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108657,7 +108672,7 @@ var ts;
108657
108672
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108658
108673
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108659
108674
  default:
108660
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108675
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108661
108676
  }
108662
108677
  }
108663
108678
  function getTypeParameterConstraintVisibilityError() {
@@ -109423,7 +109438,7 @@ var ts;
109423
109438
  while (ts.length(lateMarkedStatements)) {
109424
109439
  var i = lateMarkedStatements.shift();
109425
109440
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109426
- return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + (ts.SyntaxKind ? ts.SyntaxKind[i.kind] : i.kind));
109441
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109427
109442
  }
109428
109443
  var priorNeedsDeclare = needsDeclare;
109429
109444
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109606,7 +109621,7 @@ var ts;
109606
109621
  return cleanup(input);
109607
109622
  return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
109608
109623
  }
109609
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109624
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109610
109625
  }
109611
109626
  }
109612
109627
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -109928,7 +109943,7 @@ var ts;
109928
109943
  }
109929
109944
  }
109930
109945
  // Anything left unhandled is an error, so this should be unreachable
109931
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
109946
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
109932
109947
  function cleanup(node) {
109933
109948
  if (isEnclosingDeclaration(input)) {
109934
109949
  enclosingDeclaration = previousEnclosingDeclaration;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.0-pr-49481-2",
5
+ "version": "4.8.0-pr-49481-8",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [