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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = ts.versionMajorMinor + ".0-dev.20220610";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220613";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -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) {
@@ -35772,9 +35782,18 @@ var ts;
35772
35782
  case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
35773
35783
  case 15 /* TemplateHead */: // foo<T> `...${100}...`
35774
35784
  return true;
35785
+ // A type argument list followed by `<` never makes sense, and a type argument list followed
35786
+ // by `>` is ambiguous with a (re-scanned) `>>` operator, so we disqualify both. Also, in
35787
+ // this context, `+` and `-` are unary operators, not binary operators.
35788
+ case 29 /* LessThanToken */:
35789
+ case 31 /* GreaterThanToken */:
35790
+ case 39 /* PlusToken */:
35791
+ case 40 /* MinusToken */:
35792
+ return false;
35775
35793
  }
35776
- // Consider something a type argument list only if the following token can't start an expression.
35777
- return !isStartOfExpression();
35794
+ // We favor the type argument list interpretation when it is immediately followed by
35795
+ // a line break, a binary operator, or something that can't start an expression.
35796
+ return scanner.hasPrecedingLineBreak() || isBinaryOperator() || !isStartOfExpression();
35778
35797
  }
35779
35798
  function parsePrimaryExpression() {
35780
35799
  switch (token()) {
@@ -45175,7 +45194,7 @@ var ts;
45175
45194
  case 164 /* Parameter */:
45176
45195
  // Parameters with names are handled at the top of this function. Parameters
45177
45196
  // without names can only come from JSDocFunctionTypes.
45178
- 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"; });
45197
+ ts.Debug.assert(node.parent.kind === 317 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + ts.Debug.formatSyntaxKind(node.parent.kind) + ", expected JSDocFunctionType"; });
45179
45198
  var functionType = node.parent;
45180
45199
  var index = functionType.parameters.indexOf(node);
45181
45200
  return "arg" + index;
@@ -108435,7 +108454,7 @@ var ts;
108435
108454
  return getTypeAliasDeclarationVisibilityError;
108436
108455
  }
108437
108456
  else {
108438
- return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
108457
+ return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.Debug.formatSyntaxKind(node.kind));
108439
108458
  }
108440
108459
  function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
108441
108460
  if (node.kind === 254 /* VariableDeclaration */ || node.kind === 203 /* BindingElement */) {
@@ -108646,7 +108665,7 @@ var ts;
108646
108665
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 :
108647
108666
  ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1;
108648
108667
  default:
108649
- return ts.Debug.fail("Unknown parent for parameter: " + ts.SyntaxKind[node.parent.kind]);
108668
+ return ts.Debug.fail("Unknown parent for parameter: " + ts.Debug.formatSyntaxKind(node.parent.kind));
108650
108669
  }
108651
108670
  }
108652
108671
  function getTypeParameterConstraintVisibilityError() {
@@ -109412,7 +109431,7 @@ var ts;
109412
109431
  while (ts.length(lateMarkedStatements)) {
109413
109432
  var i = lateMarkedStatements.shift();
109414
109433
  if (!ts.isLateVisibilityPaintedStatement(i)) {
109415
- 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));
109434
+ return ts.Debug.fail("Late replaced statement was found which is not handled by the declaration transformer!: " + ts.Debug.formatSyntaxKind(i.kind));
109416
109435
  }
109417
109436
  var priorNeedsDeclare = needsDeclare;
109418
109437
  needsDeclare = i.parent && ts.isSourceFile(i.parent) && !(ts.isExternalModule(i.parent) && isBundledEmit);
@@ -109595,7 +109614,7 @@ var ts;
109595
109614
  return cleanup(input);
109596
109615
  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));
109597
109616
  }
109598
- default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.SyntaxKind[input.kind]);
109617
+ default: ts.Debug.assertNever(input, "Attempted to process unhandled node kind: " + ts.Debug.formatSyntaxKind(input.kind));
109599
109618
  }
109600
109619
  }
109601
109620
  if (ts.isTupleTypeNode(input) && (ts.getLineAndCharacterOfPosition(currentSourceFile, input.pos).line === ts.getLineAndCharacterOfPosition(currentSourceFile, input.end).line)) {
@@ -109917,7 +109936,7 @@ var ts;
109917
109936
  }
109918
109937
  }
109919
109938
  // Anything left unhandled is an error, so this should be unreachable
109920
- return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.SyntaxKind[input.kind]);
109939
+ return ts.Debug.assertNever(input, "Unhandled top-level node in declaration emit: " + ts.Debug.formatSyntaxKind(input.kind));
109921
109940
  function cleanup(node) {
109922
109941
  if (isEnclosingDeclaration(input)) {
109923
109942
  enclosingDeclaration = previousEnclosingDeclaration;
@@ -1088,13 +1088,15 @@
1088
1088
  "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "无法生成项目“{0}”,因为其依赖项“{1}”有错误",
1089
1089
  "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383": "无法生成项目 \"{0}\" ,因为未生成其依赖项 \"{1}\"",
1090
1090
  "Project_0_is_being_forcibly_rebuilt_6388": "正在强制重新生成项目“{0}”",
1091
+ "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399": "项目“{0}”已过期,因为 buildinfo 文件“{1}”指示某些更改未发出",
1091
1092
  "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "项目“{0}”已过期,因为其依赖项“{1}”已过期",
1092
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "项目“{0}”已过期,因为最早的输出“{1}”早于最新的输入“{2}”",
1093
+ "Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350": "项目“{0}”已过期,因为输出“{1}”早于输入“{2}”",
1093
1094
  "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "项目“{0}”已过期,因为输出文件“{1}”不存在",
1094
1095
  "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "项目 \"{0}\" 已过期,因为其输出是使用与当前版本 \"{2}\" 不同的版本 \"{1}\" 生成的",
1095
1096
  "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "项目 \"{0}\" 已过期,因为其依赖项 \"{1}\" 的输出已更改",
1096
1097
  "Project_0_is_up_to_date_6361": "“{0}”项目已是最新",
1097
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "项目“{0}”已是最新,因为最新的输入“{1}”早于最早的输出“{2}”",
1098
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "项目“{0}”是最新的,因为最新的输入“{1}”早于输出“{2}”",
1099
+ "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "项目“{0}”是最新的,但需要更新早于输入文件的输出文件的时间戳",
1098
1100
  "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "项目“{0}”已是最新,拥有来自其依赖项的 .d.ts 文件",
1099
1101
  "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "项目引用不能形成环形图。检测到循环: {0}",
1100
1102
  "Projects_6255": "项目",
@@ -1088,13 +1088,15 @@
1088
1088
  "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363": "因為專案 '{0}' 的相依性 '{1}' 發生錯誤,所以無法建置該專案",
1089
1089
  "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383": "因為未建置專案 '{0}' 的相依性 '{1}',所以無法建置該專案",
1090
1090
  "Project_0_is_being_forcibly_rebuilt_6388": "正在強制重建專案 '{0}'",
1091
+ "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399": "因為 buildinfo 檔案 '{1}' 指出某些變更並未發出,所以專案 '{0}' 已過期",
1091
1092
  "Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date_6353": "因為專案 '{0}' 的相依性 '{1}' 已過期,所以該專案已過期",
1092
- "Project_0_is_out_of_date_because_oldest_output_1_is_older_than_newest_input_2_6350": "因為最舊的輸出 '{1}' 早於最新的輸入 '{2}',所以專案 '{0}' 已過期",
1093
+ "Project_0_is_out_of_date_because_output_1_is_older_than_input_2_6350": "因為輸出 '{1}' 早於輸入 '{2}',所以專案 '{0}' 已過期",
1093
1094
  "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "因為輸出檔案 '{1}' 不存在,所以專案 '{0}' 已過期",
1094
1095
  "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "因為專案 '{0}' 的輸出使用版本 '{1}' 產生而成,與目前的版本 '{2}' 不同,所以該專案已過期",
1095
1096
  "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "因為專案 '{0}' 的相依性 '{1}' 輸出已變更,所以該專案已過期",
1096
1097
  "Project_0_is_up_to_date_6361": "專案 '{0}' 為最新狀態",
1097
- "Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2_6351": "因為最新的輸入 '{1}' 早於最舊的輸出 '{2}',所以專案 '{0}' 為最新狀態",
1098
+ "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "因為最新的輸入 '{1}' 早於最舊的輸出 '{2}',所以專案 '{0}' 為最新狀態",
1099
+ "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "專案 '{0}' 為最新狀態,但需要更新比輸入檔案還舊的輸出檔案時間戳記",
1098
1100
  "Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies_6354": "專案 '{0}' 為最新狀態,且有來自其相依性的 .d.ts 檔案",
1099
1101
  "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "專案參考不會形成循環圖。但偵測到循環: {0}",
1100
1102
  "Projects_6255": "專案",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "4.8.0-dev.20220610",
5
+ "version": "4.8.0-dev.20220613",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [