typescript 4.9.0-dev.20220919 → 4.9.0-dev.20220921

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220919");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220921");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -2673,7 +2673,7 @@ var ts;
2673
2673
  if (typeof func !== "function") {
2674
2674
  return "";
2675
2675
  }
2676
- else if (func.hasOwnProperty("name")) {
2676
+ else if (ts.hasProperty(func, "name")) {
2677
2677
  return func.name;
2678
2678
  }
2679
2679
  else {
@@ -2998,7 +2998,7 @@ var ts;
2998
2998
  ];
2999
2999
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3000
3000
  var ctor = nodeConstructors_1[_i];
3001
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
3001
+ if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
3002
3002
  Object.defineProperties(ctor.prototype, {
3003
3003
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3004
3004
  __tsDebuggerDisplay: {
@@ -3853,7 +3853,6 @@ var ts;
3853
3853
  var typeCatalog = []; // NB: id is index + 1
3854
3854
  var legendPath;
3855
3855
  var legend = [];
3856
- ;
3857
3856
  /** Starts tracing for the given project. */
3858
3857
  function startTracing(tracingMode, traceDir, configFilePath) {
3859
3858
  ts.Debug.assert(!ts.tracing, "Tracing already started");
@@ -8685,8 +8684,6 @@ var ts;
8685
8684
  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."),
8686
8685
  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."),
8687
8686
  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."),
8688
- 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'."),
8689
- 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."),
8690
8687
  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."),
8691
8688
  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."),
8692
8689
  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."),
@@ -8935,6 +8932,7 @@ var ts;
8935
8932
  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."),
8936
8933
  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."),
8937
8934
  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."),
8935
+ 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."),
8938
8936
  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."),
8939
8937
  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."),
8940
8938
  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."),
@@ -9115,6 +9113,7 @@ var ts;
9115
9113
  _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
9116
9114
  We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
9117
9115
  Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
9116
+ This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
9118
9117
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
9119
9118
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
9120
9119
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10057,6 +10056,8 @@ var ts;
10057
10056
  Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
10058
10057
  Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
10059
10058
  Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
10059
+ Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
10060
+ Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
10060
10061
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
10061
10062
  Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
10062
10063
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -10318,7 +10319,7 @@ var ts;
10318
10319
  ts.stringToToken = stringToToken;
10319
10320
  /* @internal */
10320
10321
  function computeLineStarts(text) {
10321
- var result = new Array();
10322
+ var result = [];
10322
10323
  var pos = 0;
10323
10324
  var lineStart = 0;
10324
10325
  while (pos < text.length) {
@@ -11879,12 +11880,36 @@ var ts;
11879
11880
  pos++;
11880
11881
  return token = 0 /* SyntaxKind.Unknown */;
11881
11882
  }
11882
- if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) {
11883
+ var charAfterHash = codePointAt(text, pos + 1);
11884
+ if (charAfterHash === 92 /* CharacterCodes.backslash */) {
11885
+ pos++;
11886
+ var extendedCookedChar_1 = peekExtendedUnicodeEscape();
11887
+ if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) {
11888
+ pos += 3;
11889
+ tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */;
11890
+ tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts();
11891
+ return token = 80 /* SyntaxKind.PrivateIdentifier */;
11892
+ }
11893
+ var cookedChar_1 = peekUnicodeEscape();
11894
+ if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) {
11895
+ pos += 6;
11896
+ tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */;
11897
+ tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts();
11898
+ return token = 80 /* SyntaxKind.PrivateIdentifier */;
11899
+ }
11900
+ pos--;
11901
+ }
11902
+ if (isIdentifierStart(charAfterHash, languageVersion)) {
11883
11903
  pos++;
11884
- scanIdentifier(codePointAt(text, pos), languageVersion);
11904
+ // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact.
11905
+ // Notably absent from this block is the fact that calling a function named "scanIdentifier",
11906
+ // but identifiers don't include '#', and that function doesn't deal with it at all.
11907
+ // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings;
11908
+ // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us.
11909
+ scanIdentifier(charAfterHash, languageVersion);
11885
11910
  }
11886
11911
  else {
11887
- tokenValue = String.fromCharCode(codePointAt(text, pos));
11912
+ tokenValue = "#";
11888
11913
  error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
11889
11914
  }
11890
11915
  return token = 80 /* SyntaxKind.PrivateIdentifier */;
@@ -13451,7 +13476,7 @@ var ts;
13451
13476
  // Node Arrays
13452
13477
  /* @internal */
13453
13478
  function isNodeArray(array) {
13454
- return array.hasOwnProperty("pos") && array.hasOwnProperty("end");
13479
+ return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end");
13455
13480
  }
13456
13481
  ts.isNodeArray = isNodeArray;
13457
13482
  // Literals
@@ -14923,7 +14948,6 @@ var ts;
14923
14948
  return emitNode && emitNode.flags || 0;
14924
14949
  }
14925
14950
  ts.getEmitFlags = getEmitFlags;
14926
- ;
14927
14951
  function getScriptTargetFeatures() {
14928
14952
  return {
14929
14953
  es2015: {
@@ -19649,7 +19673,7 @@ var ts;
19649
19673
  }
19650
19674
  function isWatchSet(options) {
19651
19675
  // Firefox has Object.prototype.watch
19652
- return options.watch && options.hasOwnProperty("watch");
19676
+ return options.watch && ts.hasProperty(options, "watch");
19653
19677
  }
19654
19678
  ts.isWatchSet = isWatchSet;
19655
19679
  function closeFileWatcher(watcher) {
@@ -26934,7 +26958,7 @@ var ts;
26934
26958
  clone.transformFlags = node.transformFlags;
26935
26959
  setOriginalNode(clone, node);
26936
26960
  for (var key in node) {
26937
- if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) {
26961
+ if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) {
26938
26962
  continue;
26939
26963
  }
26940
26964
  clone[key] = node[key];
@@ -31822,7 +31846,6 @@ var ts;
31822
31846
  visitNodes(cbNode, cbNodes, node.parameters) ||
31823
31847
  visitNode(cbNode, node.type);
31824
31848
  }
31825
- ;
31826
31849
  function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) {
31827
31850
  return visitNodes(cbNode, cbNodes, node.types);
31828
31851
  }
@@ -33124,7 +33147,7 @@ var ts;
33124
33147
  }
33125
33148
  function parsePrivateIdentifier() {
33126
33149
  var pos = getNodePos();
33127
- var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText()));
33150
+ var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
33128
33151
  nextToken();
33129
33152
  return finishNode(node, pos);
33130
33153
  }
@@ -43138,7 +43161,7 @@ var ts;
43138
43161
  function convertCompilerOptionsForTelemetry(opts) {
43139
43162
  var out = {};
43140
43163
  for (var key in opts) {
43141
- if (opts.hasOwnProperty(key)) {
43164
+ if (ts.hasProperty(opts, key)) {
43142
43165
  var type = getOptionFromName(key);
43143
43166
  if (type !== undefined) { // Ignore unknown options
43144
43167
  out[key] = getOptionValueWithEmptyStrings(opts[key], type);
@@ -49642,7 +49665,8 @@ var ts;
49642
49665
  var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */);
49643
49666
  emptyTypeLiteralSymbol.members = ts.createSymbolTable();
49644
49667
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49645
- var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
49668
+ var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49669
+ var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
49646
49670
  var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
49647
49671
  emptyGenericType.instantiations = new ts.Map();
49648
49672
  var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
@@ -49756,6 +49780,8 @@ var ts;
49756
49780
  var deferredGlobalOmitSymbol;
49757
49781
  var deferredGlobalAwaitedSymbol;
49758
49782
  var deferredGlobalBigIntType;
49783
+ var deferredGlobalNaNSymbol;
49784
+ var deferredGlobalRecordSymbol;
49759
49785
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49760
49786
  var flowLoopStart = 0;
49761
49787
  var flowLoopCount = 0;
@@ -50551,12 +50577,13 @@ var ts;
50551
50577
  * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
50552
50578
  * the given name can be found.
50553
50579
  *
50580
+ * @param nameNotFoundMessage If defined, we will report errors found during resolve.
50554
50581
  * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters.
50555
50582
  */
50556
- function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) {
50583
+ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) {
50557
50584
  if (excludeGlobals === void 0) { excludeGlobals = false; }
50558
- if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; }
50559
- return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol);
50585
+ if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; }
50586
+ return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol);
50560
50587
  }
50561
50588
  function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) {
50562
50589
  var _a, _b, _c;
@@ -50714,7 +50741,9 @@ var ts;
50714
50741
  // TypeScript 1.0 spec (April 2014): 3.4.1
50715
50742
  // The scope of a type parameter extends over the entire declaration with which the type
50716
50743
  // parameter list is associated, with the exception of static member declarations in classes.
50717
- error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50744
+ if (nameNotFoundMessage) {
50745
+ error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters);
50746
+ }
50718
50747
  return undefined;
50719
50748
  }
50720
50749
  break loop;
@@ -50752,7 +50781,9 @@ var ts;
50752
50781
  if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) {
50753
50782
  // A reference to this grandparent's type parameters would be an error
50754
50783
  if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) {
50755
- error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50784
+ if (nameNotFoundMessage) {
50785
+ error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
50786
+ }
50756
50787
  return undefined;
50757
50788
  }
50758
50789
  }
@@ -50948,7 +50979,7 @@ var ts;
50948
50979
  }
50949
50980
  return undefined;
50950
50981
  }
50951
- else if (checkAndReportErrorForInvalidInitializer()) {
50982
+ else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) {
50952
50983
  return undefined;
50953
50984
  }
50954
50985
  // Perform extra checks only if error reporting was requested
@@ -57109,7 +57140,6 @@ var ts;
57109
57140
  return container;
57110
57141
  }
57111
57142
  }
57112
- ;
57113
57143
  }
57114
57144
  /** Create a synthetic property access flow node after the last statement of the file */
57115
57145
  function getFlowTypeFromCommonJSExport(symbol) {
@@ -60239,7 +60269,7 @@ var ts;
60239
60269
  var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
60240
60270
  // If the symbols are instances of one another with identical types - consider the symbols
60241
60271
  // equivalent and just use the first one, which thus allows us to avoid eliding private
60242
- // members when intersecting a (this-)instantiations of a class with it's raw base or another instance
60272
+ // members when intersecting a (this-)instantiations of a class with its raw base or another instance
60243
60273
  if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
60244
60274
  // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
60245
60275
  // to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
@@ -60287,7 +60317,11 @@ var ts;
60287
60317
  }
60288
60318
  }
60289
60319
  }
60290
- if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) {
60320
+ if (!singleProp ||
60321
+ isUnion &&
60322
+ (propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
60323
+ checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
60324
+ !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
60291
60325
  // No property was found, or, in a union, a property has a private or protected declaration in one
60292
60326
  // constituent, but is missing or has a different declaration in another constituent.
60293
60327
  return undefined;
@@ -60389,6 +60423,33 @@ var ts;
60389
60423
  }
60390
60424
  return property;
60391
60425
  }
60426
+ function getCommonDeclarationsOfSymbols(symbols) {
60427
+ var commonDeclarations;
60428
+ var _loop_14 = function (symbol) {
60429
+ if (!symbol.declarations) {
60430
+ return { value: undefined };
60431
+ }
60432
+ if (!commonDeclarations) {
60433
+ commonDeclarations = new ts.Set(symbol.declarations);
60434
+ return "continue";
60435
+ }
60436
+ commonDeclarations.forEach(function (declaration) {
60437
+ if (!ts.contains(symbol.declarations, declaration)) {
60438
+ commonDeclarations.delete(declaration);
60439
+ }
60440
+ });
60441
+ if (commonDeclarations.size === 0) {
60442
+ return { value: undefined };
60443
+ }
60444
+ };
60445
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
60446
+ var symbol = symbols_3[_i];
60447
+ var state_4 = _loop_14(symbol);
60448
+ if (typeof state_4 === "object")
60449
+ return state_4.value;
60450
+ }
60451
+ return commonDeclarations;
60452
+ }
60392
60453
  function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
60393
60454
  var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
60394
60455
  // We need to filter out partial properties in union types
@@ -61103,7 +61164,7 @@ var ts;
61103
61164
  function getIndexInfosOfIndexSymbol(indexSymbol) {
61104
61165
  if (indexSymbol.declarations) {
61105
61166
  var indexInfos_4 = [];
61106
- var _loop_14 = function (declaration) {
61167
+ var _loop_15 = function (declaration) {
61107
61168
  if (declaration.parameters.length === 1) {
61108
61169
  var parameter = declaration.parameters[0];
61109
61170
  if (parameter.type) {
@@ -61117,7 +61178,7 @@ var ts;
61117
61178
  };
61118
61179
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
61119
61180
  var declaration = _a[_i];
61120
- _loop_14(declaration);
61181
+ _loop_15(declaration);
61121
61182
  }
61122
61183
  return indexInfos_4;
61123
61184
  }
@@ -61134,7 +61195,7 @@ var ts;
61134
61195
  var _a;
61135
61196
  var inferences;
61136
61197
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
61137
- var _loop_15 = function (declaration) {
61198
+ var _loop_16 = function (declaration) {
61138
61199
  if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
61139
61200
  // When an 'infer T' declaration is immediately contained in a type reference node
61140
61201
  // (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@@ -61198,7 +61259,7 @@ var ts;
61198
61259
  };
61199
61260
  for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
61200
61261
  var declaration = _b[_i];
61201
- _loop_15(declaration);
61262
+ _loop_16(declaration);
61202
61263
  }
61203
61264
  }
61204
61265
  return inferences && getIntersectionType(inferences);
@@ -61855,6 +61916,13 @@ var ts;
61855
61916
  function getGlobalBigIntType() {
61856
61917
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61857
61918
  }
61919
+ function getGlobalNaNSymbol() {
61920
+ return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
61921
+ }
61922
+ function getGlobalRecordSymbol() {
61923
+ deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61924
+ return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
61925
+ }
61858
61926
  /**
61859
61927
  * Instantiates a global type that is generic with some element type, and returns that instantiation.
61860
61928
  */
@@ -62091,7 +62159,7 @@ var ts;
62091
62159
  var lastRequiredIndex = -1;
62092
62160
  var firstRestIndex = -1;
62093
62161
  var lastOptionalOrRestIndex = -1;
62094
- var _loop_16 = function (i) {
62162
+ var _loop_17 = function (i) {
62095
62163
  var type = elementTypes[i];
62096
62164
  var flags = target.elementFlags[i];
62097
62165
  if (flags & 8 /* ElementFlags.Variadic */) {
@@ -62121,9 +62189,9 @@ var ts;
62121
62189
  }
62122
62190
  };
62123
62191
  for (var i = 0; i < elementTypes.length; i++) {
62124
- var state_4 = _loop_16(i);
62125
- if (typeof state_4 === "object")
62126
- return state_4.value;
62192
+ var state_5 = _loop_17(i);
62193
+ if (typeof state_5 === "object")
62194
+ return state_5.value;
62127
62195
  }
62128
62196
  // Turn optional elements preceding the last required element into required elements
62129
62197
  for (var i = 0; i < lastRequiredIndex; i++) {
@@ -62151,7 +62219,7 @@ var ts;
62151
62219
  if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
62152
62220
  lastOptionalOrRestIndex = expandedFlags.length;
62153
62221
  }
62154
- expandedTypes.push(type);
62222
+ expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
62155
62223
  expandedFlags.push(flags);
62156
62224
  if (expandedDeclarations && declaration) {
62157
62225
  expandedDeclarations.push(declaration);
@@ -62317,7 +62385,7 @@ var ts;
62317
62385
  var templates = ts.filter(types, isPatternLiteralType);
62318
62386
  if (templates.length) {
62319
62387
  var i = types.length;
62320
- var _loop_17 = function () {
62388
+ var _loop_18 = function () {
62321
62389
  i--;
62322
62390
  var t = types[i];
62323
62391
  if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -62325,7 +62393,7 @@ var ts;
62325
62393
  }
62326
62394
  };
62327
62395
  while (i > 0) {
62328
- _loop_17();
62396
+ _loop_18();
62329
62397
  }
62330
62398
  }
62331
62399
  }
@@ -62402,14 +62470,14 @@ var ts;
62402
62470
  var namedUnions = [];
62403
62471
  addNamedUnions(namedUnions, types);
62404
62472
  var reducedTypes = [];
62405
- var _loop_18 = function (t) {
62473
+ var _loop_19 = function (t) {
62406
62474
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
62407
62475
  reducedTypes.push(t);
62408
62476
  }
62409
62477
  };
62410
62478
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
62411
62479
  var t = typeSet_1[_i];
62412
- _loop_18(t);
62480
+ _loop_19(t);
62413
62481
  }
62414
62482
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
62415
62483
  return namedUnions[0];
@@ -63639,7 +63707,7 @@ var ts;
63639
63707
  var result;
63640
63708
  var extraTypes;
63641
63709
  var tailCount = 0;
63642
- var _loop_19 = function () {
63710
+ var _loop_20 = function () {
63643
63711
  if (tailCount === 1000) {
63644
63712
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63645
63713
  result = errorType;
@@ -63760,10 +63828,10 @@ var ts;
63760
63828
  // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63761
63829
  // cases we increment the tail recursion counter and stop after 1000 iterations.
63762
63830
  while (true) {
63763
- var state_5 = _loop_19();
63764
- if (typeof state_5 === "object")
63765
- return state_5.value;
63766
- if (state_5 === "break")
63831
+ var state_6 = _loop_20();
63832
+ if (typeof state_6 === "object")
63833
+ return state_6.value;
63834
+ if (state_6 === "break")
63767
63835
  break;
63768
63836
  }
63769
63837
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
@@ -66378,7 +66446,7 @@ var ts;
66378
66446
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66379
66447
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66380
66448
  }
66381
- var _loop_20 = function (prop) {
66449
+ var _loop_21 = function (prop) {
66382
66450
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66383
66451
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66384
66452
  if (reportErrors) {
@@ -66441,9 +66509,9 @@ var ts;
66441
66509
  };
66442
66510
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66443
66511
  var prop = _b[_i];
66444
- var state_6 = _loop_20(prop);
66445
- if (typeof state_6 === "object")
66446
- return state_6.value;
66512
+ var state_7 = _loop_21(prop);
66513
+ if (typeof state_7 === "object")
66514
+ return state_7.value;
66447
66515
  }
66448
66516
  return false;
66449
66517
  }
@@ -67434,11 +67502,11 @@ var ts;
67434
67502
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67435
67503
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67436
67504
  var matchingTypes = [];
67437
- var _loop_21 = function (combination) {
67505
+ var _loop_22 = function (combination) {
67438
67506
  var hasMatch = false;
67439
67507
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67440
67508
  var type = _d[_c];
67441
- var _loop_22 = function (i) {
67509
+ var _loop_23 = function (i) {
67442
67510
  var sourceProperty = sourcePropertiesFiltered[i];
67443
67511
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67444
67512
  if (!targetProperty)
@@ -67454,8 +67522,8 @@ var ts;
67454
67522
  }
67455
67523
  };
67456
67524
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67457
- var state_8 = _loop_22(i);
67458
- switch (state_8) {
67525
+ var state_9 = _loop_23(i);
67526
+ switch (state_9) {
67459
67527
  case "continue-outer": continue outer;
67460
67528
  }
67461
67529
  }
@@ -67468,9 +67536,9 @@ var ts;
67468
67536
  };
67469
67537
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67470
67538
  var combination = discriminantCombinations_1[_a];
67471
- var state_7 = _loop_21(combination);
67472
- if (typeof state_7 === "object")
67473
- return state_7.value;
67539
+ var state_8 = _loop_22(combination);
67540
+ if (typeof state_8 === "object")
67541
+ return state_8.value;
67474
67542
  }
67475
67543
  // Compare the remaining non-discriminant properties of each match.
67476
67544
  var result = -1 /* Ternary.True */;
@@ -68175,7 +68243,7 @@ var ts;
68175
68243
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68176
68244
  links.variances = ts.emptyArray;
68177
68245
  var variances = [];
68178
- var _loop_23 = function (tp) {
68246
+ var _loop_24 = function (tp) {
68179
68247
  var modifiers = getVarianceModifiers(tp);
68180
68248
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68181
68249
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68213,7 +68281,7 @@ var ts;
68213
68281
  };
68214
68282
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68215
68283
  var tp = typeParameters_2[_i];
68216
- _loop_23(tp);
68284
+ _loop_24(tp);
68217
68285
  }
68218
68286
  links.variances = variances;
68219
68287
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68805,7 +68873,8 @@ var ts;
68805
68873
  function getOptionalType(type, isProperty) {
68806
68874
  if (isProperty === void 0) { isProperty = false; }
68807
68875
  ts.Debug.assert(strictNullChecks);
68808
- return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
68876
+ var missingOrUndefined = isProperty ? missingType : undefinedType;
68877
+ return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
68809
68878
  }
68810
68879
  function getGlobalNonNullableTypeInstantiation(type) {
68811
68880
  if (!deferredGlobalNonNullableTypeAlias) {
@@ -70170,7 +70239,7 @@ var ts;
70170
70239
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70171
70240
  // succeed. That would be a pointless and confusing outcome.
70172
70241
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70173
- var _loop_24 = function (i) {
70242
+ var _loop_25 = function (i) {
70174
70243
  var source_1 = matches ? matches[i] : neverType;
70175
70244
  var target_3 = types[i];
70176
70245
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70220,7 +70289,7 @@ var ts;
70220
70289
  inferFromTypes(source_1, target_3);
70221
70290
  };
70222
70291
  for (var i = 0; i < types.length; i++) {
70223
- _loop_24(i);
70292
+ _loop_25(i);
70224
70293
  }
70225
70294
  }
70226
70295
  }
@@ -70684,7 +70753,7 @@ var ts;
70684
70753
  return name;
70685
70754
  }
70686
70755
  }
70687
- if (ts.hasOnlyExpressionInitializer(declaration)) {
70756
+ if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70688
70757
  var initializer = ts.getEffectiveInitializer(declaration);
70689
70758
  return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70690
70759
  }
@@ -70744,7 +70813,7 @@ var ts;
70744
70813
  function mapTypesByKeyProperty(types, name) {
70745
70814
  var map = new ts.Map();
70746
70815
  var count = 0;
70747
- var _loop_25 = function (type) {
70816
+ var _loop_26 = function (type) {
70748
70817
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70749
70818
  var discriminant = getTypeOfPropertyOfType(type, name);
70750
70819
  if (discriminant) {
@@ -70770,9 +70839,9 @@ var ts;
70770
70839
  };
70771
70840
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70772
70841
  var type = types_15[_i];
70773
- var state_9 = _loop_25(type);
70774
- if (typeof state_9 === "object")
70775
- return state_9.value;
70842
+ var state_10 = _loop_26(type);
70843
+ if (typeof state_10 === "object")
70844
+ return state_10.value;
70776
70845
  }
70777
70846
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70778
70847
  }
@@ -72171,18 +72240,26 @@ var ts;
72171
72240
  }
72172
72241
  function isTypePresencePossible(type, propName, assumeTrue) {
72173
72242
  var prop = getPropertyOfType(type, propName);
72174
- if (prop) {
72175
- return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue;
72176
- }
72177
- return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue;
72178
- }
72179
- function narrowByInKeyword(type, name, assumeTrue) {
72180
- if (type.flags & 1048576 /* TypeFlags.Union */
72181
- || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type))
72182
- || ts.isThisTypeParameter(type)
72183
- || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) {
72243
+ return prop ?
72244
+ !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
72245
+ !!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
72246
+ }
72247
+ function narrowByInKeyword(type, nameType, assumeTrue) {
72248
+ var name = getPropertyNameFromType(nameType);
72249
+ var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
72250
+ if (isKnownProperty) {
72251
+ // If the check is for a known property (i.e. a property declared in some constituent of
72252
+ // the target type), we filter the target type by presence of absence of the property.
72184
72253
  return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); });
72185
72254
  }
72255
+ if (assumeTrue) {
72256
+ // If the check is for an unknown property, we intersect the target type with `Record<X, unknown>`,
72257
+ // where X is the name of the property.
72258
+ var recordSymbol = getGlobalRecordSymbol();
72259
+ if (recordSymbol) {
72260
+ return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]);
72261
+ }
72262
+ }
72186
72263
  return type;
72187
72264
  }
72188
72265
  function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
@@ -72241,15 +72318,14 @@ var ts;
72241
72318
  return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
72242
72319
  }
72243
72320
  var target = getReferenceCandidate(expr.right);
72244
- var leftType = getTypeOfNode(expr.left);
72245
- if (leftType.flags & 128 /* TypeFlags.StringLiteral */) {
72246
- var name = ts.escapeLeadingUnderscores(leftType.value);
72321
+ var leftType = getTypeOfExpression(expr.left);
72322
+ if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) {
72247
72323
  if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) &&
72248
- getAccessedPropertyName(reference) === name) {
72324
+ getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
72249
72325
  return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
72250
72326
  }
72251
72327
  if (isMatchingReference(reference, target)) {
72252
- return narrowByInKeyword(type, name, assumeTrue);
72328
+ return narrowByInKeyword(type, leftType, assumeTrue);
72253
72329
  }
72254
72330
  }
72255
72331
  break;
@@ -76419,7 +76495,6 @@ var ts;
76419
76495
  }
76420
76496
  return false;
76421
76497
  }
76422
- ;
76423
76498
  var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
76424
76499
  if (!hasProp(suggestedMethod)) {
76425
76500
  return undefined;
@@ -77221,7 +77296,7 @@ var ts;
77221
77296
  if (spreadIndex >= 0) {
77222
77297
  // Create synthetic arguments from spreads of tuple types.
77223
77298
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77224
- var _loop_26 = function (i) {
77299
+ var _loop_27 = function (i) {
77225
77300
  var arg = args[i];
77226
77301
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77227
77302
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77238,7 +77313,7 @@ var ts;
77238
77313
  }
77239
77314
  };
77240
77315
  for (var i = spreadIndex; i < args.length; i++) {
77241
- _loop_26(i);
77316
+ _loop_27(i);
77242
77317
  }
77243
77318
  return effectiveArgs_1;
77244
77319
  }
@@ -77567,7 +77642,7 @@ var ts;
77567
77642
  var min_3 = Number.MAX_VALUE;
77568
77643
  var minIndex = 0;
77569
77644
  var i_1 = 0;
77570
- var _loop_27 = function (c) {
77645
+ var _loop_28 = function (c) {
77571
77646
  var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
77572
77647
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77573
77648
  if (diags_2) {
@@ -77585,7 +77660,7 @@ var ts;
77585
77660
  };
77586
77661
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77587
77662
  var c = candidatesForArgumentError_1[_a];
77588
- _loop_27(c);
77663
+ _loop_28(c);
77589
77664
  }
77590
77665
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77591
77666
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77743,7 +77818,7 @@ var ts;
77743
77818
  }
77744
77819
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77745
77820
  var parameters = [];
77746
- var _loop_28 = function (i) {
77821
+ var _loop_29 = function (i) {
77747
77822
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77748
77823
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77749
77824
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77751,7 +77826,7 @@ var ts;
77751
77826
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77752
77827
  };
77753
77828
  for (var i = 0; i < maxNonRestParam; i++) {
77754
- _loop_28(i);
77829
+ _loop_29(i);
77755
77830
  }
77756
77831
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77757
77832
  var flags = 0 /* SignatureFlags.None */;
@@ -79990,6 +80065,9 @@ var ts;
79990
80065
  }
79991
80066
  return booleanType;
79992
80067
  }
80068
+ function hasEmptyObjectIntersection(type) {
80069
+ return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); });
80070
+ }
79993
80071
  function checkInExpression(left, right, leftType, rightType) {
79994
80072
  if (leftType === silentNeverType || rightType === silentNeverType) {
79995
80073
  return silentNeverType;
@@ -80006,40 +80084,20 @@ var ts;
80006
80084
  }
80007
80085
  }
80008
80086
  else {
80009
- leftType = checkNonNullType(leftType, left);
80010
- // TypeScript 1.0 spec (April 2014): 4.15.5
80011
- // Require the left operand to be of type Any, the String primitive type, or the Number primitive type.
80012
- if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) ||
80013
- isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) {
80014
- 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);
80087
+ // The type of the lef operand must be assignable to string, number, or symbol.
80088
+ checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left);
80089
+ }
80090
+ // The type of the right operand must be assignable to 'object'.
80091
+ if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) {
80092
+ // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we
80093
+ // detect and error on {} that results from narrowing the unknown type, as well as intersections
80094
+ // that include {} (we know that the other types in such intersections are assignable to object
80095
+ // since we already checked for that).
80096
+ if (hasEmptyObjectIntersection(rightType)) {
80097
+ 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));
80015
80098
  }
80016
80099
  }
80017
- rightType = checkNonNullType(rightType, right);
80018
- // TypeScript 1.0 spec (April 2014): 4.15.5
80019
- // The in operator requires the right operand to be
80020
- //
80021
- // 1. assignable to the non-primitive type,
80022
- // 2. an unconstrained type parameter,
80023
- // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the
80024
- // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the
80025
- // non-primitive type, or
80026
- // 4. a type parameter whose constraint is
80027
- // i. an object type,
80028
- // ii. the non-primitive type, or
80029
- // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type.
80030
- //
80031
- // The divergent behavior for type parameters and unions containing type parameters is a workaround for type
80032
- // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance
80033
- // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error
80034
- // unless *all* instantiations would result in an error.
80035
- //
80036
80100
  // The result is always of the Boolean primitive type.
80037
- var rightTypeConstraint = getConstraintOfType(rightType);
80038
- if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80039
- rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) ||
80040
- !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) {
80041
- error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive);
80042
- }
80043
80101
  return booleanType;
80044
80102
  }
80045
80103
  function checkObjectLiteralAssignment(node, sourceType, rightIsThis) {
@@ -80550,6 +80608,7 @@ var ts;
80550
80608
  var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
80551
80609
  error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
80552
80610
  }
80611
+ checkNaNEquality(errorNode, operator, left, right);
80553
80612
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
80554
80613
  return booleanType;
80555
80614
  case 102 /* SyntaxKind.InstanceOfKeyword */:
@@ -80755,6 +80814,26 @@ var ts;
80755
80814
  return undefined;
80756
80815
  }
80757
80816
  }
80817
+ function checkNaNEquality(errorNode, operator, left, right) {
80818
+ var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
80819
+ var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
80820
+ if (isLeftNaN || isRightNaN) {
80821
+ var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */));
80822
+ if (isLeftNaN && isRightNaN)
80823
+ return;
80824
+ var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
80825
+ var location = isLeftNaN ? right : left;
80826
+ var expression = ts.skipParentheses(location);
80827
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
80828
+ }
80829
+ }
80830
+ function isGlobalNaN(expr) {
80831
+ if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
80832
+ var globalNaNSymbol = getGlobalNaNSymbol();
80833
+ return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
80834
+ }
80835
+ return false;
80836
+ }
80758
80837
  }
80759
80838
  function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
80760
80839
  var effectiveLeft = leftType;
@@ -81792,7 +81871,7 @@ var ts;
81792
81871
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81793
81872
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81794
81873
  var indexSignatureMap_1 = new ts.Map();
81795
- var _loop_29 = function (declaration) {
81874
+ var _loop_30 = function (declaration) {
81796
81875
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81797
81876
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81798
81877
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81807,7 +81886,7 @@ var ts;
81807
81886
  };
81808
81887
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81809
81888
  var declaration = _a[_i];
81810
- _loop_29(declaration);
81889
+ _loop_30(declaration);
81811
81890
  }
81812
81891
  indexSignatureMap_1.forEach(function (entry) {
81813
81892
  if (entry.declarations.length > 1) {
@@ -85407,7 +85486,7 @@ var ts;
85407
85486
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85408
85487
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85409
85488
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85410
- var _loop_30 = function (info) {
85489
+ var _loop_31 = function (info) {
85411
85490
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85412
85491
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85413
85492
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85424,7 +85503,7 @@ var ts;
85424
85503
  };
85425
85504
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85426
85505
  var info = indexInfos_9[_i];
85427
- _loop_30(info);
85506
+ _loop_31(info);
85428
85507
  }
85429
85508
  }
85430
85509
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85432,7 +85511,7 @@ var ts;
85432
85511
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85433
85512
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85434
85513
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85435
- var _loop_31 = function (info) {
85514
+ var _loop_32 = function (info) {
85436
85515
  if (info === checkInfo)
85437
85516
  return "continue";
85438
85517
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85447,7 +85526,7 @@ var ts;
85447
85526
  };
85448
85527
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85449
85528
  var info = indexInfos_10[_i];
85450
- _loop_31(info);
85529
+ _loop_32(info);
85451
85530
  }
85452
85531
  }
85453
85532
  function checkTypeNameIsReserved(name, message) {
@@ -85767,7 +85846,7 @@ var ts;
85767
85846
  var baseTypes = baseTypeNode && getBaseTypes(type);
85768
85847
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85769
85848
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85770
- var _loop_32 = function (member) {
85849
+ var _loop_33 = function (member) {
85771
85850
  if (ts.hasAmbientModifier(member)) {
85772
85851
  return "continue";
85773
85852
  }
@@ -85784,7 +85863,7 @@ var ts;
85784
85863
  };
85785
85864
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85786
85865
  var member = _a[_i];
85787
- _loop_32(member);
85866
+ _loop_33(member);
85788
85867
  }
85789
85868
  }
85790
85869
  /**
@@ -85872,7 +85951,7 @@ var ts;
85872
85951
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85873
85952
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
85874
85953
  var issuedMemberError = false;
85875
- var _loop_33 = function (member) {
85954
+ var _loop_34 = function (member) {
85876
85955
  if (ts.isStatic(member)) {
85877
85956
  return "continue";
85878
85957
  }
@@ -85891,7 +85970,7 @@ var ts;
85891
85970
  };
85892
85971
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85893
85972
  var member = _a[_i];
85894
- _loop_33(member);
85973
+ _loop_34(member);
85895
85974
  }
85896
85975
  if (!issuedMemberError) {
85897
85976
  // check again with diagnostics to generate a less-specific error
@@ -85962,7 +86041,7 @@ var ts;
85962
86041
  var _a, _b, _c, _d;
85963
86042
  // NOTE: assignability is checked in checkClassDeclaration
85964
86043
  var baseProperties = getPropertiesOfType(baseType);
85965
- var _loop_34 = function (baseProperty) {
86044
+ var _loop_35 = function (baseProperty) {
85966
86045
  var base = getTargetSymbol(baseProperty);
85967
86046
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
85968
86047
  return "continue";
@@ -86072,8 +86151,8 @@ var ts;
86072
86151
  };
86073
86152
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86074
86153
  var baseProperty = baseProperties_1[_i];
86075
- var state_10 = _loop_34(baseProperty);
86076
- switch (state_10) {
86154
+ var state_11 = _loop_35(baseProperty);
86155
+ switch (state_11) {
86077
86156
  case "continue-basePropertyCheck": continue basePropertyCheck;
86078
86157
  }
86079
86158
  }
@@ -88481,7 +88560,7 @@ var ts;
88481
88560
  }
88482
88561
  var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
88483
88562
  if (node) {
88484
- var symbol = getReferencedValueSymbol(node);
88563
+ var symbol = getReferencedValueOrAliasSymbol(node);
88485
88564
  // We should only get the declaration of an alias if there isn't a local value
88486
88565
  // declaration for the symbol
88487
88566
  if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) {
@@ -88848,6 +88927,25 @@ var ts;
88848
88927
  }
88849
88928
  return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
88850
88929
  }
88930
+ /**
88931
+ * Get either a value-meaning symbol or an alias symbol.
88932
+ * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol,
88933
+ * we call `resolveName` to find a symbol.
88934
+ * This is because when caching the resolved symbol, we only consider value symbols, but here
88935
+ * we want to also get an alias symbol if one exists.
88936
+ */
88937
+ function getReferencedValueOrAliasSymbol(reference) {
88938
+ var resolvedSymbol = getNodeLinks(reference).resolvedSymbol;
88939
+ if (resolvedSymbol && resolvedSymbol !== unknownSymbol) {
88940
+ return resolvedSymbol;
88941
+ }
88942
+ return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */,
88943
+ /*nodeNotFoundMessage*/ undefined,
88944
+ /*nameArg*/ undefined,
88945
+ /*isUse*/ true,
88946
+ /*excludeGlobals*/ undefined,
88947
+ /*getSpellingSuggestions*/ undefined);
88948
+ }
88851
88949
  function getReferencedValueDeclaration(referenceIn) {
88852
88950
  if (!ts.isGeneratedIdentifier(referenceIn)) {
88853
88951
  var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier);
@@ -95297,9 +95395,10 @@ var ts;
95297
95395
  return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined;
95298
95396
  }
95299
95397
  function shouldEmitAliasDeclaration(node) {
95300
- return compilerOptions.preserveValueImports
95301
- ? resolver.isValueAliasDeclaration(node)
95302
- : resolver.isReferencedAliasDeclaration(node);
95398
+ return ts.isInJSFile(node) ||
95399
+ (compilerOptions.preserveValueImports
95400
+ ? resolver.isValueAliasDeclaration(node)
95401
+ : resolver.isReferencedAliasDeclaration(node));
95303
95402
  }
95304
95403
  }
95305
95404
  ts.transformTypeScript = transformTypeScript;
@@ -110471,7 +110570,7 @@ var ts;
110471
110570
  var _a;
110472
110571
  var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; });
110473
110572
  var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; });
110474
- if (augmentingDeclarations) {
110573
+ if (primaryDeclaration && augmentingDeclarations) {
110475
110574
  for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) {
110476
110575
  var augmentations = augmentingDeclarations_1[_i];
110477
110576
  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)));
@@ -118520,7 +118619,6 @@ var ts;
118520
118619
  return resolutions;
118521
118620
  }
118522
118621
  ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache;
118523
- ;
118524
118622
  /**
118525
118623
  * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly
118526
118624
  * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file.
@@ -124897,7 +124995,7 @@ var ts;
124897
124995
  });
124898
124996
  // Sort by paths closest to importing file Name directory
124899
124997
  var sortedPaths = [];
124900
- var _loop_35 = function (directory) {
124998
+ var _loop_36 = function (directory) {
124901
124999
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
124902
125000
  var pathsInDirectory;
124903
125001
  allFileNames.forEach(function (_a, fileName) {
@@ -124921,9 +125019,9 @@ var ts;
124921
125019
  };
124922
125020
  var out_directory_1;
124923
125021
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
124924
- var state_11 = _loop_35(directory);
125022
+ var state_12 = _loop_36(directory);
124925
125023
  directory = out_directory_1;
124926
- if (state_11 === "break")
125024
+ if (state_12 === "break")
124927
125025
  break;
124928
125026
  }
124929
125027
  if (allFileNames.size) {
@@ -124992,7 +125090,7 @@ var ts;
124992
125090
  }
124993
125091
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
124994
125092
  for (var key in paths) {
124995
- var _loop_36 = function (patternText_1) {
125093
+ var _loop_37 = function (patternText_1) {
124996
125094
  var pattern = ts.normalizePath(patternText_1);
124997
125095
  var indexOfStar = pattern.indexOf("*");
124998
125096
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125059,9 +125157,9 @@ var ts;
125059
125157
  };
125060
125158
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125061
125159
  var patternText_1 = _a[_i];
125062
- var state_12 = _loop_36(patternText_1);
125063
- if (typeof state_12 === "object")
125064
- return state_12.value;
125160
+ var state_13 = _loop_37(patternText_1);
125161
+ if (typeof state_13 === "object")
125162
+ return state_13.value;
125065
125163
  }
125066
125164
  }
125067
125165
  function validateEnding(_a) {