@typescript-deploys/pr-build 4.6.0-pr-47050-2 → 4.6.0-pr-47078-3

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.6";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20211208";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20211209";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -19678,7 +19678,7 @@ var ts;
19678
19678
  }
19679
19679
  function createAssertClause(elements, multiLine) {
19680
19680
  var node = createBaseNode(292);
19681
- node.elements = elements;
19681
+ node.elements = createNodeArray(elements);
19682
19682
  node.multiLine = multiLine;
19683
19683
  node.transformFlags |= 4;
19684
19684
  return node;
@@ -44584,7 +44584,24 @@ var ts;
44584
44584
  return mapType(source, function (t) { return getRestType(t, properties, symbol); });
44585
44585
  }
44586
44586
  var omitKeyType = getUnionType(ts.map(properties, getLiteralTypeFromPropertyName));
44587
+ var spreadableProperties = [];
44588
+ var unspreadableToRestKeys = [];
44589
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
44590
+ var prop = _a[_i];
44591
+ var literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576);
44592
+ if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType)
44593
+ && !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))
44594
+ && isSpreadableProperty(prop)) {
44595
+ spreadableProperties.push(prop);
44596
+ }
44597
+ else {
44598
+ unspreadableToRestKeys.push(literalTypeFromProperty);
44599
+ }
44600
+ }
44587
44601
  if (isGenericObjectType(source) || isGenericIndexType(omitKeyType)) {
44602
+ if (unspreadableToRestKeys.length) {
44603
+ omitKeyType = getUnionType(__spreadArray([omitKeyType], unspreadableToRestKeys, true));
44604
+ }
44588
44605
  if (omitKeyType.flags & 131072) {
44589
44606
  return source;
44590
44607
  }
@@ -44595,13 +44612,9 @@ var ts;
44595
44612
  return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
44596
44613
  }
44597
44614
  var members = ts.createSymbolTable();
44598
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
44599
- var prop = _a[_i];
44600
- if (!isTypeAssignableTo(getLiteralTypeFromProperty(prop, 8576), omitKeyType)
44601
- && !(ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16))
44602
- && isSpreadableProperty(prop)) {
44603
- members.set(prop.escapedName, getSpreadSymbol(prop, false));
44604
- }
44615
+ for (var _b = 0, spreadableProperties_1 = spreadableProperties; _b < spreadableProperties_1.length; _b++) {
44616
+ var prop = spreadableProperties_1[_b];
44617
+ members.set(prop.escapedName, getSpreadSymbol(prop, false));
44605
44618
  }
44606
44619
  var result = createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, getIndexInfosOfType(source));
44607
44620
  result.objectFlags |= 8388608;
@@ -47441,7 +47454,7 @@ var ts;
47441
47454
  }
47442
47455
  if (t.flags & 268435456) {
47443
47456
  var constraint = getBaseConstraint(t.type);
47444
- return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
47457
+ return constraint ? getStringMappingType(t.symbol, constraint) : stringType;
47445
47458
  }
47446
47459
  if (t.flags & 8388608) {
47447
47460
  var baseObjectType = getBaseConstraint(t.objectType);
@@ -49990,11 +50003,9 @@ var ts;
49990
50003
  }
49991
50004
  function getStringMappingType(symbol, type) {
49992
50005
  return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) :
49993
- type.flags & 268435456 && symbol === type.symbol ? type :
49994
- isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) :
49995
- type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
49996
- type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) :
49997
- type;
50006
+ isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) :
50007
+ type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) :
50008
+ type;
49998
50009
  }
49999
50010
  function applyStringMapping(symbol, str) {
50000
50011
  switch (intrinsicTypeKinds.get(symbol.escapedName)) {
@@ -50005,15 +50016,6 @@ var ts;
50005
50016
  }
50006
50017
  return str;
50007
50018
  }
50008
- function applyTemplateStringMapping(symbol, texts, types) {
50009
- switch (intrinsicTypeKinds.get(symbol.escapedName)) {
50010
- case 0: return [texts.map(function (t) { return t.toUpperCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
50011
- case 1: return [texts.map(function (t) { return t.toLowerCase(); }), types.map(function (t) { return getStringMappingType(symbol, t); })];
50012
- case 2: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toUpperCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
50013
- case 3: return [texts[0] === "" ? texts : __spreadArray([texts[0].charAt(0).toLowerCase() + texts[0].slice(1)], texts.slice(1), true), texts[0] === "" ? __spreadArray([getStringMappingType(symbol, types[0])], types.slice(1), true) : types];
50014
- }
50015
- return [texts, types];
50016
- }
50017
50019
  function getStringMappingTypeForGenericType(symbol, type) {
50018
50020
  var id = getSymbolId(symbol) + "," + getTypeId(type);
50019
50021
  var result = stringMappingTypes.get(id);
@@ -50243,7 +50245,7 @@ var ts;
50243
50245
  accessNode;
50244
50246
  }
50245
50247
  function isPatternLiteralPlaceholderType(type) {
50246
- return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type));
50248
+ return !!(type.flags & (1 | 4 | 8 | 64));
50247
50249
  }
50248
50250
  function isPatternLiteralType(type) {
50249
50251
  return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType);
@@ -53369,13 +53371,6 @@ var ts;
53369
53371
  return -1;
53370
53372
  }
53371
53373
  }
53372
- else if (target.flags & 268435456) {
53373
- if (!(source.flags & 268435456)) {
53374
- if (isUnchangedByStringMapping(target.symbol, source)) {
53375
- return -1;
53376
- }
53377
- }
53378
- }
53379
53374
  if (source.flags & 8650752) {
53380
53375
  if (!(source.flags & 8388608 && target.flags & 8388608)) {
53381
53376
  var constraint = getConstraintOfType(source);
@@ -53411,10 +53406,7 @@ var ts;
53411
53406
  }
53412
53407
  }
53413
53408
  else if (source.flags & 268435456) {
53414
- if (target.flags & 268435456) {
53415
- if (source.symbol !== target.symbol) {
53416
- return 0;
53417
- }
53409
+ if (target.flags & 268435456 && source.symbol === target.symbol) {
53418
53410
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
53419
53411
  resetErrorInfo(saveErrorInfo);
53420
53412
  return result;
@@ -54188,7 +54180,7 @@ var ts;
54188
54180
  return typeCouldHaveTopLevelSingletonTypes(constraint);
54189
54181
  }
54190
54182
  }
54191
- return isUnitType(type) || !!(type.flags & 134217728) || !!(type.flags & 268435456);
54183
+ return isUnitType(type) || !!(type.flags & 134217728);
54192
54184
  }
54193
54185
  function getExactOptionalUnassignableProperties(source, target) {
54194
54186
  if (isTupleType(source) && isTupleType(target))
@@ -55415,9 +55407,6 @@ var ts;
55415
55407
  var flags = scanner.getTokenFlags();
55416
55408
  return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512);
55417
55409
  }
55418
- function isUnchangedByStringMapping(symbol, value) {
55419
- return value === getStringMappingType(symbol, value);
55420
- }
55421
55410
  function isValidTypeForTemplateLiteralPlaceholder(source, target) {
55422
55411
  if (source === target || target.flags & (1 | 4)) {
55423
55412
  return true;
@@ -55426,8 +55415,7 @@ var ts;
55426
55415
  var value = source.value;
55427
55416
  return !!(target.flags & 8 && value !== "" && isFinite(+value) ||
55428
55417
  target.flags & 64 && value !== "" && isValidBigIntString(value) ||
55429
- target.flags & (512 | 98304) && value === target.intrinsicName ||
55430
- target.flags & 268435456 && isUnchangedByStringMapping(target.symbol, getStringLiteralType(value)));
55418
+ target.flags & (512 | 98304) && value === target.intrinsicName);
55431
55419
  }
55432
55420
  if (source.flags & 134217728) {
55433
55421
  var texts = source.texts;
@@ -62158,7 +62146,7 @@ var ts;
62158
62146
  typeArguments.pop();
62159
62147
  }
62160
62148
  while (typeArguments.length < typeParameters.length) {
62161
- typeArguments.push(getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
62149
+ typeArguments.push(getDefaultFromTypeParameter(typeParameters[typeArguments.length]) || getConstraintOfTypeParameter(typeParameters[typeArguments.length]) || getDefaultTypeArgumentType(isJs));
62162
62150
  }
62163
62151
  return typeArguments;
62164
62152
  }
@@ -62704,8 +62692,7 @@ var ts;
62704
62692
  }
62705
62693
  function checkCallExpression(node, checkMode) {
62706
62694
  var _a;
62707
- if (!checkGrammarTypeArguments(node, node.typeArguments))
62708
- checkGrammarArguments(node.arguments);
62695
+ checkGrammarTypeArguments(node, node.typeArguments);
62709
62696
  var signature = getResolvedSignature(node, undefined, checkMode);
62710
62697
  if (signature === resolvingSignature) {
62711
62698
  return nonInferrableType;
@@ -62802,8 +62789,7 @@ var ts;
62802
62789
  return globalESSymbol === resolveName(left, "Symbol", 111551, undefined, undefined, false);
62803
62790
  }
62804
62791
  function checkImportCallExpression(node) {
62805
- if (!checkGrammarArguments(node.arguments))
62806
- checkGrammarImportCallExpression(node);
62792
+ checkGrammarImportCallExpression(node);
62807
62793
  if (node.arguments.length === 0) {
62808
62794
  return createPromiseReturnType(node, anyType);
62809
62795
  }
@@ -72086,20 +72072,6 @@ var ts;
72086
72072
  }
72087
72073
  return false;
72088
72074
  }
72089
- function checkGrammarForOmittedArgument(args) {
72090
- if (args) {
72091
- for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
72092
- var arg = args_4[_i];
72093
- if (arg.kind === 226) {
72094
- return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
72095
- }
72096
- }
72097
- }
72098
- return false;
72099
- }
72100
- function checkGrammarArguments(args) {
72101
- return checkGrammarForOmittedArgument(args);
72102
- }
72103
72075
  function checkGrammarHeritageClause(node) {
72104
72076
  var types = node.types;
72105
72077
  if (checkGrammarForDisallowedTrailingComma(types)) {
@@ -84670,7 +84642,7 @@ var ts;
84670
84642
  if (ts.isIdentifier(node.expression)) {
84671
84643
  var expression = substituteExpressionIdentifier(node.expression);
84672
84644
  noSubstitution[ts.getNodeId(expression)] = true;
84673
- if (!ts.isIdentifier(expression)) {
84645
+ if (!ts.isIdentifier(expression) && !(ts.getEmitFlags(node.expression) & 4096)) {
84674
84646
  return ts.addEmitFlags(factory.updateCallExpression(node, expression, undefined, node.arguments), 536870912);
84675
84647
  }
84676
84648
  }
@@ -84680,7 +84652,7 @@ var ts;
84680
84652
  if (ts.isIdentifier(node.tag)) {
84681
84653
  var tag = substituteExpressionIdentifier(node.tag);
84682
84654
  noSubstitution[ts.getNodeId(tag)] = true;
84683
- if (!ts.isIdentifier(tag)) {
84655
+ if (!ts.isIdentifier(tag) && !(ts.getEmitFlags(node.tag) & 4096)) {
84684
84656
  return ts.addEmitFlags(factory.updateTaggedTemplateExpression(node, tag, undefined, node.template), 536870912);
84685
84657
  }
84686
84658
  }
@@ -93775,6 +93747,80 @@ var ts;
93775
93747
  ts.Diagnostics.A_label_is_not_allowed_here.code,
93776
93748
  ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
93777
93749
  ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
93750
+ ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code,
93751
+ ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement.code,
93752
+ ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name.code,
93753
+ ts.Diagnostics.A_class_member_cannot_have_the_0_keyword.code,
93754
+ ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name.code,
93755
+ ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement.code,
93756
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
93757
+ ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement.code,
93758
+ ts.Diagnostics.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement.code,
93759
+ ts.Diagnostics.A_default_export_must_be_at_the_top_level_of_a_file_or_module_declaration.code,
93760
+ ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context.code,
93761
+ ts.Diagnostics.A_destructuring_declaration_must_have_an_initializer.code,
93762
+ ts.Diagnostics.A_get_accessor_cannot_have_parameters.code,
93763
+ ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern.code,
93764
+ ts.Diagnostics.A_rest_element_cannot_have_a_property_name.code,
93765
+ ts.Diagnostics.A_rest_element_cannot_have_an_initializer.code,
93766
+ ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern.code,
93767
+ ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
93768
+ ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
93769
+ ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
93770
+ ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
93771
+ ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
93772
+ ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
93773
+ ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
93774
+ ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module.code,
93775
+ ts.Diagnostics.An_export_declaration_cannot_have_modifiers.code,
93776
+ ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module.code,
93777
+ ts.Diagnostics.An_import_declaration_cannot_have_modifiers.code,
93778
+ ts.Diagnostics.An_object_member_cannot_be_declared_optional.code,
93779
+ ts.Diagnostics.Argument_of_dynamic_import_cannot_be_spread_element.code,
93780
+ ts.Diagnostics.Cannot_assign_to_private_method_0_Private_methods_are_not_writable.code,
93781
+ ts.Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause.code,
93782
+ ts.Diagnostics.Catch_clause_variable_cannot_have_an_initializer.code,
93783
+ ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator.code,
93784
+ ts.Diagnostics.Classes_can_only_extend_a_single_class.code,
93785
+ ts.Diagnostics.Classes_may_not_have_a_field_named_constructor.code,
93786
+ ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code,
93787
+ ts.Diagnostics.Duplicate_label_0.code,
93788
+ ts.Diagnostics.Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments.code,
93789
+ ts.Diagnostics.For_await_loops_cannot_be_used_inside_a_class_static_block.code,
93790
+ ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression.code,
93791
+ ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name.code,
93792
+ ts.Diagnostics.JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array.code,
93793
+ ts.Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names.code,
93794
+ ts.Diagnostics.Jump_target_cannot_cross_function_boundary.code,
93795
+ ts.Diagnostics.Line_terminator_not_permitted_before_arrow.code,
93796
+ ts.Diagnostics.Modifiers_cannot_appear_here.code,
93797
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement.code,
93798
+ ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement.code,
93799
+ ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies.code,
93800
+ ts.Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
93801
+ ts.Diagnostics.Property_0_is_not_accessible_outside_class_1_because_it_has_a_private_identifier.code,
93802
+ ts.Diagnostics.Tagged_template_expressions_are_not_permitted_in_an_optional_chain.code,
93803
+ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async.code,
93804
+ ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer.code,
93805
+ ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer.code,
93806
+ ts.Diagnostics.Trailing_comma_not_allowed.code,
93807
+ ts.Diagnostics.Variable_declaration_list_cannot_be_empty.code,
93808
+ ts.Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses.code,
93809
+ ts.Diagnostics._0_expected.code,
93810
+ ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2.code,
93811
+ ts.Diagnostics._0_list_cannot_be_empty.code,
93812
+ ts.Diagnostics._0_modifier_already_seen.code,
93813
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration.code,
93814
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element.code,
93815
+ ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter.code,
93816
+ ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind.code,
93817
+ ts.Diagnostics._0_modifier_cannot_be_used_here.code,
93818
+ ts.Diagnostics._0_modifier_must_precede_1_modifier.code,
93819
+ ts.Diagnostics.const_declarations_can_only_be_declared_inside_a_block.code,
93820
+ ts.Diagnostics.const_declarations_must_be_initialized.code,
93821
+ ts.Diagnostics.extends_clause_already_seen.code,
93822
+ ts.Diagnostics.let_declarations_can_only_be_declared_inside_a_block.code,
93823
+ ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
93778
93824
  ]);
93779
93825
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
93780
93826
  if (!program)
@@ -94630,9 +94676,10 @@ var ts;
94630
94676
  var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 || sourceFile.scriptKind === 4
94631
94677
  || sourceFile.scriptKind === 5 || isPlainJs || isCheckJs || sourceFile.scriptKind === 7);
94632
94678
  var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
94633
- var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94679
+ var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
94634
94680
  if (isPlainJs) {
94635
94681
  bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
94682
+ checkDiagnostics = ts.filter(checkDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
94636
94683
  }
94637
94684
  return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
94638
94685
  });