typescript 4.9.0-dev.20220919 → 4.9.0-dev.20220920

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.
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220919");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220920");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -2683,7 +2683,7 @@ var ts;
2683
2683
  if (typeof func !== "function") {
2684
2684
  return "";
2685
2685
  }
2686
- else if (func.hasOwnProperty("name")) {
2686
+ else if (ts.hasProperty(func, "name")) {
2687
2687
  return func.name;
2688
2688
  }
2689
2689
  else {
@@ -3008,7 +3008,7 @@ var ts;
3008
3008
  ];
3009
3009
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3010
3010
  var ctor = nodeConstructors_1[_i];
3011
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
3011
+ if (!ts.hasProperty(ctor, "__debugKind")) {
3012
3012
  Object.defineProperties(ctor.prototype, {
3013
3013
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3014
3014
  __tsDebuggerDisplay: {
@@ -3863,7 +3863,6 @@ var ts;
3863
3863
  var typeCatalog = []; // NB: id is index + 1
3864
3864
  var legendPath;
3865
3865
  var legend = [];
3866
- ;
3867
3866
  /** Starts tracing for the given project. */
3868
3867
  function startTracing(tracingMode, traceDir, configFilePath) {
3869
3868
  ts.Debug.assert(!ts.tracing, "Tracing already started");
@@ -8695,8 +8694,6 @@ var ts;
8695
8694
  The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."),
8696
8695
  The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."),
8697
8696
  The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."),
8698
- The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."),
8699
- The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."),
8700
8697
  The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
8701
8698
  The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."),
8702
8699
  The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."),
@@ -8945,6 +8942,7 @@ var ts;
8945
8942
  Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
8946
8943
  Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
8947
8944
  Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
8945
+ Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."),
8948
8946
  Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
8949
8947
  A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
8950
8948
  Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
@@ -10328,7 +10326,7 @@ var ts;
10328
10326
  ts.stringToToken = stringToToken;
10329
10327
  /* @internal */
10330
10328
  function computeLineStarts(text) {
10331
- var result = new Array();
10329
+ var result = [];
10332
10330
  var pos = 0;
10333
10331
  var lineStart = 0;
10334
10332
  while (pos < text.length) {
@@ -13461,7 +13459,7 @@ var ts;
13461
13459
  // Node Arrays
13462
13460
  /* @internal */
13463
13461
  function isNodeArray(array) {
13464
- return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
13462
+ return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
13465
13463
  }
13466
13464
  ts.isNodeArray = isNodeArray;
13467
13465
  // Literals
@@ -14933,7 +14931,6 @@ var ts;
14933
14931
  return emitNode && emitNode.flags || 0;
14934
14932
  }
14935
14933
  ts.getEmitFlags = getEmitFlags;
14936
- ;
14937
14934
  function getScriptTargetFeatures() {
14938
14935
  return {
14939
14936
  es2015: {
@@ -19659,7 +19656,7 @@ var ts;
19659
19656
  }
19660
19657
  function isWatchSet(options) {
19661
19658
  // Firefox has Object.prototype.watch
19662
- return options.watch && options.hasOwnProperty("watch");
19659
+ return options.watch && ts.hasProperty(options, "watch");
19663
19660
  }
19664
19661
  ts.isWatchSet = isWatchSet;
19665
19662
  function closeFileWatcher(watcher) {
@@ -26944,7 +26941,7 @@ var ts;
26944
26941
  clone.transformFlags = node.transformFlags;
26945
26942
  setOriginalNode(clone, node);
26946
26943
  for (var key in node) {
26947
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26944
+ if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
26948
26945
  continue;
26949
26946
  }
26950
26947
  clone[key] = node[key];
@@ -31832,7 +31829,6 @@ var ts;
31832
31829
  visitNodes(cbNode, cbNodes, node.parameters) ||
31833
31830
  visitNode(cbNode, node.type);
31834
31831
  }
31835
- ;
31836
31832
  function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
31837
31833
  return visitNodes(cbNode, cbNodes, node.types);
31838
31834
  }
@@ -43148,7 +43144,7 @@ var ts;
43148
43144
  function convertCompilerOptionsForTelemetry(opts) {
43149
43145
  var out = {};
43150
43146
  for (var key in opts) {
43151
- if (opts.hasOwnProperty(key)) {
43147
+ if (ts.hasProperty(opts, key)) {
43152
43148
  var type = getOptionFromName(key);
43153
43149
  if (type !== undefined) { // Ignore unknown options
43154
43150
  out[key] = getOptionValueWithEmptyStrings(opts[key], type);
@@ -49652,7 +49648,8 @@ var ts;
49652
49648
  var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
49653
49649
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
49654
49650
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49655
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
49651
+ var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49652
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
49656
49653
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49657
49654
  emptyGenericType.instantiations = new ts.Map();
49658
49655
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -49766,6 +49763,7 @@ var ts;
49766
49763
  var deferredGlobalOmitSymbol;
49767
49764
  var deferredGlobalAwaitedSymbol;
49768
49765
  var deferredGlobalBigIntType;
49766
+ var deferredGlobalRecordSymbol;
49769
49767
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49770
49768
  var flowLoopStart = 0;
49771
49769
  var flowLoopCount = 0;
@@ -50561,12 +50559,13 @@ var ts;
50561
50559
  * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
50562
50560
  * the given name can be found.
50563
50561
  *
50562
+ * @param nameNotFoundMessage If defined, we will report errors found during resolve.
50564
50563
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
50565
50564
  */
50566
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
50565
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
50567
50566
  if (excludeGlobals === void 0) { excludeGlobals = false; }
50568
- if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
50569
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
50567
+ if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
50568
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
50570
50569
  }
50571
50570
  function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50572
50571
  var _a, _b, _c;
@@ -50724,7 +50723,9 @@ var ts;
50724
50723
  // TypeScript 1.0 spec (April 2014): 3.4.1
50725
50724
  // The scope of a type parameter extends over the entire declaration with which the type
50726
50725
  // parameter list is associated, with the exception of static member declarations in classes.
50727
- error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50726
+ if (nameNotFoundMessage) {
50727
+ error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50728
+ }
50728
50729
  return undefined;
50729
50730
  }
50730
50731
  break loop;
@@ -50762,7 +50763,9 @@ var ts;
50762
50763
  if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
50763
50764
  // A reference to this grandparent's type parameters would be an error
50764
50765
  if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
50765
- error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50766
+ if (nameNotFoundMessage) {
50767
+ error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50768
+ }
50766
50769
  return undefined;
50767
50770
  }
50768
50771
  }
@@ -50958,7 +50961,7 @@ var ts;
50958
50961
  }
50959
50962
  return undefined;
50960
50963
  }
50961
- else if (checkAndReportErrorForInvalidInitializer()) {
50964
+ else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50962
50965
  return undefined;
50963
50966
  }
50964
50967
  // Perform extra checks only if error reporting was requested
@@ -57119,7 +57122,6 @@ var ts;
57119
57122
  return container;
57120
57123
  }
57121
57124
  }
57122
- ;
57123
57125
  }
57124
57126
  /** Create a synthetic property access flow node after the last statement of the file */
57125
57127
  function getFlowTypeFromCommonJSExport(symbol) {
@@ -61865,6 +61867,10 @@ var ts;
61865
61867
  function getGlobalBigIntType() {
61866
61868
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61867
61869
  }
61870
+ function getGlobalRecordSymbol() {
61871
+ deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61872
+ return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
61873
+ }
61868
61874
  /**
61869
61875
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61870
61876
  */
@@ -72181,18 +72187,26 @@ var ts;
72181
72187
  }
72182
72188
  function isTypePresencePossible(type, propName, assumeTrue) {
72183
72189
  var prop = getPropertyOfType(type, propName);
72184
- if (prop) {
72185
- return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
72186
- }
72187
- return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
72188
- }
72189
- function narrowByInKeyword(type, name, assumeTrue) {
72190
- if (type.flags & 1048576 /* TypeFlags.Union */
72191
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
72192
- || ts.isThisTypeParameter(type)
72193
- || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
72190
+ return prop ?
72191
+ !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72192
+ !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72193
+ }
72194
+ function narrowByInKeyword(type, nameType, assumeTrue) {
72195
+ var name = getPropertyNameFromType(nameType);
72196
+ var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72197
+ if (isKnownProperty) {
72198
+ // If the check is for a known property (i.e. a property declared in some constituent of
72199
+ // the target type), we filter the target type by presence of absence of the property.
72194
72200
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
72195
72201
  }
72202
+ if (assumeTrue) {
72203
+ // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
72204
+ // where X is the name of the property.
72205
+ var recordSymbol = getGlobalRecordSymbol();
72206
+ if (recordSymbol) {
72207
+ return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
72208
+ }
72209
+ }
72196
72210
  return type;
72197
72211
  }
72198
72212
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -72251,15 +72265,14 @@ var ts;
72251
72265
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
72252
72266
  }
72253
72267
  var target = getReferenceCandidate(expr.right);
72254
- var leftType = getTypeOfNode(expr.left);
72255
- if (leftType.flags & 128 /* TypeFlags.StringLiteral */) {
72256
- var name = ts.escapeLeadingUnderscores(leftType.value);
72268
+ var leftType = getTypeOfExpression(expr.left);
72269
+ if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
72257
72270
  if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
72258
- getAccessedPropertyName(reference) === name) {
72271
+ getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
72259
72272
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72260
72273
  }
72261
72274
  if (isMatchingReference(reference, target)) {
72262
- return narrowByInKeyword(type, name, assumeTrue);
72275
+ return narrowByInKeyword(type, leftType, assumeTrue);
72263
72276
  }
72264
72277
  }
72265
72278
  break;
@@ -76429,7 +76442,6 @@ var ts;
76429
76442
  }
76430
76443
  return false;
76431
76444
  }
76432
- ;
76433
76445
  var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
76434
76446
  if (!hasProp(suggestedMethod)) {
76435
76447
  return undefined;
@@ -80000,6 +80012,9 @@ var ts;
80000
80012
  }
80001
80013
  return booleanType;
80002
80014
  }
80015
+ function hasEmptyObjectIntersection(type) {
80016
+ return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
80017
+ }
80003
80018
  function checkInExpression(left, right, leftType, rightType) {
80004
80019
  if (leftType === silentNeverType || rightType === silentNeverType) {
80005
80020
  return silentNeverType;
@@ -80016,40 +80031,20 @@ var ts;
80016
80031
  }
80017
80032
  }
80018
80033
  else {
80019
- leftType = checkNonNullType(leftType, left);
80020
- // TypeScript 1.0 spec (April 2014): 4.15.5
80021
- // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
80022
- if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
80023
- isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
80024
- error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol);
80034
+ // The type of the lef operand must be assignable to string, number, or symbol.
80035
+ checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
80036
+ }
80037
+ // The type of the right operand must be assignable to 'object'.
80038
+ if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
80039
+ // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
80040
+ // detect and error on {} that results from narrowing the unknown type, as well as intersections
80041
+ // that include {} (we know that the other types in such intersections are assignable to object
80042
+ // since we already checked for that).
80043
+ if (hasEmptyObjectIntersection(rightType)) {
80044
+ error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType));
80025
80045
  }
80026
80046
  }
80027
- rightType = checkNonNullType(rightType, right);
80028
- // TypeScript 1.0 spec (April 2014): 4.15.5
80029
- // The in operator requires the right operand to be
80030
- //
80031
- // 1. assignable to the non-primitive type,
80032
- // 2. an unconstrained type parameter,
80033
- // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
80034
- // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
80035
- // non-primitive type, or
80036
- // 4. a type parameter whose constraint is
80037
- // i. an object type,
80038
- // ii. the non-primitive type, or
80039
- // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
80040
- //
80041
- // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
80042
- // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
80043
- // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
80044
- // unless *all* instantiations would result in an error.
80045
- //
80046
80047
  // The result is always of the Boolean primitive type.
80047
- var rightTypeConstraint = getConstraintOfType(rightType);
80048
- if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80049
- rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80050
- !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
80051
- error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
80052
- }
80053
80048
  return booleanType;
80054
80049
  }
80055
80050
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -88491,7 +88486,7 @@ var ts;
88491
88486
  }
88492
88487
  var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
88493
88488
  if (node) {
88494
- var symbol = getReferencedValueSymbol(node);
88489
+ var symbol = getReferencedValueOrAliasSymbol(node);
88495
88490
  // We should only get the declaration of an alias if there isn't a local value
88496
88491
  // declaration for the symbol
88497
88492
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -88858,6 +88853,25 @@ var ts;
88858
88853
  }
88859
88854
  return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
88860
88855
  }
88856
+ /**
88857
+ * Get either a value-meaning symbol or an alias symbol.
88858
+ * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
88859
+ * we call `resolveName` to find a symbol.
88860
+ * This is because when caching the resolved symbol, we only consider value symbols, but here
88861
+ * we want to also get an alias symbol if one exists.
88862
+ */
88863
+ function getReferencedValueOrAliasSymbol(reference) {
88864
+ var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
88865
+ if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
88866
+ return resolvedSymbol;
88867
+ }
88868
+ return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
88869
+ /*nodeNotFoundMessage*/ undefined,
88870
+ /*nameArg*/ undefined,
88871
+ /*isUse*/ true,
88872
+ /*excludeGlobals*/ undefined,
88873
+ /*getSpellingSuggestions*/ undefined);
88874
+ }
88861
88875
  function getReferencedValueDeclaration(referenceIn) {
88862
88876
  if (!ts.isGeneratedIdentifier(referenceIn)) {
88863
88877
  var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
@@ -95307,9 +95321,10 @@ var ts;
95307
95321
  return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
95308
95322
  }
95309
95323
  function shouldEmitAliasDeclaration(node) {
95310
- return compilerOptions.preserveValueImports
95311
- ? resolver.isValueAliasDeclaration(node)
95312
- : resolver.isReferencedAliasDeclaration(node);
95324
+ return ts.isInJSFile(node) ||
95325
+ (compilerOptions.preserveValueImports
95326
+ ? resolver.isValueAliasDeclaration(node)
95327
+ : resolver.isReferencedAliasDeclaration(node));
95313
95328
  }
95314
95329
  }
95315
95330
  ts.transformTypeScript = transformTypeScript;
@@ -110481,7 +110496,7 @@ var ts;
110481
110496
  var _a;
110482
110497
  var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
110483
110498
  var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
110484
- if (augmentingDeclarations) {
110499
+ if (primaryDeclaration && augmentingDeclarations) {
110485
110500
  for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
110486
110501
  var augmentations = augmentingDeclarations_1[_i];
110487
110502
  context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file)));
@@ -118530,7 +118545,6 @@ var ts;
118530
118545
  return resolutions;
118531
118546
  }
118532
118547
  ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
118533
- ;
118534
118548
  /**
118535
118549
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
118536
118550
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
@@ -135026,7 +135040,7 @@ var ts;
135026
135040
  if (!dependencies)
135027
135041
  continue;
135028
135042
  for (var dep in dependencies) {
135029
- if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
135043
+ if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
135030
135044
  result.push(dep);
135031
135045
  }
135032
135046
  }
@@ -135879,7 +135893,6 @@ var ts;
135879
135893
  var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
135880
135894
  return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
135881
135895
  }
135882
- ;
135883
135896
  function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
135884
135897
  var declarations = symbol.getDeclarations();
135885
135898
  if (!(declarations && declarations.length)) {
@@ -138583,7 +138596,6 @@ var ts;
138583
138596
  function isArrowFunctionBody(node) {
138584
138597
  return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
138585
138598
  }
138586
- ;
138587
138599
  /** True if symbol is a type or a module containing at least one type. */
138588
138600
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
138589
138601
  if (seenModules === void 0) { seenModules = new ts.Map(); }
@@ -149664,19 +149676,19 @@ var ts;
149664
149676
  return function (context) { return context.options && context.options[optionName] === optionValue; };
149665
149677
  }
149666
149678
  function isOptionEnabled(optionName) {
149667
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; };
149679
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
149668
149680
  }
149669
149681
  function isOptionDisabled(optionName) {
149670
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; };
149682
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; };
149671
149683
  }
149672
149684
  function isOptionDisabledOrUndefined(optionName) {
149673
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; };
149685
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
149674
149686
  }
149675
149687
  function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
149676
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149688
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149677
149689
  }
149678
149690
  function isOptionEnabledOrUndefined(optionName) {
149679
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
149691
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
149680
149692
  }
149681
149693
  function isForContext(context) {
149682
149694
  return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
@@ -162660,7 +162672,6 @@ var ts;
162660
162672
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
162661
162673
  },
162662
162674
  });
162663
- ;
162664
162675
  function getInfo(context, considerPartialSpans) {
162665
162676
  if (considerPartialSpans === void 0) { considerPartialSpans = true; }
162666
162677
  var file = context.file, program = context.program;
@@ -163137,7 +163148,6 @@ var ts;
163137
163148
  });
163138
163149
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
163139
163150
  }
163140
- ;
163141
163151
  function isValidExpression(node) {
163142
163152
  return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
163143
163153
  }
@@ -163185,7 +163195,6 @@ var ts;
163185
163195
  if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
163186
163196
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
163187
163197
  }
163188
- ;
163189
163198
  var finalExpression = getFinalExpressionInChain(expression.right);
163190
163199
  if (!finalExpression)
163191
163200
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
@@ -165529,7 +165538,6 @@ var ts;
165529
165538
  (function (ts) {
165530
165539
  var refactor;
165531
165540
  (function (refactor) {
165532
- ;
165533
165541
  /**
165534
165542
  * Checks if some refactor info has refactor error info.
165535
165543
  */
@@ -165634,7 +165642,6 @@ var ts;
165634
165642
  // Imports will be copied to the new file anyway, and may still be needed in the old file.
165635
165643
  // Prologue directives will be copied to the new file and should be left in the old file.
165636
165644
  return !isPureImport(statement) && !ts.isPrologueDirective(statement);
165637
- ;
165638
165645
  }
165639
165646
  function isPureImport(node) {
165640
165647
  switch (node.kind) {