typescript 4.8.0-dev.20220724 → 4.8.0-dev.20220727

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.20220724";
92
+ ts.version = ts.versionMajorMinor + ".0-dev.20220727";
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -8557,6 +8557,7 @@ var ts;
8557
8557
  Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
8558
8558
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
8559
8559
  An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
8560
+ Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
8560
8561
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
8561
8562
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
8562
8563
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
@@ -33296,7 +33297,9 @@ var ts;
33296
33297
  case 23 /* ImportOrExportSpecifiers */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
33297
33298
  case 13 /* JsxAttributes */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
33298
33299
  case 14 /* JsxChildren */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
33299
- default: return [undefined]; // TODO: GH#18217 `default: Debug.assertNever(context);`
33300
+ case 24 /* AssertEntries */: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected); // AssertionKey.
33301
+ case 25 /* Count */: return ts.Debug.fail("ParsingContext.Count used as a context"); // Not a real context, only a marker.
33302
+ default: ts.Debug.assertNever(context);
33300
33303
  }
33301
33304
  }
33302
33305
  function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
@@ -33737,7 +33740,7 @@ var ts;
33737
33740
  // FormalParameter [Yield,Await]:
33738
33741
  // BindingElement[?Yield,?Await]
33739
33742
  // Decorators are parsed in the outer [Await] context, the rest of the parameter is parsed in the function's [Await] context.
33740
- var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
33743
+ var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators);
33741
33744
  if (token() === 108 /* ThisKeyword */) {
33742
33745
  var node_1 = factory.createParameterDeclaration(decorators,
33743
33746
  /*dotDotDotToken*/ undefined, createIdentifier(/*isIdentifier*/ true),
@@ -67928,37 +67931,33 @@ var ts;
67928
67931
  var commonBaseType;
67929
67932
  for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
67930
67933
  var t = types_13[_i];
67931
- var baseType = getBaseTypeOfLiteralType(t);
67932
- if (!commonBaseType) {
67933
- commonBaseType = baseType;
67934
- }
67935
- if (baseType === t || baseType !== commonBaseType) {
67936
- return false;
67934
+ if (!(t.flags & 131072 /* Never */)) {
67935
+ var baseType = getBaseTypeOfLiteralType(t);
67936
+ commonBaseType !== null && commonBaseType !== void 0 ? commonBaseType : (commonBaseType = baseType);
67937
+ if (baseType === t || baseType !== commonBaseType) {
67938
+ return false;
67939
+ }
67937
67940
  }
67938
67941
  }
67939
67942
  return true;
67940
67943
  }
67941
- // When the candidate types are all literal types with the same base type, return a union
67942
- // of those literal types. Otherwise, return the leftmost type for which no type to the
67943
- // right is a supertype.
67944
- function getSupertypeOrUnion(types) {
67945
- if (types.length === 1) {
67946
- return types[0];
67947
- }
67948
- return literalTypesWithSameBaseType(types) ?
67949
- getUnionType(types) :
67950
- ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
67944
+ function getCombinedTypeFlags(types) {
67945
+ return ts.reduceLeft(types, function (flags, t) { return flags | (t.flags & 1048576 /* Union */ ? getCombinedTypeFlags(t.types) : t.flags); }, 0);
67951
67946
  }
67952
67947
  function getCommonSupertype(types) {
67953
- if (!strictNullChecks) {
67954
- return getSupertypeOrUnion(types);
67955
- }
67956
- var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304 /* Nullable */); });
67957
- if (primaryTypes.length) {
67958
- var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
67959
- return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304 /* Nullable */); }), true));
67948
+ if (types.length === 1) {
67949
+ return types[0];
67960
67950
  }
67961
- return getUnionType(types, 2 /* Subtype */);
67951
+ // Remove nullable types from each of the candidates.
67952
+ var primaryTypes = strictNullChecks ? ts.sameMap(types, function (t) { return filterType(t, function (u) { return !(u.flags & 98304 /* Nullable */); }); }) : types;
67953
+ // When the candidate types are all literal types with the same base type, return a union
67954
+ // of those literal types. Otherwise, return the leftmost type for which no type to the
67955
+ // right is a supertype.
67956
+ var superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ?
67957
+ getUnionType(primaryTypes) :
67958
+ ts.reduceLeft(primaryTypes, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
67959
+ // Add any nullable types that occurred in the candidates back to the result.
67960
+ return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304 /* Nullable */);
67962
67961
  }
67963
67962
  // Return the leftmost type for which no type to the right is a subtype.
67964
67963
  function getCommonSubtype(types) {
@@ -71932,8 +71931,12 @@ var ts;
71932
71931
  var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
71933
71932
  var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
71934
71933
  // For each constituent t in the current type, if t and and c are directly related, pick the most
71935
- // specific of the two.
71936
- var directlyRelated = mapType(matching || type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
71934
+ // specific of the two. When t and c are related in both directions, we prefer c for type predicates
71935
+ // because that is the asserted type, but t for `instanceof` because generics aren't reflected in
71936
+ // prototype object types.
71937
+ var directlyRelated = mapType(matching || type, checkDerived ?
71938
+ function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
71939
+ function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
71937
71940
  // If no constituents are directly related, create intersections for any generic constituents that
71938
71941
  // are related by constraint.
71939
71942
  return directlyRelated.flags & 131072 /* Never */ ?
@@ -90552,7 +90555,7 @@ var ts;
90552
90555
  return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine);
90553
90556
  case 197 /* NamedTupleMember */:
90554
90557
  ts.Debug.type(node);
90555
- return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, visitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, visitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
90558
+ return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
90556
90559
  case 191 /* ParenthesizedType */:
90557
90560
  ts.Debug.type(node);
90558
90561
  return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
@@ -226,6 +226,7 @@
226
226
  "An_index_signature_parameter_must_have_a_type_annotation_1022": "索引签名参数必须具有类型批注。",
227
227
  "An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337": "索引签名参数类型不能为文本类型或泛型类型。请考虑改用映射的对象类型。",
228
228
  "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268": "索引签名参数类型必须是 “string”、“number”、“symbol”或模板文本类型。",
229
+ "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477": "实例化表达式不能后跟属性访问。",
229
230
  "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499": "接口只能扩展具有可选类型参数的标识符/限定名称。",
230
231
  "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312": "接口只能扩展使用静态已知成员的对象类型或对象类型的交集。",
231
232
  "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840": "接口无法扩展基元类型,如“{0}”;接口只能扩展命名类型和类",
@@ -1561,6 +1562,7 @@
1561
1562
  "Type_library_referenced_via_0_from_file_1_with_packageId_2_1403": "通过 \"{0}\" 从具有 packageId \"{2}\" 的文件 \"{1}\" 引用了库类型",
1562
1563
  "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "\"await\" 操作数的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。",
1563
1564
  "Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418": "计算属性类型的值为 \"{0}\",该值不能赋给 \"{1}\" 类型。",
1565
+ "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844": "实例成员变量“{0}”的类型不能引用构造函数中声明的标识符“{1}”。",
1564
1566
  "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "\"yield*\" 操作数的迭代元素的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。",
1565
1567
  "Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615": "属性“{0}”的类型在已映射的类型“{1}”中循环引用其自身。",
1566
1568
  "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "异步生成器中 \"yield\" 操作数的类型必须是有效承诺,或不得包含可调用的 \"then\" 成员。",
@@ -226,6 +226,7 @@
226
226
  "An_index_signature_parameter_must_have_a_type_annotation_1022": "索引簽章參數必須有類型註釋。",
227
227
  "An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_o_1337": "索引簽章參數類型不能是常值型別或泛型型別。請考慮改用對應的物件類型。",
228
228
  "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268": "索引簽章參數類型必須是 'string'、'number'、'symbol' 或範本文字類型。",
229
+ "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477": "具現化運算式後面不能接著屬性存取。",
229
230
  "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499": "介面只能擴充具有選擇性型別引數的識別碼/限定名稱。",
230
231
  "An_interface_can_only_extend_an_object_type_or_intersection_of_object_types_with_statically_known_me_2312": "介面只能延伸物件類型或具有靜態已知成員的物件類型交集。",
231
232
  "An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_clas_2840": "介面無法延伸基本類型,例如 '{0}';介面只能延伸命名類型和類別",
@@ -1561,6 +1562,7 @@
1561
1562
  "Type_library_referenced_via_0_from_file_1_with_packageId_2_1403": "透過 '{0}' 從檔案 '{1}' (packageId 為 '{2}') 參考的型別程式庫",
1562
1563
  "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320": "'await' 運算元類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。",
1563
1564
  "Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1_2418": "已計算屬性值的類型為 '{0}',其無法指派給類型 '{1}'。",
1565
+ "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844": "執行個體成員變數 '{0}' 的類型不得參考建構函式中所宣告的識別碼 '{1}'。",
1564
1566
  "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322": "'yield*' 運算元的反覆項目類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。",
1565
1567
  "Type_of_property_0_circularly_references_itself_in_mapped_type_1_2615": "屬性 '{0}' 的類型在對應的類型 '{1}' 中會循環參考自己。",
1566
1568
  "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321": "非同步產生器中的 'yield' 運算元類型必須是有效的 Promise,或不得包含可呼叫的 'then' 成員。",
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.20220724",
5
+ "version": "4.8.0-dev.20220727",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [