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.
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220919");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220920");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -2693,7 +2693,7 @@ var ts;
2693
2693
  if (typeof func !== "function") {
2694
2694
  return "";
2695
2695
  }
2696
- else if (func.hasOwnProperty("name")) {
2696
+ else if (ts.hasProperty(func, "name")) {
2697
2697
  return func.name;
2698
2698
  }
2699
2699
  else {
@@ -3018,7 +3018,7 @@ var ts;
3018
3018
  ];
3019
3019
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3020
3020
  var ctor = nodeConstructors_1[_i];
3021
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
3021
+ if (!ts.hasProperty(ctor, "__debugKind")) {
3022
3022
  Object.defineProperties(ctor.prototype, {
3023
3023
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3024
3024
  __tsDebuggerDisplay: {
@@ -3873,7 +3873,6 @@ var ts;
3873
3873
  var typeCatalog = []; // NB: id is index + 1
3874
3874
  var legendPath;
3875
3875
  var legend = [];
3876
- ;
3877
3876
  /** Starts tracing for the given project. */
3878
3877
  function startTracing(tracingMode, traceDir, configFilePath) {
3879
3878
  ts.Debug.assert(!ts.tracing, "Tracing already started");
@@ -8705,8 +8704,6 @@ var ts;
8705
8704
  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."),
8706
8705
  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."),
8707
8706
  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."),
8708
- 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'."),
8709
- 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."),
8710
8707
  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."),
8711
8708
  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."),
8712
8709
  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."),
@@ -8955,6 +8952,7 @@ var ts;
8955
8952
  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."),
8956
8953
  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."),
8957
8954
  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."),
8955
+ 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."),
8958
8956
  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."),
8959
8957
  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."),
8960
8958
  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."),
@@ -10338,7 +10336,7 @@ var ts;
10338
10336
  ts.stringToToken = stringToToken;
10339
10337
  /* @internal */
10340
10338
  function computeLineStarts(text) {
10341
- var result = new Array();
10339
+ var result = [];
10342
10340
  var pos = 0;
10343
10341
  var lineStart = 0;
10344
10342
  while (pos < text.length) {
@@ -13471,7 +13469,7 @@ var ts;
13471
13469
  // Node Arrays
13472
13470
  /* @internal */
13473
13471
  function isNodeArray(array) {
13474
- return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
13472
+ return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
13475
13473
  }
13476
13474
  ts.isNodeArray = isNodeArray;
13477
13475
  // Literals
@@ -14943,7 +14941,6 @@ var ts;
14943
14941
  return emitNode && emitNode.flags || 0;
14944
14942
  }
14945
14943
  ts.getEmitFlags = getEmitFlags;
14946
- ;
14947
14944
  function getScriptTargetFeatures() {
14948
14945
  return {
14949
14946
  es2015: {
@@ -19669,7 +19666,7 @@ var ts;
19669
19666
  }
19670
19667
  function isWatchSet(options) {
19671
19668
  // Firefox has Object.prototype.watch
19672
- return options.watch && options.hasOwnProperty("watch");
19669
+ return options.watch && ts.hasProperty(options, "watch");
19673
19670
  }
19674
19671
  ts.isWatchSet = isWatchSet;
19675
19672
  function closeFileWatcher(watcher) {
@@ -26954,7 +26951,7 @@ var ts;
26954
26951
  clone.transformFlags = node.transformFlags;
26955
26952
  setOriginalNode(clone, node);
26956
26953
  for (var key in node) {
26957
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26954
+ if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
26958
26955
  continue;
26959
26956
  }
26960
26957
  clone[key] = node[key];
@@ -31842,7 +31839,6 @@ var ts;
31842
31839
  visitNodes(cbNode, cbNodes, node.parameters) ||
31843
31840
  visitNode(cbNode, node.type);
31844
31841
  }
31845
- ;
31846
31842
  function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
31847
31843
  return visitNodes(cbNode, cbNodes, node.types);
31848
31844
  }
@@ -43158,7 +43154,7 @@ var ts;
43158
43154
  function convertCompilerOptionsForTelemetry(opts) {
43159
43155
  var out = {};
43160
43156
  for (var key in opts) {
43161
- if (opts.hasOwnProperty(key)) {
43157
+ if (ts.hasProperty(opts, key)) {
43162
43158
  var type = getOptionFromName(key);
43163
43159
  if (type !== undefined) { // Ignore unknown options
43164
43160
  out[key] = getOptionValueWithEmptyStrings(opts[key], type);
@@ -49662,7 +49658,8 @@ var ts;
49662
49658
  var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
49663
49659
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
49664
49660
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49665
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
49661
+ var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49662
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
49666
49663
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49667
49664
  emptyGenericType.instantiations = new ts.Map();
49668
49665
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -49776,6 +49773,7 @@ var ts;
49776
49773
  var deferredGlobalOmitSymbol;
49777
49774
  var deferredGlobalAwaitedSymbol;
49778
49775
  var deferredGlobalBigIntType;
49776
+ var deferredGlobalRecordSymbol;
49779
49777
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49780
49778
  var flowLoopStart = 0;
49781
49779
  var flowLoopCount = 0;
@@ -50571,12 +50569,13 @@ var ts;
50571
50569
  * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
50572
50570
  * the given name can be found.
50573
50571
  *
50572
+ * @param nameNotFoundMessage If defined, we will report errors found during resolve.
50574
50573
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
50575
50574
  */
50576
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
50575
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
50577
50576
  if (excludeGlobals === void 0) { excludeGlobals = false; }
50578
- if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
50579
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
50577
+ if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
50578
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
50580
50579
  }
50581
50580
  function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50582
50581
  var _a, _b, _c;
@@ -50734,7 +50733,9 @@ var ts;
50734
50733
  // TypeScript 1.0 spec (April 2014): 3.4.1
50735
50734
  // The scope of a type parameter extends over the entire declaration with which the type
50736
50735
  // parameter list is associated, with the exception of static member declarations in classes.
50737
- error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50736
+ if (nameNotFoundMessage) {
50737
+ error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50738
+ }
50738
50739
  return undefined;
50739
50740
  }
50740
50741
  break loop;
@@ -50772,7 +50773,9 @@ var ts;
50772
50773
  if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
50773
50774
  // A reference to this grandparent's type parameters would be an error
50774
50775
  if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
50775
- error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50776
+ if (nameNotFoundMessage) {
50777
+ error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50778
+ }
50776
50779
  return undefined;
50777
50780
  }
50778
50781
  }
@@ -50968,7 +50971,7 @@ var ts;
50968
50971
  }
50969
50972
  return undefined;
50970
50973
  }
50971
- else if (checkAndReportErrorForInvalidInitializer()) {
50974
+ else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50972
50975
  return undefined;
50973
50976
  }
50974
50977
  // Perform extra checks only if error reporting was requested
@@ -57129,7 +57132,6 @@ var ts;
57129
57132
  return container;
57130
57133
  }
57131
57134
  }
57132
- ;
57133
57135
  }
57134
57136
  /** Create a synthetic property access flow node after the last statement of the file */
57135
57137
  function getFlowTypeFromCommonJSExport(symbol) {
@@ -61875,6 +61877,10 @@ var ts;
61875
61877
  function getGlobalBigIntType() {
61876
61878
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61877
61879
  }
61880
+ function getGlobalRecordSymbol() {
61881
+ deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61882
+ return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
61883
+ }
61878
61884
  /**
61879
61885
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61880
61886
  */
@@ -72191,18 +72197,26 @@ var ts;
72191
72197
  }
72192
72198
  function isTypePresencePossible(type, propName, assumeTrue) {
72193
72199
  var prop = getPropertyOfType(type, propName);
72194
- if (prop) {
72195
- return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
72196
- }
72197
- return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
72198
- }
72199
- function narrowByInKeyword(type, name, assumeTrue) {
72200
- if (type.flags & 1048576 /* TypeFlags.Union */
72201
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
72202
- || ts.isThisTypeParameter(type)
72203
- || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
72200
+ return prop ?
72201
+ !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72202
+ !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72203
+ }
72204
+ function narrowByInKeyword(type, nameType, assumeTrue) {
72205
+ var name = getPropertyNameFromType(nameType);
72206
+ var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72207
+ if (isKnownProperty) {
72208
+ // If the check is for a known property (i.e. a property declared in some constituent of
72209
+ // the target type), we filter the target type by presence of absence of the property.
72204
72210
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
72205
72211
  }
72212
+ if (assumeTrue) {
72213
+ // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
72214
+ // where X is the name of the property.
72215
+ var recordSymbol = getGlobalRecordSymbol();
72216
+ if (recordSymbol) {
72217
+ return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
72218
+ }
72219
+ }
72206
72220
  return type;
72207
72221
  }
72208
72222
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -72261,15 +72275,14 @@ var ts;
72261
72275
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
72262
72276
  }
72263
72277
  var target = getReferenceCandidate(expr.right);
72264
- var leftType = getTypeOfNode(expr.left);
72265
- if (leftType.flags & 128 /* TypeFlags.StringLiteral */) {
72266
- var name = ts.escapeLeadingUnderscores(leftType.value);
72278
+ var leftType = getTypeOfExpression(expr.left);
72279
+ if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
72267
72280
  if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
72268
- getAccessedPropertyName(reference) === name) {
72281
+ getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
72269
72282
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72270
72283
  }
72271
72284
  if (isMatchingReference(reference, target)) {
72272
- return narrowByInKeyword(type, name, assumeTrue);
72285
+ return narrowByInKeyword(type, leftType, assumeTrue);
72273
72286
  }
72274
72287
  }
72275
72288
  break;
@@ -76439,7 +76452,6 @@ var ts;
76439
76452
  }
76440
76453
  return false;
76441
76454
  }
76442
- ;
76443
76455
  var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
76444
76456
  if (!hasProp(suggestedMethod)) {
76445
76457
  return undefined;
@@ -80010,6 +80022,9 @@ var ts;
80010
80022
  }
80011
80023
  return booleanType;
80012
80024
  }
80025
+ function hasEmptyObjectIntersection(type) {
80026
+ return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
80027
+ }
80013
80028
  function checkInExpression(left, right, leftType, rightType) {
80014
80029
  if (leftType === silentNeverType || rightType === silentNeverType) {
80015
80030
  return silentNeverType;
@@ -80026,40 +80041,20 @@ var ts;
80026
80041
  }
80027
80042
  }
80028
80043
  else {
80029
- leftType = checkNonNullType(leftType, left);
80030
- // TypeScript 1.0 spec (April 2014): 4.15.5
80031
- // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
80032
- if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
80033
- isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
80034
- 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);
80044
+ // The type of the lef operand must be assignable to string, number, or symbol.
80045
+ checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
80046
+ }
80047
+ // The type of the right operand must be assignable to 'object'.
80048
+ if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
80049
+ // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
80050
+ // detect and error on {} that results from narrowing the unknown type, as well as intersections
80051
+ // that include {} (we know that the other types in such intersections are assignable to object
80052
+ // since we already checked for that).
80053
+ if (hasEmptyObjectIntersection(rightType)) {
80054
+ 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));
80035
80055
  }
80036
80056
  }
80037
- rightType = checkNonNullType(rightType, right);
80038
- // TypeScript 1.0 spec (April 2014): 4.15.5
80039
- // The in operator requires the right operand to be
80040
- //
80041
- // 1. assignable to the non-primitive type,
80042
- // 2. an unconstrained type parameter,
80043
- // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
80044
- // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
80045
- // non-primitive type, or
80046
- // 4. a type parameter whose constraint is
80047
- // i. an object type,
80048
- // ii. the non-primitive type, or
80049
- // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
80050
- //
80051
- // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
80052
- // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
80053
- // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
80054
- // unless *all* instantiations would result in an error.
80055
- //
80056
80057
  // The result is always of the Boolean primitive type.
80057
- var rightTypeConstraint = getConstraintOfType(rightType);
80058
- if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80059
- rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80060
- !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
80061
- error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
80062
- }
80063
80058
  return booleanType;
80064
80059
  }
80065
80060
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -88501,7 +88496,7 @@ var ts;
88501
88496
  }
88502
88497
  var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
88503
88498
  if (node) {
88504
- var symbol = getReferencedValueSymbol(node);
88499
+ var symbol = getReferencedValueOrAliasSymbol(node);
88505
88500
  // We should only get the declaration of an alias if there isn't a local value
88506
88501
  // declaration for the symbol
88507
88502
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -88868,6 +88863,25 @@ var ts;
88868
88863
  }
88869
88864
  return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
88870
88865
  }
88866
+ /**
88867
+ * Get either a value-meaning symbol or an alias symbol.
88868
+ * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
88869
+ * we call `resolveName` to find a symbol.
88870
+ * This is because when caching the resolved symbol, we only consider value symbols, but here
88871
+ * we want to also get an alias symbol if one exists.
88872
+ */
88873
+ function getReferencedValueOrAliasSymbol(reference) {
88874
+ var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
88875
+ if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
88876
+ return resolvedSymbol;
88877
+ }
88878
+ return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
88879
+ /*nodeNotFoundMessage*/ undefined,
88880
+ /*nameArg*/ undefined,
88881
+ /*isUse*/ true,
88882
+ /*excludeGlobals*/ undefined,
88883
+ /*getSpellingSuggestions*/ undefined);
88884
+ }
88871
88885
  function getReferencedValueDeclaration(referenceIn) {
88872
88886
  if (!ts.isGeneratedIdentifier(referenceIn)) {
88873
88887
  var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
@@ -95317,9 +95331,10 @@ var ts;
95317
95331
  return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
95318
95332
  }
95319
95333
  function shouldEmitAliasDeclaration(node) {
95320
- return compilerOptions.preserveValueImports
95321
- ? resolver.isValueAliasDeclaration(node)
95322
- : resolver.isReferencedAliasDeclaration(node);
95334
+ return ts.isInJSFile(node) ||
95335
+ (compilerOptions.preserveValueImports
95336
+ ? resolver.isValueAliasDeclaration(node)
95337
+ : resolver.isReferencedAliasDeclaration(node));
95323
95338
  }
95324
95339
  }
95325
95340
  ts.transformTypeScript = transformTypeScript;
@@ -110491,7 +110506,7 @@ var ts;
110491
110506
  var _a;
110492
110507
  var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
110493
110508
  var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
110494
- if (augmentingDeclarations) {
110509
+ if (primaryDeclaration && augmentingDeclarations) {
110495
110510
  for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
110496
110511
  var augmentations = augmentingDeclarations_1[_i];
110497
110512
  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)));
@@ -118540,7 +118555,6 @@ var ts;
118540
118555
  return resolutions;
118541
118556
  }
118542
118557
  ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
118543
- ;
118544
118558
  /**
118545
118559
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
118546
118560
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
@@ -134617,7 +134631,7 @@ var ts;
134617
134631
  if (!dependencies)
134618
134632
  continue;
134619
134633
  for (var dep in dependencies) {
134620
- if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) {
134634
+ if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) {
134621
134635
  result.push(dep);
134622
134636
  }
134623
134637
  }
@@ -135470,7 +135484,6 @@ var ts;
135470
135484
  var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) };
135471
135485
  return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails };
135472
135486
  }
135473
- ;
135474
135487
  function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) {
135475
135488
  var declarations = symbol.getDeclarations();
135476
135489
  if (!(declarations && declarations.length)) {
@@ -138174,7 +138187,6 @@ var ts;
138174
138187
  function isArrowFunctionBody(node) {
138175
138188
  return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node;
138176
138189
  }
138177
- ;
138178
138190
  /** True if symbol is a type or a module containing at least one type. */
138179
138191
  function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) {
138180
138192
  if (seenModules === void 0) { seenModules = new ts.Map(); }
@@ -149255,19 +149267,19 @@ var ts;
149255
149267
  return function (context) { return context.options && context.options[optionName] === optionValue; };
149256
149268
  }
149257
149269
  function isOptionEnabled(optionName) {
149258
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; };
149270
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; };
149259
149271
  }
149260
149272
  function isOptionDisabled(optionName) {
149261
- return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; };
149273
+ return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; };
149262
149274
  }
149263
149275
  function isOptionDisabledOrUndefined(optionName) {
149264
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; };
149276
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; };
149265
149277
  }
149266
149278
  function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) {
149267
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149279
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); };
149268
149280
  }
149269
149281
  function isOptionEnabledOrUndefined(optionName) {
149270
- return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
149282
+ return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; };
149271
149283
  }
149272
149284
  function isForContext(context) {
149273
149285
  return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */;
@@ -162251,7 +162263,6 @@ var ts;
162251
162263
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
162252
162264
  },
162253
162265
  });
162254
- ;
162255
162266
  function getInfo(context, considerPartialSpans) {
162256
162267
  if (considerPartialSpans === void 0) { considerPartialSpans = true; }
162257
162268
  var file = context.file, program = context.program;
@@ -162728,7 +162739,6 @@ var ts;
162728
162739
  });
162729
162740
  return { edits: edits, renameFilename: undefined, renameLocation: undefined };
162730
162741
  }
162731
- ;
162732
162742
  function isValidExpression(node) {
162733
162743
  return ts.isBinaryExpression(node) || ts.isConditionalExpression(node);
162734
162744
  }
@@ -162776,7 +162786,6 @@ var ts;
162776
162786
  if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) {
162777
162787
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) };
162778
162788
  }
162779
- ;
162780
162789
  var finalExpression = getFinalExpressionInChain(expression.right);
162781
162790
  if (!finalExpression)
162782
162791
  return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) };
@@ -165120,7 +165129,6 @@ var ts;
165120
165129
  (function (ts) {
165121
165130
  var refactor;
165122
165131
  (function (refactor) {
165123
- ;
165124
165132
  /**
165125
165133
  * Checks if some refactor info has refactor error info.
165126
165134
  */
@@ -165225,7 +165233,6 @@ var ts;
165225
165233
  // Imports will be copied to the new file anyway, and may still be needed in the old file.
165226
165234
  // Prologue directives will be copied to the new file and should be left in the old file.
165227
165235
  return !isPureImport(statement) && !ts.isPrologueDirective(statement);
165228
- ;
165229
165236
  }
165230
165237
  function isPureImport(node) {
165231
165238
  switch (node.kind) {
@@ -175280,7 +175287,7 @@ var ts;
175280
175287
  // raw is now fixed and ready
175281
175288
  this.safelist = raw.typesMap;
175282
175289
  for (var key in raw.simpleMap) {
175283
- if (raw.simpleMap.hasOwnProperty(key)) {
175290
+ if (ts.hasProperty(raw.simpleMap, key)) {
175284
175291
  this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase());
175285
175292
  }
175286
175293
  }
@@ -178694,7 +178701,6 @@ var ts;
178694
178701
  }
178695
178702
  return ts.deduplicate(outputs, ts.equateValues);
178696
178703
  }
178697
- ;
178698
178704
  function createDocumentSpanSet() {
178699
178705
  return ts.createSet(function (_a) {
178700
178706
  var textSpan = _a.textSpan;