typescript 4.8.0-dev.20220610 → 4.8.0-dev.20220613

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.
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220610";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220613";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -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) {
@@ -35977,9 +35987,18 @@ var ts;
35977
35987
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35978
35988
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35979
35989
  return true;
35990
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
35991
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
35992
+ // this context, `+` and `-` are unary operators, not binary operators.
35993
+ case 29 /* LessThanToken */:
35994
+ case 31 /* GreaterThanToken */:
35995
+ case 39 /* PlusToken */:
35996
+ case 40 /* MinusToken */:
35997
+ return false;
35980
35998
  }
35981
- // Consider something a type argument list only if the following token can't start an expression.
35982
- return !isStartOfExpression();
35999
+ // We favor the type argument list interpretation when it is immediately followed by
36000
+ // a line break, a binary operator, or something that can't start an expression.
36001
+ return scanner.hasPrecedingLineBreak() || isBinaryOperator() || !isStartOfExpression();
35983
36002
  }
35984
36003
  function parsePrimaryExpression() {
35985
36004
  switch (token()) {
@@ -45380,7 +45399,7 @@ var ts;
45380
45399
  case 164 /* Parameter */:
45381
45400
  // Parameters with names are handled at the top of this function. Parameters
45382
45401
  // without names can only come from JSDocFunctionTypes.
45383
- 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"; });
45402
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45384
45403
  var functionType = node.parent;
45385
45404
  var index = functionType.parameters.indexOf(node);
45386
45405
  return "arg" + index;
@@ -108640,7 +108659,7 @@ var ts;
108640
108659
  return getTypeAliasDeclarationVisibilityError;
108641
108660
  }
108642
108661
  else {
108643
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108662
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108644
108663
  }
108645
108664
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108646
108665
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108851,7 +108870,7 @@ var ts;
108851
108870
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108852
108871
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108853
108872
  default:
108854
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108873
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108855
108874
  }
108856
108875
  }
108857
108876
  function getTypeParameterConstraintVisibilityError() {
@@ -109617,7 +109636,7 @@ var ts;
109617
109636
  while (ts.length(lateMarkedStatements)) {
109618
109637
  var i = lateMarkedStatements.shift();
109619
109638
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109620
- 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));
109639
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109621
109640
  }
109622
109641
  var priorNeedsDeclare = needsDeclare;
109623
109642
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109800,7 +109819,7 @@ var ts;
109800
109819
  return cleanup(input);
109801
109820
  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));
109802
109821
  }
109803
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109822
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109804
109823
  }
109805
109824
  }
109806
109825
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110122,7 +110141,7 @@ var ts;
110122
110141
  }
110123
110142
  }
110124
110143
  // Anything left unhandled is an error, so this should be unreachable
110125
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110144
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110126
110145
  function cleanup(node) {
110127
110146
  if (isEnclosingDeclaration(input)) {
110128
110147
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150670,7 +150689,7 @@ var ts;
150670
150689
  return {
150671
150690
  indentation: indentation,
150672
150691
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150673
- suffix: insertTrailingComma ? "," : ""
150692
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150674
150693
  };
150675
150694
  };
150676
150695
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -159268,7 +159287,7 @@ var ts;
159268
159287
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159269
159288
  case 168 /* MethodSignature */:
159270
159289
  return ts.factory.createMethodSignature(modifiers, name,
159271
- /*questionToken*/ undefined, typeParameters, parameters, type);
159290
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159272
159291
  case 256 /* FunctionDeclaration */:
159273
159292
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159274
159293
  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
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220610";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220613";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -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) {
@@ -35977,9 +35987,18 @@ var ts;
35977
35987
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35978
35988
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35979
35989
  return true;
35990
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
35991
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
35992
+ // this context, `+` and `-` are unary operators, not binary operators.
35993
+ case 29 /* LessThanToken */:
35994
+ case 31 /* GreaterThanToken */:
35995
+ case 39 /* PlusToken */:
35996
+ case 40 /* MinusToken */:
35997
+ return false;
35980
35998
  }
35981
- // Consider something a type argument list only if the following token can't start an expression.
35982
- return !isStartOfExpression();
35999
+ // We favor the type argument list interpretation when it is immediately followed by
36000
+ // a line break, a binary operator, or something that can't start an expression.
36001
+ return scanner.hasPrecedingLineBreak() || isBinaryOperator() || !isStartOfExpression();
35983
36002
  }
35984
36003
  function parsePrimaryExpression() {
35985
36004
  switch (token()) {
@@ -45380,7 +45399,7 @@ var ts;
45380
45399
  case 164 /* Parameter */:
45381
45400
  // Parameters with names are handled at the top of this function. Parameters
45382
45401
  // without names can only come from JSDocFunctionTypes.
45383
- 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"; });
45402
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45384
45403
  var functionType = node.parent;
45385
45404
  var index = functionType.parameters.indexOf(node);
45386
45405
  return "arg" + index;
@@ -108640,7 +108659,7 @@ var ts;
108640
108659
  return getTypeAliasDeclarationVisibilityError;
108641
108660
  }
108642
108661
  else {
108643
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108662
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108644
108663
  }
108645
108664
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108646
108665
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108851,7 +108870,7 @@ var ts;
108851
108870
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108852
108871
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108853
108872
  default:
108854
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108873
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108855
108874
  }
108856
108875
  }
108857
108876
  function getTypeParameterConstraintVisibilityError() {
@@ -109617,7 +109636,7 @@ var ts;
109617
109636
  while (ts.length(lateMarkedStatements)) {
109618
109637
  var i = lateMarkedStatements.shift();
109619
109638
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109620
- 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));
109639
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109621
109640
  }
109622
109641
  var priorNeedsDeclare = needsDeclare;
109623
109642
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109800,7 +109819,7 @@ var ts;
109800
109819
  return cleanup(input);
109801
109820
  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));
109802
109821
  }
109803
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109822
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109804
109823
  }
109805
109824
  }
109806
109825
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110122,7 +110141,7 @@ var ts;
110122
110141
  }
110123
110142
  }
110124
110143
  // Anything left unhandled is an error, so this should be unreachable
110125
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110144
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110126
110145
  function cleanup(node) {
110127
110146
  if (isEnclosingDeclaration(input)) {
110128
110147
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150670,7 +150689,7 @@ var ts;
150670
150689
  return {
150671
150690
  indentation: indentation,
150672
150691
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150673
- suffix: insertTrailingComma ? "," : ""
150692
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150674
150693
  };
150675
150694
  };
150676
150695
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -159268,7 +159287,7 @@ var ts;
159268
159287
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159269
159288
  case 168 /* MethodSignature */:
159270
159289
  return ts.factory.createMethodSignature(modifiers, name,
159271
- /*questionToken*/ undefined, typeParameters, parameters, type);
159290
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159272
159291
  case 256 /* FunctionDeclaration */:
159273
159292
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159274
159293
  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;
@@ -294,7 +294,7 @@ var ts;
294
294
  // The following is baselined as a literal template type without intervention
295
295
  /** The version of the TypeScript compiler release */
296
296
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
297
- ts.version = ts.versionMajorMinor + ".0-dev.20220610";
297
+ ts.version = ts.versionMajorMinor + ".0-dev.20220613";
298
298
  /* @internal */
299
299
  var Comparison;
300
300
  (function (Comparison) {
@@ -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) {
@@ -35977,9 +35987,18 @@ var ts;
35977
35987
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35978
35988
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35979
35989
  return true;
35990
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
35991
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
35992
+ // this context, `+` and `-` are unary operators, not binary operators.
35993
+ case 29 /* LessThanToken */:
35994
+ case 31 /* GreaterThanToken */:
35995
+ case 39 /* PlusToken */:
35996
+ case 40 /* MinusToken */:
35997
+ return false;
35980
35998
  }
35981
- // Consider something a type argument list only if the following token can't start an expression.
35982
- return !isStartOfExpression();
35999
+ // We favor the type argument list interpretation when it is immediately followed by
36000
+ // a line break, a binary operator, or something that can't start an expression.
36001
+ return scanner.hasPrecedingLineBreak() || isBinaryOperator() || !isStartOfExpression();
35983
36002
  }
35984
36003
  function parsePrimaryExpression() {
35985
36004
  switch (token()) {
@@ -45380,7 +45399,7 @@ var ts;
45380
45399
  case 164 /* Parameter */:
45381
45400
  // Parameters with names are handled at the top of this function. Parameters
45382
45401
  // without names can only come from JSDocFunctionTypes.
45383
- 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"; });
45402
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45384
45403
  var functionType = node.parent;
45385
45404
  var index = functionType.parameters.indexOf(node);
45386
45405
  return "arg" + index;
@@ -108640,7 +108659,7 @@ var ts;
108640
108659
  return getTypeAliasDeclarationVisibilityError;
108641
108660
  }
108642
108661
  else {
108643
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108662
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108644
108663
  }
108645
108664
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108646
108665
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108851,7 +108870,7 @@ var ts;
108851
108870
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108852
108871
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108853
108872
  default:
108854
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108873
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108855
108874
  }
108856
108875
  }
108857
108876
  function getTypeParameterConstraintVisibilityError() {
@@ -109617,7 +109636,7 @@ var ts;
109617
109636
  while (ts.length(lateMarkedStatements)) {
109618
109637
  var i = lateMarkedStatements.shift();
109619
109638
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109620
- 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));
109639
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109621
109640
  }
109622
109641
  var priorNeedsDeclare = needsDeclare;
109623
109642
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109800,7 +109819,7 @@ var ts;
109800
109819
  return cleanup(input);
109801
109820
  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));
109802
109821
  }
109803
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109822
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109804
109823
  }
109805
109824
  }
109806
109825
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -110122,7 +110141,7 @@ var ts;
110122
110141
  }
110123
110142
  }
110124
110143
  // Anything left unhandled is an error, so this should be unreachable
110125
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
110144
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
110126
110145
  function cleanup(node) {
110127
110146
  if (isEnclosingDeclaration(input)) {
110128
110147
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -150670,7 +150689,7 @@ var ts;
150670
150689
  return {
150671
150690
  indentation: indentation,
150672
150691
  prefix: (insertLeadingComma ? "," : "") + this.newLineCharacter,
150673
- suffix: insertTrailingComma ? "," : ""
150692
+ suffix: insertTrailingComma ? "," : ts.isInterfaceDeclaration(node) && isEmpty ? ";" : ""
150674
150693
  };
150675
150694
  };
150676
150695
  ChangeTracker.prototype.insertNodeAfterComma = function (sourceFile, after, newNode) {
@@ -159268,7 +159287,7 @@ var ts;
159268
159287
  /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference));
159269
159288
  case 168 /* MethodSignature */:
159270
159289
  return ts.factory.createMethodSignature(modifiers, name,
159271
- /*questionToken*/ undefined, typeParameters, parameters, type);
159290
+ /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* UnknownKeyword */) : type);
159272
159291
  case 256 /* FunctionDeclaration */:
159273
159292
  return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference));
159274
159293
  default: