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.
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220919");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220920");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -2692,7 +2692,7 @@ var ts;
2692
2692
  if (typeof func !== "function") {
2693
2693
  return "";
2694
2694
  }
2695
- else if (func.hasOwnProperty("name")) {
2695
+ else if (ts.hasProperty(func, "name")) {
2696
2696
  return func.name;
2697
2697
  }
2698
2698
  else {
@@ -3017,7 +3017,7 @@ var ts;
3017
3017
  ];
3018
3018
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3019
3019
  var ctor = nodeConstructors_1[_i];
3020
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
3020
+ if (!ts.hasProperty(ctor, "__debugKind")) {
3021
3021
  Object.defineProperties(ctor.prototype, {
3022
3022
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3023
3023
  __tsDebuggerDisplay: {
@@ -3872,7 +3872,6 @@ var ts;
3872
3872
  var typeCatalog = []; // NB: id is index + 1
3873
3873
  var legendPath;
3874
3874
  var legend = [];
3875
- ;
3876
3875
  /** Starts tracing for the given project. */
3877
3876
  function startTracing(tracingMode, traceDir, configFilePath) {
3878
3877
  ts.Debug.assert(!ts.tracing, "Tracing already started");
@@ -8704,8 +8703,6 @@ var ts;
8704
8703
  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."),
8705
8704
  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."),
8706
8705
  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."),
8707
- 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'."),
8708
- 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."),
8709
8706
  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."),
8710
8707
  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."),
8711
8708
  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."),
@@ -8954,6 +8951,7 @@ var ts;
8954
8951
  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."),
8955
8952
  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."),
8956
8953
  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."),
8954
+ 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."),
8957
8955
  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."),
8958
8956
  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."),
8959
8957
  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."),
@@ -10337,7 +10335,7 @@ var ts;
10337
10335
  ts.stringToToken = stringToToken;
10338
10336
  /* @internal */
10339
10337
  function computeLineStarts(text) {
10340
- var result = new Array();
10338
+ var result = [];
10341
10339
  var pos = 0;
10342
10340
  var lineStart = 0;
10343
10341
  while (pos < text.length) {
@@ -13470,7 +13468,7 @@ var ts;
13470
13468
  // Node Arrays
13471
13469
  /* @internal */
13472
13470
  function isNodeArray(array) {
13473
- return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
13471
+ return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
13474
13472
  }
13475
13473
  ts.isNodeArray = isNodeArray;
13476
13474
  // Literals
@@ -14942,7 +14940,6 @@ var ts;
14942
14940
  return emitNode && emitNode.flags || 0;
14943
14941
  }
14944
14942
  ts.getEmitFlags = getEmitFlags;
14945
- ;
14946
14943
  function getScriptTargetFeatures() {
14947
14944
  return {
14948
14945
  es2015: {
@@ -19668,7 +19665,7 @@ var ts;
19668
19665
  }
19669
19666
  function isWatchSet(options) {
19670
19667
  // Firefox has Object.prototype.watch
19671
- return options.watch && options.hasOwnProperty("watch");
19668
+ return options.watch && ts.hasProperty(options, "watch");
19672
19669
  }
19673
19670
  ts.isWatchSet = isWatchSet;
19674
19671
  function closeFileWatcher(watcher) {
@@ -26953,7 +26950,7 @@ var ts;
26953
26950
  clone.transformFlags = node.transformFlags;
26954
26951
  setOriginalNode(clone, node);
26955
26952
  for (var key in node) {
26956
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26953
+ if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
26957
26954
  continue;
26958
26955
  }
26959
26956
  clone[key] = node[key];
@@ -31841,7 +31838,6 @@ var ts;
31841
31838
  visitNodes(cbNode, cbNodes, node.parameters) ||
31842
31839
  visitNode(cbNode, node.type);
31843
31840
  }
31844
- ;
31845
31841
  function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
31846
31842
  return visitNodes(cbNode, cbNodes, node.types);
31847
31843
  }
@@ -43157,7 +43153,7 @@ var ts;
43157
43153
  function convertCompilerOptionsForTelemetry(opts) {
43158
43154
  var out = {};
43159
43155
  for (var key in opts) {
43160
- if (opts.hasOwnProperty(key)) {
43156
+ if (ts.hasProperty(opts, key)) {
43161
43157
  var type = getOptionFromName(key);
43162
43158
  if (type !== undefined) { // Ignore unknown options
43163
43159
  out[key] = getOptionValueWithEmptyStrings(opts[key], type);
@@ -49661,7 +49657,8 @@ var ts;
49661
49657
  var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
49662
49658
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
49663
49659
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49664
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
49660
+ var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49661
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
49665
49662
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49666
49663
  emptyGenericType.instantiations = new ts.Map();
49667
49664
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -49775,6 +49772,7 @@ var ts;
49775
49772
  var deferredGlobalOmitSymbol;
49776
49773
  var deferredGlobalAwaitedSymbol;
49777
49774
  var deferredGlobalBigIntType;
49775
+ var deferredGlobalRecordSymbol;
49778
49776
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49779
49777
  var flowLoopStart = 0;
49780
49778
  var flowLoopCount = 0;
@@ -50570,12 +50568,13 @@ var ts;
50570
50568
  * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
50571
50569
  * the given name can be found.
50572
50570
  *
50571
+ * @param nameNotFoundMessage If defined, we will report errors found during resolve.
50573
50572
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
50574
50573
  */
50575
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
50574
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
50576
50575
  if (excludeGlobals === void 0) { excludeGlobals = false; }
50577
- if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
50578
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
50576
+ if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
50577
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
50579
50578
  }
50580
50579
  function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50581
50580
  var _a, _b, _c;
@@ -50733,7 +50732,9 @@ var ts;
50733
50732
  // TypeScript 1.0 spec (April 2014): 3.4.1
50734
50733
  // The scope of a type parameter extends over the entire declaration with which the type
50735
50734
  // parameter list is associated, with the exception of static member declarations in classes.
50736
- error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50735
+ if (nameNotFoundMessage) {
50736
+ error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50737
+ }
50737
50738
  return undefined;
50738
50739
  }
50739
50740
  break loop;
@@ -50771,7 +50772,9 @@ var ts;
50771
50772
  if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
50772
50773
  // A reference to this grandparent's type parameters would be an error
50773
50774
  if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
50774
- error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50775
+ if (nameNotFoundMessage) {
50776
+ error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50777
+ }
50775
50778
  return undefined;
50776
50779
  }
50777
50780
  }
@@ -50967,7 +50970,7 @@ var ts;
50967
50970
  }
50968
50971
  return undefined;
50969
50972
  }
50970
- else if (checkAndReportErrorForInvalidInitializer()) {
50973
+ else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50971
50974
  return undefined;
50972
50975
  }
50973
50976
  // Perform extra checks only if error reporting was requested
@@ -57128,7 +57131,6 @@ var ts;
57128
57131
  return container;
57129
57132
  }
57130
57133
  }
57131
- ;
57132
57134
  }
57133
57135
  /** Create a synthetic property access flow node after the last statement of the file */
57134
57136
  function getFlowTypeFromCommonJSExport(symbol) {
@@ -61874,6 +61876,10 @@ var ts;
61874
61876
  function getGlobalBigIntType() {
61875
61877
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61876
61878
  }
61879
+ function getGlobalRecordSymbol() {
61880
+ deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61881
+ return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
61882
+ }
61877
61883
  /**
61878
61884
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61879
61885
  */
@@ -72190,18 +72196,26 @@ var ts;
72190
72196
  }
72191
72197
  function isTypePresencePossible(type, propName, assumeTrue) {
72192
72198
  var prop = getPropertyOfType(type, propName);
72193
- if (prop) {
72194
- return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
72195
- }
72196
- return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
72197
- }
72198
- function narrowByInKeyword(type, name, assumeTrue) {
72199
- if (type.flags & 1048576 /* TypeFlags.Union */
72200
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
72201
- || ts.isThisTypeParameter(type)
72202
- || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
72199
+ return prop ?
72200
+ !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72201
+ !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72202
+ }
72203
+ function narrowByInKeyword(type, nameType, assumeTrue) {
72204
+ var name = getPropertyNameFromType(nameType);
72205
+ var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72206
+ if (isKnownProperty) {
72207
+ // If the check is for a known property (i.e. a property declared in some constituent of
72208
+ // the target type), we filter the target type by presence of absence of the property.
72203
72209
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
72204
72210
  }
72211
+ if (assumeTrue) {
72212
+ // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
72213
+ // where X is the name of the property.
72214
+ var recordSymbol = getGlobalRecordSymbol();
72215
+ if (recordSymbol) {
72216
+ return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
72217
+ }
72218
+ }
72205
72219
  return type;
72206
72220
  }
72207
72221
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -72260,15 +72274,14 @@ var ts;
72260
72274
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
72261
72275
  }
72262
72276
  var target = getReferenceCandidate(expr.right);
72263
- var leftType = getTypeOfNode(expr.left);
72264
- if (leftType.flags & 128 /* TypeFlags.StringLiteral */) {
72265
- var name = ts.escapeLeadingUnderscores(leftType.value);
72277
+ var leftType = getTypeOfExpression(expr.left);
72278
+ if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
72266
72279
  if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
72267
- getAccessedPropertyName(reference) === name) {
72280
+ getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
72268
72281
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72269
72282
  }
72270
72283
  if (isMatchingReference(reference, target)) {
72271
- return narrowByInKeyword(type, name, assumeTrue);
72284
+ return narrowByInKeyword(type, leftType, assumeTrue);
72272
72285
  }
72273
72286
  }
72274
72287
  break;
@@ -76438,7 +76451,6 @@ var ts;
76438
76451
  }
76439
76452
  return false;
76440
76453
  }
76441
- ;
76442
76454
  var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
76443
76455
  if (!hasProp(suggestedMethod)) {
76444
76456
  return undefined;
@@ -80009,6 +80021,9 @@ var ts;
80009
80021
  }
80010
80022
  return booleanType;
80011
80023
  }
80024
+ function hasEmptyObjectIntersection(type) {
80025
+ return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
80026
+ }
80012
80027
  function checkInExpression(left, right, leftType, rightType) {
80013
80028
  if (leftType === silentNeverType || rightType === silentNeverType) {
80014
80029
  return silentNeverType;
@@ -80025,40 +80040,20 @@ var ts;
80025
80040
  }
80026
80041
  }
80027
80042
  else {
80028
- leftType = checkNonNullType(leftType, left);
80029
- // TypeScript 1.0 spec (April 2014): 4.15.5
80030
- // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
80031
- if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
80032
- isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
80033
- 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);
80043
+ // The type of the lef operand must be assignable to string, number, or symbol.
80044
+ checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
80045
+ }
80046
+ // The type of the right operand must be assignable to 'object'.
80047
+ if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
80048
+ // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
80049
+ // detect and error on {} that results from narrowing the unknown type, as well as intersections
80050
+ // that include {} (we know that the other types in such intersections are assignable to object
80051
+ // since we already checked for that).
80052
+ if (hasEmptyObjectIntersection(rightType)) {
80053
+ 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));
80034
80054
  }
80035
80055
  }
80036
- rightType = checkNonNullType(rightType, right);
80037
- // TypeScript 1.0 spec (April 2014): 4.15.5
80038
- // The in operator requires the right operand to be
80039
- //
80040
- // 1. assignable to the non-primitive type,
80041
- // 2. an unconstrained type parameter,
80042
- // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
80043
- // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
80044
- // non-primitive type, or
80045
- // 4. a type parameter whose constraint is
80046
- // i. an object type,
80047
- // ii. the non-primitive type, or
80048
- // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
80049
- //
80050
- // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
80051
- // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
80052
- // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
80053
- // unless *all* instantiations would result in an error.
80054
- //
80055
80056
  // The result is always of the Boolean primitive type.
80056
- var rightTypeConstraint = getConstraintOfType(rightType);
80057
- if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80058
- rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80059
- !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
80060
- error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
80061
- }
80062
80057
  return booleanType;
80063
80058
  }
80064
80059
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -88500,7 +88495,7 @@ var ts;
88500
88495
  }
88501
88496
  var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
88502
88497
  if (node) {
88503
- var symbol = getReferencedValueSymbol(node);
88498
+ var symbol = getReferencedValueOrAliasSymbol(node);
88504
88499
  // We should only get the declaration of an alias if there isn't a local value
88505
88500
  // declaration for the symbol
88506
88501
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -88867,6 +88862,25 @@ var ts;
88867
88862
  }
88868
88863
  return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
88869
88864
  }
88865
+ /**
88866
+ * Get either a value-meaning symbol or an alias symbol.
88867
+ * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
88868
+ * we call `resolveName` to find a symbol.
88869
+ * This is because when caching the resolved symbol, we only consider value symbols, but here
88870
+ * we want to also get an alias symbol if one exists.
88871
+ */
88872
+ function getReferencedValueOrAliasSymbol(reference) {
88873
+ var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
88874
+ if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
88875
+ return resolvedSymbol;
88876
+ }
88877
+ return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
88878
+ /*nodeNotFoundMessage*/ undefined,
88879
+ /*nameArg*/ undefined,
88880
+ /*isUse*/ true,
88881
+ /*excludeGlobals*/ undefined,
88882
+ /*getSpellingSuggestions*/ undefined);
88883
+ }
88870
88884
  function getReferencedValueDeclaration(referenceIn) {
88871
88885
  if (!ts.isGeneratedIdentifier(referenceIn)) {
88872
88886
  var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
@@ -95316,9 +95330,10 @@ var ts;
95316
95330
  return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
95317
95331
  }
95318
95332
  function shouldEmitAliasDeclaration(node) {
95319
- return compilerOptions.preserveValueImports
95320
- ? resolver.isValueAliasDeclaration(node)
95321
- : resolver.isReferencedAliasDeclaration(node);
95333
+ return ts.isInJSFile(node) ||
95334
+ (compilerOptions.preserveValueImports
95335
+ ? resolver.isValueAliasDeclaration(node)
95336
+ : resolver.isReferencedAliasDeclaration(node));
95322
95337
  }
95323
95338
  }
95324
95339
  ts.transformTypeScript = transformTypeScript;
@@ -110490,7 +110505,7 @@ var ts;
110490
110505
  var _a;
110491
110506
  var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
110492
110507
  var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
110493
- if (augmentingDeclarations) {
110508
+ if (primaryDeclaration && augmentingDeclarations) {
110494
110509
  for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
110495
110510
  var augmentations = augmentingDeclarations_1[_i];
110496
110511
  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)));
@@ -118539,7 +118554,6 @@ var ts;
118539
118554
  return resolutions;
118540
118555
  }
118541
118556
  ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
118542
- ;
118543
118557
  /**
118544
118558
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
118545
118559
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
@@ -135035,7 +135049,7 @@ var ts;
135035
135049
  if (!dependencies)
135036
135050
  continue;
135037
135051
  for (var dep in dependencies) {
135038
- if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
135052
+ if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
135039
135053
  result.push(dep);
135040
135054
  }
135041
135055
  }
@@ -135888,7 +135902,6 @@ var ts;
135888
135902
  var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
135889
135903
  return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
135890
135904
  }
135891
- ;
135892
135905
  function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
135893
135906
  var declarations = symbol.getDeclarations();
135894
135907
  if (!(declarations && declarations.length)) {
@@ -138592,7 +138605,6 @@ var ts;
138592
138605
  function isArrowFunctionBody(node) {
138593
138606
  return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
138594
138607
  }
138595
- ;
138596
138608
  /** True if symbol is a type or a module containing at least one type. */
138597
138609
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
138598
138610
  if (seenModules === void 0) { seenModules = new ts.Map(); }
@@ -149673,19 +149685,19 @@ var ts;
149673
149685
  return function (context) { return context.options && context.options[optionName] === optionValue; };
149674
149686
  }
149675
149687
  function isOptionEnabled(optionName) {
149676
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; };
149688
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
149677
149689
  }
149678
149690
  function isOptionDisabled(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 isOptionDisabledOrUndefined(optionName) {
149682
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; };
149694
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
149683
149695
  }
149684
149696
  function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
149685
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149697
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149686
149698
  }
149687
149699
  function isOptionEnabledOrUndefined(optionName) {
149688
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
149700
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
149689
149701
  }
149690
149702
  function isForContext(context) {
149691
149703
  return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
@@ -162669,7 +162681,6 @@ var ts;
162669
162681
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
162670
162682
  },
162671
162683
  });
162672
- ;
162673
162684
  function getInfo(context, considerPartialSpans) {
162674
162685
  if (considerPartialSpans === void 0) { considerPartialSpans = true; }
162675
162686
  var file = context.file, program = context.program;
@@ -163146,7 +163157,6 @@ var ts;
163146
163157
  });
163147
163158
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
163148
163159
  }
163149
- ;
163150
163160
  function isValidExpression(node) {
163151
163161
  return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
163152
163162
  }
@@ -163194,7 +163204,6 @@ var ts;
163194
163204
  if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
163195
163205
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
163196
163206
  }
163197
- ;
163198
163207
  var finalExpression = getFinalExpressionInChain(expression.right);
163199
163208
  if (!finalExpression)
163200
163209
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
@@ -165538,7 +165547,6 @@ var ts;
165538
165547
  (function (ts) {
165539
165548
  var refactor;
165540
165549
  (function (refactor) {
165541
- ;
165542
165550
  /**
165543
165551
  * Checks if some refactor info has refactor error info.
165544
165552
  */
@@ -165643,7 +165651,6 @@ var ts;
165643
165651
  // Imports will be copied to the new file anyway, and may still be needed in the old file.
165644
165652
  // Prologue directives will be copied to the new file and should be left in the old file.
165645
165653
  return !isPureImport(statement) && !ts.isPrologueDirective(statement);
165646
- ;
165647
165654
  }
165648
165655
  function isPureImport(node) {
165649
165656
  switch (node.kind) {
@@ -175279,7 +175286,7 @@ var ts;
175279
175286
  // raw is now fixed and ready
175280
175287
  this.safelist = raw.typesMap;
175281
175288
  for (var key in raw.simpleMap) {
175282
- if (raw.simpleMap.hasOwnProperty(key)) {
175289
+ if (ts.hasProperty(raw.simpleMap, key)) {
175283
175290
  this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase());
175284
175291
  }
175285
175292
  }
@@ -178693,7 +178700,6 @@ var ts;
178693
178700
  }
178694
178701
  return ts.deduplicate(outputs, ts.equateValues);
178695
178702
  }
178696
- ;
178697
178703
  function createDocumentSpanSet() {
178698
178704
  return ts.createSet(function (_a) {
178699
178705
  var textSpan = _a.textSpan;