typescript 4.9.0-dev.20220920 → 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.20220920");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20220921");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -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 (!ts.hasProperty(ctor, "__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: {
@@ -9113,6 +9113,7 @@ var ts;
9113
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?"),
9114
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."),
9115
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}'."),
9116
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}'."),
9117
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}'."),
9118
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}'."),
@@ -10055,6 +10056,8 @@ var ts;
10055
10056
  Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
10056
10057
  Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
10057
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."),
10058
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."),
10059
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'."),
10060
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?"),
@@ -11877,12 +11880,36 @@ var ts;
11877
11880
  pos++;
11878
11881
  return token = 0 /* SyntaxKind.Unknown */;
11879
11882
  }
11880
- if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) {
11883
+ var charAfterHash = codePointAt(text, pos + 1);
11884
+ if (charAfterHash === 92 /* CharacterCodes.backslash */) {
11881
11885
  pos++;
11882
- scanIdentifier(codePointAt(text, pos), languageVersion);
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)) {
11903
+ pos++;
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);
11883
11910
  }
11884
11911
  else {
11885
- tokenValue = String.fromCharCode(codePointAt(text, pos));
11912
+ tokenValue = "#";
11886
11913
  error(ts.Diagnostics.Invalid_character, pos++, charSize(ch));
11887
11914
  }
11888
11915
  return token = 80 /* SyntaxKind.PrivateIdentifier */;
@@ -33120,7 +33147,7 @@ var ts;
33120
33147
  }
33121
33148
  function parsePrivateIdentifier() {
33122
33149
  var pos = getNodePos();
33123
- var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText()));
33150
+ var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue()));
33124
33151
  nextToken();
33125
33152
  return finishNode(node, pos);
33126
33153
  }
@@ -49753,6 +49780,7 @@ var ts;
49753
49780
  var deferredGlobalOmitSymbol;
49754
49781
  var deferredGlobalAwaitedSymbol;
49755
49782
  var deferredGlobalBigIntType;
49783
+ var deferredGlobalNaNSymbol;
49756
49784
  var deferredGlobalRecordSymbol;
49757
49785
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49758
49786
  var flowLoopStart = 0;
@@ -60241,7 +60269,7 @@ var ts;
60241
60269
  var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
60242
60270
  // If the symbols are instances of one another with identical types - consider the symbols
60243
60271
  // equivalent and just use the first one, which thus allows us to avoid eliding private
60244
- // 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
60245
60273
  if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
60246
60274
  // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
60247
60275
  // to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
@@ -60289,7 +60317,11 @@ var ts;
60289
60317
  }
60290
60318
  }
60291
60319
  }
60292
- 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())))) {
60293
60325
  // No property was found, or, in a union, a property has a private or protected declaration in one
60294
60326
  // constituent, but is missing or has a different declaration in another constituent.
60295
60327
  return undefined;
@@ -60391,6 +60423,33 @@ var ts;
60391
60423
  }
60392
60424
  return property;
60393
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
+ }
60394
60453
  function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
60395
60454
  var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
60396
60455
  // We need to filter out partial properties in union types
@@ -61105,7 +61164,7 @@ var ts;
61105
61164
  function getIndexInfosOfIndexSymbol(indexSymbol) {
61106
61165
  if (indexSymbol.declarations) {
61107
61166
  var indexInfos_4 = [];
61108
- var _loop_14 = function (declaration) {
61167
+ var _loop_15 = function (declaration) {
61109
61168
  if (declaration.parameters.length === 1) {
61110
61169
  var parameter = declaration.parameters[0];
61111
61170
  if (parameter.type) {
@@ -61119,7 +61178,7 @@ var ts;
61119
61178
  };
61120
61179
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
61121
61180
  var declaration = _a[_i];
61122
- _loop_14(declaration);
61181
+ _loop_15(declaration);
61123
61182
  }
61124
61183
  return indexInfos_4;
61125
61184
  }
@@ -61136,7 +61195,7 @@ var ts;
61136
61195
  var _a;
61137
61196
  var inferences;
61138
61197
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
61139
- var _loop_15 = function (declaration) {
61198
+ var _loop_16 = function (declaration) {
61140
61199
  if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
61141
61200
  // When an 'infer T' declaration is immediately contained in a type reference node
61142
61201
  // (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@@ -61200,7 +61259,7 @@ var ts;
61200
61259
  };
61201
61260
  for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
61202
61261
  var declaration = _b[_i];
61203
- _loop_15(declaration);
61262
+ _loop_16(declaration);
61204
61263
  }
61205
61264
  }
61206
61265
  return inferences && getIntersectionType(inferences);
@@ -61857,6 +61916,9 @@ var ts;
61857
61916
  function getGlobalBigIntType() {
61858
61917
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61859
61918
  }
61919
+ function getGlobalNaNSymbol() {
61920
+ return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
61921
+ }
61860
61922
  function getGlobalRecordSymbol() {
61861
61923
  deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61862
61924
  return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
@@ -62097,7 +62159,7 @@ var ts;
62097
62159
  var lastRequiredIndex = -1;
62098
62160
  var firstRestIndex = -1;
62099
62161
  var lastOptionalOrRestIndex = -1;
62100
- var _loop_16 = function (i) {
62162
+ var _loop_17 = function (i) {
62101
62163
  var type = elementTypes[i];
62102
62164
  var flags = target.elementFlags[i];
62103
62165
  if (flags & 8 /* ElementFlags.Variadic */) {
@@ -62127,9 +62189,9 @@ var ts;
62127
62189
  }
62128
62190
  };
62129
62191
  for (var i = 0; i < elementTypes.length; i++) {
62130
- var state_4 = _loop_16(i);
62131
- if (typeof state_4 === "object")
62132
- return state_4.value;
62192
+ var state_5 = _loop_17(i);
62193
+ if (typeof state_5 === "object")
62194
+ return state_5.value;
62133
62195
  }
62134
62196
  // Turn optional elements preceding the last required element into required elements
62135
62197
  for (var i = 0; i < lastRequiredIndex; i++) {
@@ -62157,7 +62219,7 @@ var ts;
62157
62219
  if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
62158
62220
  lastOptionalOrRestIndex = expandedFlags.length;
62159
62221
  }
62160
- expandedTypes.push(type);
62222
+ expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
62161
62223
  expandedFlags.push(flags);
62162
62224
  if (expandedDeclarations && declaration) {
62163
62225
  expandedDeclarations.push(declaration);
@@ -62323,7 +62385,7 @@ var ts;
62323
62385
  var templates = ts.filter(types, isPatternLiteralType);
62324
62386
  if (templates.length) {
62325
62387
  var i = types.length;
62326
- var _loop_17 = function () {
62388
+ var _loop_18 = function () {
62327
62389
  i--;
62328
62390
  var t = types[i];
62329
62391
  if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -62331,7 +62393,7 @@ var ts;
62331
62393
  }
62332
62394
  };
62333
62395
  while (i > 0) {
62334
- _loop_17();
62396
+ _loop_18();
62335
62397
  }
62336
62398
  }
62337
62399
  }
@@ -62408,14 +62470,14 @@ var ts;
62408
62470
  var namedUnions = [];
62409
62471
  addNamedUnions(namedUnions, types);
62410
62472
  var reducedTypes = [];
62411
- var _loop_18 = function (t) {
62473
+ var _loop_19 = function (t) {
62412
62474
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
62413
62475
  reducedTypes.push(t);
62414
62476
  }
62415
62477
  };
62416
62478
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
62417
62479
  var t = typeSet_1[_i];
62418
- _loop_18(t);
62480
+ _loop_19(t);
62419
62481
  }
62420
62482
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
62421
62483
  return namedUnions[0];
@@ -63645,7 +63707,7 @@ var ts;
63645
63707
  var result;
63646
63708
  var extraTypes;
63647
63709
  var tailCount = 0;
63648
- var _loop_19 = function () {
63710
+ var _loop_20 = function () {
63649
63711
  if (tailCount === 1000) {
63650
63712
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63651
63713
  result = errorType;
@@ -63766,10 +63828,10 @@ var ts;
63766
63828
  // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63767
63829
  // cases we increment the tail recursion counter and stop after 1000 iterations.
63768
63830
  while (true) {
63769
- var state_5 = _loop_19();
63770
- if (typeof state_5 === "object")
63771
- return state_5.value;
63772
- 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")
63773
63835
  break;
63774
63836
  }
63775
63837
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
@@ -66384,7 +66446,7 @@ var ts;
66384
66446
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66385
66447
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66386
66448
  }
66387
- var _loop_20 = function (prop) {
66449
+ var _loop_21 = function (prop) {
66388
66450
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66389
66451
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66390
66452
  if (reportErrors) {
@@ -66447,9 +66509,9 @@ var ts;
66447
66509
  };
66448
66510
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66449
66511
  var prop = _b[_i];
66450
- var state_6 = _loop_20(prop);
66451
- if (typeof state_6 === "object")
66452
- return state_6.value;
66512
+ var state_7 = _loop_21(prop);
66513
+ if (typeof state_7 === "object")
66514
+ return state_7.value;
66453
66515
  }
66454
66516
  return false;
66455
66517
  }
@@ -67440,11 +67502,11 @@ var ts;
67440
67502
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67441
67503
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67442
67504
  var matchingTypes = [];
67443
- var _loop_21 = function (combination) {
67505
+ var _loop_22 = function (combination) {
67444
67506
  var hasMatch = false;
67445
67507
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67446
67508
  var type = _d[_c];
67447
- var _loop_22 = function (i) {
67509
+ var _loop_23 = function (i) {
67448
67510
  var sourceProperty = sourcePropertiesFiltered[i];
67449
67511
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67450
67512
  if (!targetProperty)
@@ -67460,8 +67522,8 @@ var ts;
67460
67522
  }
67461
67523
  };
67462
67524
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67463
- var state_8 = _loop_22(i);
67464
- switch (state_8) {
67525
+ var state_9 = _loop_23(i);
67526
+ switch (state_9) {
67465
67527
  case "continue-outer": continue outer;
67466
67528
  }
67467
67529
  }
@@ -67474,9 +67536,9 @@ var ts;
67474
67536
  };
67475
67537
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67476
67538
  var combination = discriminantCombinations_1[_a];
67477
- var state_7 = _loop_21(combination);
67478
- if (typeof state_7 === "object")
67479
- return state_7.value;
67539
+ var state_8 = _loop_22(combination);
67540
+ if (typeof state_8 === "object")
67541
+ return state_8.value;
67480
67542
  }
67481
67543
  // Compare the remaining non-discriminant properties of each match.
67482
67544
  var result = -1 /* Ternary.True */;
@@ -68181,7 +68243,7 @@ var ts;
68181
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)) });
68182
68244
  links.variances = ts.emptyArray;
68183
68245
  var variances = [];
68184
- var _loop_23 = function (tp) {
68246
+ var _loop_24 = function (tp) {
68185
68247
  var modifiers = getVarianceModifiers(tp);
68186
68248
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68187
68249
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68219,7 +68281,7 @@ var ts;
68219
68281
  };
68220
68282
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68221
68283
  var tp = typeParameters_2[_i];
68222
- _loop_23(tp);
68284
+ _loop_24(tp);
68223
68285
  }
68224
68286
  links.variances = variances;
68225
68287
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68811,7 +68873,8 @@ var ts;
68811
68873
  function getOptionalType(type, isProperty) {
68812
68874
  if (isProperty === void 0) { isProperty = false; }
68813
68875
  ts.Debug.assert(strictNullChecks);
68814
- 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]);
68815
68878
  }
68816
68879
  function getGlobalNonNullableTypeInstantiation(type) {
68817
68880
  if (!deferredGlobalNonNullableTypeAlias) {
@@ -70176,7 +70239,7 @@ var ts;
70176
70239
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70177
70240
  // succeed. That would be a pointless and confusing outcome.
70178
70241
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70179
- var _loop_24 = function (i) {
70242
+ var _loop_25 = function (i) {
70180
70243
  var source_1 = matches ? matches[i] : neverType;
70181
70244
  var target_3 = types[i];
70182
70245
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70226,7 +70289,7 @@ var ts;
70226
70289
  inferFromTypes(source_1, target_3);
70227
70290
  };
70228
70291
  for (var i = 0; i < types.length; i++) {
70229
- _loop_24(i);
70292
+ _loop_25(i);
70230
70293
  }
70231
70294
  }
70232
70295
  }
@@ -70690,7 +70753,7 @@ var ts;
70690
70753
  return name;
70691
70754
  }
70692
70755
  }
70693
- if (ts.hasOnlyExpressionInitializer(declaration)) {
70756
+ if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70694
70757
  var initializer = ts.getEffectiveInitializer(declaration);
70695
70758
  return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70696
70759
  }
@@ -70750,7 +70813,7 @@ var ts;
70750
70813
  function mapTypesByKeyProperty(types, name) {
70751
70814
  var map = new ts.Map();
70752
70815
  var count = 0;
70753
- var _loop_25 = function (type) {
70816
+ var _loop_26 = function (type) {
70754
70817
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70755
70818
  var discriminant = getTypeOfPropertyOfType(type, name);
70756
70819
  if (discriminant) {
@@ -70776,9 +70839,9 @@ var ts;
70776
70839
  };
70777
70840
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70778
70841
  var type = types_15[_i];
70779
- var state_9 = _loop_25(type);
70780
- if (typeof state_9 === "object")
70781
- return state_9.value;
70842
+ var state_10 = _loop_26(type);
70843
+ if (typeof state_10 === "object")
70844
+ return state_10.value;
70782
70845
  }
70783
70846
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70784
70847
  }
@@ -77233,7 +77296,7 @@ var ts;
77233
77296
  if (spreadIndex >= 0) {
77234
77297
  // Create synthetic arguments from spreads of tuple types.
77235
77298
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77236
- var _loop_26 = function (i) {
77299
+ var _loop_27 = function (i) {
77237
77300
  var arg = args[i];
77238
77301
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77239
77302
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77250,7 +77313,7 @@ var ts;
77250
77313
  }
77251
77314
  };
77252
77315
  for (var i = spreadIndex; i < args.length; i++) {
77253
- _loop_26(i);
77316
+ _loop_27(i);
77254
77317
  }
77255
77318
  return effectiveArgs_1;
77256
77319
  }
@@ -77579,7 +77642,7 @@ var ts;
77579
77642
  var min_3 = Number.MAX_VALUE;
77580
77643
  var minIndex = 0;
77581
77644
  var i_1 = 0;
77582
- var _loop_27 = function (c) {
77645
+ var _loop_28 = function (c) {
77583
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)); };
77584
77647
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77585
77648
  if (diags_2) {
@@ -77597,7 +77660,7 @@ var ts;
77597
77660
  };
77598
77661
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77599
77662
  var c = candidatesForArgumentError_1[_a];
77600
- _loop_27(c);
77663
+ _loop_28(c);
77601
77664
  }
77602
77665
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77603
77666
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77755,7 +77818,7 @@ var ts;
77755
77818
  }
77756
77819
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77757
77820
  var parameters = [];
77758
- var _loop_28 = function (i) {
77821
+ var _loop_29 = function (i) {
77759
77822
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77760
77823
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77761
77824
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77763,7 +77826,7 @@ var ts;
77763
77826
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77764
77827
  };
77765
77828
  for (var i = 0; i < maxNonRestParam; i++) {
77766
- _loop_28(i);
77829
+ _loop_29(i);
77767
77830
  }
77768
77831
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77769
77832
  var flags = 0 /* SignatureFlags.None */;
@@ -80545,6 +80608,7 @@ var ts;
80545
80608
  var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
80546
80609
  error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
80547
80610
  }
80611
+ checkNaNEquality(errorNode, operator, left, right);
80548
80612
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
80549
80613
  return booleanType;
80550
80614
  case 102 /* SyntaxKind.InstanceOfKeyword */:
@@ -80750,6 +80814,26 @@ var ts;
80750
80814
  return undefined;
80751
80815
  }
80752
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
+ }
80753
80837
  }
80754
80838
  function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
80755
80839
  var effectiveLeft = leftType;
@@ -81787,7 +81871,7 @@ var ts;
81787
81871
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81788
81872
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81789
81873
  var indexSignatureMap_1 = new ts.Map();
81790
- var _loop_29 = function (declaration) {
81874
+ var _loop_30 = function (declaration) {
81791
81875
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81792
81876
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81793
81877
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81802,7 +81886,7 @@ var ts;
81802
81886
  };
81803
81887
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81804
81888
  var declaration = _a[_i];
81805
- _loop_29(declaration);
81889
+ _loop_30(declaration);
81806
81890
  }
81807
81891
  indexSignatureMap_1.forEach(function (entry) {
81808
81892
  if (entry.declarations.length > 1) {
@@ -85402,7 +85486,7 @@ var ts;
85402
85486
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85403
85487
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85404
85488
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85405
- var _loop_30 = function (info) {
85489
+ var _loop_31 = function (info) {
85406
85490
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85407
85491
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85408
85492
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85419,7 +85503,7 @@ var ts;
85419
85503
  };
85420
85504
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85421
85505
  var info = indexInfos_9[_i];
85422
- _loop_30(info);
85506
+ _loop_31(info);
85423
85507
  }
85424
85508
  }
85425
85509
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85427,7 +85511,7 @@ var ts;
85427
85511
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85428
85512
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85429
85513
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85430
- var _loop_31 = function (info) {
85514
+ var _loop_32 = function (info) {
85431
85515
  if (info === checkInfo)
85432
85516
  return "continue";
85433
85517
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85442,7 +85526,7 @@ var ts;
85442
85526
  };
85443
85527
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85444
85528
  var info = indexInfos_10[_i];
85445
- _loop_31(info);
85529
+ _loop_32(info);
85446
85530
  }
85447
85531
  }
85448
85532
  function checkTypeNameIsReserved(name, message) {
@@ -85762,7 +85846,7 @@ var ts;
85762
85846
  var baseTypes = baseTypeNode && getBaseTypes(type);
85763
85847
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85764
85848
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85765
- var _loop_32 = function (member) {
85849
+ var _loop_33 = function (member) {
85766
85850
  if (ts.hasAmbientModifier(member)) {
85767
85851
  return "continue";
85768
85852
  }
@@ -85779,7 +85863,7 @@ var ts;
85779
85863
  };
85780
85864
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85781
85865
  var member = _a[_i];
85782
- _loop_32(member);
85866
+ _loop_33(member);
85783
85867
  }
85784
85868
  }
85785
85869
  /**
@@ -85867,7 +85951,7 @@ var ts;
85867
85951
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85868
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
85869
85953
  var issuedMemberError = false;
85870
- var _loop_33 = function (member) {
85954
+ var _loop_34 = function (member) {
85871
85955
  if (ts.isStatic(member)) {
85872
85956
  return "continue";
85873
85957
  }
@@ -85886,7 +85970,7 @@ var ts;
85886
85970
  };
85887
85971
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85888
85972
  var member = _a[_i];
85889
- _loop_33(member);
85973
+ _loop_34(member);
85890
85974
  }
85891
85975
  if (!issuedMemberError) {
85892
85976
  // check again with diagnostics to generate a less-specific error
@@ -85957,7 +86041,7 @@ var ts;
85957
86041
  var _a, _b, _c, _d;
85958
86042
  // NOTE: assignability is checked in checkClassDeclaration
85959
86043
  var baseProperties = getPropertiesOfType(baseType);
85960
- var _loop_34 = function (baseProperty) {
86044
+ var _loop_35 = function (baseProperty) {
85961
86045
  var base = getTargetSymbol(baseProperty);
85962
86046
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
85963
86047
  return "continue";
@@ -86067,8 +86151,8 @@ var ts;
86067
86151
  };
86068
86152
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86069
86153
  var baseProperty = baseProperties_1[_i];
86070
- var state_10 = _loop_34(baseProperty);
86071
- switch (state_10) {
86154
+ var state_11 = _loop_35(baseProperty);
86155
+ switch (state_11) {
86072
86156
  case "continue-basePropertyCheck": continue basePropertyCheck;
86073
86157
  }
86074
86158
  }
@@ -124911,7 +124995,7 @@ var ts;
124911
124995
  });
124912
124996
  // Sort by paths closest to importing file Name directory
124913
124997
  var sortedPaths = [];
124914
- var _loop_35 = function (directory) {
124998
+ var _loop_36 = function (directory) {
124915
124999
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
124916
125000
  var pathsInDirectory;
124917
125001
  allFileNames.forEach(function (_a, fileName) {
@@ -124935,9 +125019,9 @@ var ts;
124935
125019
  };
124936
125020
  var out_directory_1;
124937
125021
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
124938
- var state_11 = _loop_35(directory);
125022
+ var state_12 = _loop_36(directory);
124939
125023
  directory = out_directory_1;
124940
- if (state_11 === "break")
125024
+ if (state_12 === "break")
124941
125025
  break;
124942
125026
  }
124943
125027
  if (allFileNames.size) {
@@ -125006,7 +125090,7 @@ var ts;
125006
125090
  }
125007
125091
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125008
125092
  for (var key in paths) {
125009
- var _loop_36 = function (patternText_1) {
125093
+ var _loop_37 = function (patternText_1) {
125010
125094
  var pattern = ts.normalizePath(patternText_1);
125011
125095
  var indexOfStar = pattern.indexOf("*");
125012
125096
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125073,9 +125157,9 @@ var ts;
125073
125157
  };
125074
125158
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125075
125159
  var patternText_1 = _a[_i];
125076
- var state_12 = _loop_36(patternText_1);
125077
- if (typeof state_12 === "object")
125078
- return state_12.value;
125160
+ var state_13 = _loop_37(patternText_1);
125161
+ if (typeof state_13 === "object")
125162
+ return state_13.value;
125079
125163
  }
125080
125164
  }
125081
125165
  function validateEnding(_a) {