@typescript-deploys/pr-build 4.9.0-pr-50856-4 → 4.9.0-pr-50776-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220920");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220922");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -3018,7 +3018,7 @@ var ts;
3018
3018
  ];
3019
3019
  for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
3020
3020
  var ctor = nodeConstructors_1[_i];
3021
- if (!ts.hasProperty(ctor, "__debugKind")) {
3021
+ if (!ts.hasProperty(ctor.prototype, "__debugKind")) {
3022
3022
  Object.defineProperties(ctor.prototype, {
3023
3023
  // for use with vscode-js-debug's new customDescriptionGenerator in launch.json
3024
3024
  __tsDebuggerDisplay: {
@@ -9133,6 +9133,7 @@ var ts;
9133
9133
  _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?"),
9134
9134
  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."),
9135
9135
  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."),
9136
+ This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."),
9136
9137
  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}'."),
9137
9138
  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}'."),
9138
9139
  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}'."),
@@ -10075,6 +10076,8 @@ var ts;
10075
10076
  Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"),
10076
10077
  Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"),
10077
10078
  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}'"),
10079
+ Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."),
10080
+ Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
10078
10081
  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."),
10079
10082
  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'."),
10080
10083
  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?"),
@@ -45250,6 +45253,7 @@ var ts;
45250
45253
  }
45251
45254
  }
45252
45255
  function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) {
45256
+ var _a;
45253
45257
  var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
45254
45258
  // First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
45255
45259
  var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
@@ -45264,13 +45268,7 @@ var ts;
45264
45268
  return withPackageId(packageInfo, fromDirectory);
45265
45269
  }
45266
45270
  }
45267
- var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
45268
45271
  var loader = function (extensions, candidate, onlyRecordFailures, state) {
45269
- var _a;
45270
- // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them)
45271
- if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
45272
- return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
45273
- }
45274
45272
  var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
45275
45273
  loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths);
45276
45274
  if (!pathAndExtension && packageInfo
@@ -45283,19 +45281,24 @@ var ts;
45283
45281
  }
45284
45282
  return withPackageId(packageInfo, pathAndExtension);
45285
45283
  };
45286
- if (rest !== "") { // If "rest" is empty, we just did this search above.
45287
- var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
45288
- // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
45284
+ var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest;
45285
+ var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
45286
+ if (rest !== "") {
45287
+ // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now.
45289
45288
  packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
45290
- if (packageInfo && packageInfo.contents.versionPaths) {
45291
- if (state.traceEnabled) {
45292
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
45293
- }
45294
- var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
45295
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
45296
- if (fromPaths) {
45297
- return fromPaths.value;
45298
- }
45289
+ }
45290
+ // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them)
45291
+ if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) {
45292
+ return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value;
45293
+ }
45294
+ if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) {
45295
+ if (state.traceEnabled) {
45296
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest);
45297
+ }
45298
+ var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
45299
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state);
45300
+ if (fromPaths) {
45301
+ return fromPaths.value;
45299
45302
  }
45300
45303
  }
45301
45304
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
@@ -49797,6 +49800,7 @@ var ts;
49797
49800
  var deferredGlobalOmitSymbol;
49798
49801
  var deferredGlobalAwaitedSymbol;
49799
49802
  var deferredGlobalBigIntType;
49803
+ var deferredGlobalNaNSymbol;
49800
49804
  var deferredGlobalRecordSymbol;
49801
49805
  var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name
49802
49806
  var flowLoopStart = 0;
@@ -55475,6 +55479,7 @@ var ts;
55475
55479
  && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */
55476
55480
  && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */)
55477
55481
  && !(symbol.flags & 32 /* SymbolFlags.Class */)
55482
+ && !(symbol.flags & 8192 /* SymbolFlags.Method */)
55478
55483
  && !isConstMergedWithNSPrintableAsSignatureMerge) {
55479
55484
  if (propertyAsAlias) {
55480
55485
  var createdExport = serializeMaybeAliasAssignment(symbol);
@@ -60285,7 +60290,7 @@ var ts;
60285
60290
  var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp);
60286
60291
  // If the symbols are instances of one another with identical types - consider the symbols
60287
60292
  // equivalent and just use the first one, which thus allows us to avoid eliding private
60288
- // members when intersecting a (this-)instantiations of a class with it's raw base or another instance
60293
+ // members when intersecting a (this-)instantiations of a class with its raw base or another instance
60289
60294
  if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) {
60290
60295
  // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used
60291
60296
  // to do when we recorded multiple distinct symbols so that we still get, eg, `Array<T>.length` printed
@@ -60333,7 +60338,11 @@ var ts;
60333
60338
  }
60334
60339
  }
60335
60340
  }
60336
- if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) {
60341
+ if (!singleProp ||
60342
+ isUnion &&
60343
+ (propSet || checkFlags & 48 /* CheckFlags.Partial */) &&
60344
+ checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) &&
60345
+ !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) {
60337
60346
  // No property was found, or, in a union, a property has a private or protected declaration in one
60338
60347
  // constituent, but is missing or has a different declaration in another constituent.
60339
60348
  return undefined;
@@ -60435,6 +60444,33 @@ var ts;
60435
60444
  }
60436
60445
  return property;
60437
60446
  }
60447
+ function getCommonDeclarationsOfSymbols(symbols) {
60448
+ var commonDeclarations;
60449
+ var _loop_14 = function (symbol) {
60450
+ if (!symbol.declarations) {
60451
+ return { value: undefined };
60452
+ }
60453
+ if (!commonDeclarations) {
60454
+ commonDeclarations = new ts.Set(symbol.declarations);
60455
+ return "continue";
60456
+ }
60457
+ commonDeclarations.forEach(function (declaration) {
60458
+ if (!ts.contains(symbol.declarations, declaration)) {
60459
+ commonDeclarations.delete(declaration);
60460
+ }
60461
+ });
60462
+ if (commonDeclarations.size === 0) {
60463
+ return { value: undefined };
60464
+ }
60465
+ };
60466
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
60467
+ var symbol = symbols_3[_i];
60468
+ var state_4 = _loop_14(symbol);
60469
+ if (typeof state_4 === "object")
60470
+ return state_4.value;
60471
+ }
60472
+ return commonDeclarations;
60473
+ }
60438
60474
  function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) {
60439
60475
  var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
60440
60476
  // We need to filter out partial properties in union types
@@ -61149,7 +61185,7 @@ var ts;
61149
61185
  function getIndexInfosOfIndexSymbol(indexSymbol) {
61150
61186
  if (indexSymbol.declarations) {
61151
61187
  var indexInfos_4 = [];
61152
- var _loop_14 = function (declaration) {
61188
+ var _loop_15 = function (declaration) {
61153
61189
  if (declaration.parameters.length === 1) {
61154
61190
  var parameter = declaration.parameters[0];
61155
61191
  if (parameter.type) {
@@ -61163,7 +61199,7 @@ var ts;
61163
61199
  };
61164
61200
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
61165
61201
  var declaration = _a[_i];
61166
- _loop_14(declaration);
61202
+ _loop_15(declaration);
61167
61203
  }
61168
61204
  return indexInfos_4;
61169
61205
  }
@@ -61180,7 +61216,7 @@ var ts;
61180
61216
  var _a;
61181
61217
  var inferences;
61182
61218
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
61183
- var _loop_15 = function (declaration) {
61219
+ var _loop_16 = function (declaration) {
61184
61220
  if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) {
61185
61221
  // When an 'infer T' declaration is immediately contained in a type reference node
61186
61222
  // (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
@@ -61244,7 +61280,7 @@ var ts;
61244
61280
  };
61245
61281
  for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
61246
61282
  var declaration = _b[_i];
61247
- _loop_15(declaration);
61283
+ _loop_16(declaration);
61248
61284
  }
61249
61285
  }
61250
61286
  return inferences && getIntersectionType(inferences);
@@ -61901,6 +61937,9 @@ var ts;
61901
61937
  function getGlobalBigIntType() {
61902
61938
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType;
61903
61939
  }
61940
+ function getGlobalNaNSymbol() {
61941
+ return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false)));
61942
+ }
61904
61943
  function getGlobalRecordSymbol() {
61905
61944
  deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol);
61906
61945
  return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol;
@@ -62141,7 +62180,7 @@ var ts;
62141
62180
  var lastRequiredIndex = -1;
62142
62181
  var firstRestIndex = -1;
62143
62182
  var lastOptionalOrRestIndex = -1;
62144
- var _loop_16 = function (i) {
62183
+ var _loop_17 = function (i) {
62145
62184
  var type = elementTypes[i];
62146
62185
  var flags = target.elementFlags[i];
62147
62186
  if (flags & 8 /* ElementFlags.Variadic */) {
@@ -62171,9 +62210,9 @@ var ts;
62171
62210
  }
62172
62211
  };
62173
62212
  for (var i = 0; i < elementTypes.length; i++) {
62174
- var state_4 = _loop_16(i);
62175
- if (typeof state_4 === "object")
62176
- return state_4.value;
62213
+ var state_5 = _loop_17(i);
62214
+ if (typeof state_5 === "object")
62215
+ return state_5.value;
62177
62216
  }
62178
62217
  // Turn optional elements preceding the last required element into required elements
62179
62218
  for (var i = 0; i < lastRequiredIndex; i++) {
@@ -62201,7 +62240,7 @@ var ts;
62201
62240
  if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) {
62202
62241
  lastOptionalOrRestIndex = expandedFlags.length;
62203
62242
  }
62204
- expandedTypes.push(type);
62243
+ expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type);
62205
62244
  expandedFlags.push(flags);
62206
62245
  if (expandedDeclarations && declaration) {
62207
62246
  expandedDeclarations.push(declaration);
@@ -62367,7 +62406,7 @@ var ts;
62367
62406
  var templates = ts.filter(types, isPatternLiteralType);
62368
62407
  if (templates.length) {
62369
62408
  var i = types.length;
62370
- var _loop_17 = function () {
62409
+ var _loop_18 = function () {
62371
62410
  i--;
62372
62411
  var t = types[i];
62373
62412
  if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -62375,7 +62414,7 @@ var ts;
62375
62414
  }
62376
62415
  };
62377
62416
  while (i > 0) {
62378
- _loop_17();
62417
+ _loop_18();
62379
62418
  }
62380
62419
  }
62381
62420
  }
@@ -62452,14 +62491,14 @@ var ts;
62452
62491
  var namedUnions = [];
62453
62492
  addNamedUnions(namedUnions, types);
62454
62493
  var reducedTypes = [];
62455
- var _loop_18 = function (t) {
62494
+ var _loop_19 = function (t) {
62456
62495
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
62457
62496
  reducedTypes.push(t);
62458
62497
  }
62459
62498
  };
62460
62499
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
62461
62500
  var t = typeSet_1[_i];
62462
- _loop_18(t);
62501
+ _loop_19(t);
62463
62502
  }
62464
62503
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
62465
62504
  return namedUnions[0];
@@ -63689,7 +63728,7 @@ var ts;
63689
63728
  var result;
63690
63729
  var extraTypes;
63691
63730
  var tailCount = 0;
63692
- var _loop_19 = function () {
63731
+ var _loop_20 = function () {
63693
63732
  if (tailCount === 1000) {
63694
63733
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63695
63734
  result = errorType;
@@ -63810,10 +63849,10 @@ var ts;
63810
63849
  // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63811
63850
  // cases we increment the tail recursion counter and stop after 1000 iterations.
63812
63851
  while (true) {
63813
- var state_5 = _loop_19();
63814
- if (typeof state_5 === "object")
63815
- return state_5.value;
63816
- if (state_5 === "break")
63852
+ var state_6 = _loop_20();
63853
+ if (typeof state_6 === "object")
63854
+ return state_6.value;
63855
+ if (state_6 === "break")
63817
63856
  break;
63818
63857
  }
63819
63858
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
@@ -66428,7 +66467,7 @@ var ts;
66428
66467
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66429
66468
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66430
66469
  }
66431
- var _loop_20 = function (prop) {
66470
+ var _loop_21 = function (prop) {
66432
66471
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66433
66472
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66434
66473
  if (reportErrors) {
@@ -66491,9 +66530,9 @@ var ts;
66491
66530
  };
66492
66531
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66493
66532
  var prop = _b[_i];
66494
- var state_6 = _loop_20(prop);
66495
- if (typeof state_6 === "object")
66496
- return state_6.value;
66533
+ var state_7 = _loop_21(prop);
66534
+ if (typeof state_7 === "object")
66535
+ return state_7.value;
66497
66536
  }
66498
66537
  return false;
66499
66538
  }
@@ -67484,11 +67523,11 @@ var ts;
67484
67523
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67485
67524
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67486
67525
  var matchingTypes = [];
67487
- var _loop_21 = function (combination) {
67526
+ var _loop_22 = function (combination) {
67488
67527
  var hasMatch = false;
67489
67528
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67490
67529
  var type = _d[_c];
67491
- var _loop_22 = function (i) {
67530
+ var _loop_23 = function (i) {
67492
67531
  var sourceProperty = sourcePropertiesFiltered[i];
67493
67532
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67494
67533
  if (!targetProperty)
@@ -67504,8 +67543,8 @@ var ts;
67504
67543
  }
67505
67544
  };
67506
67545
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67507
- var state_8 = _loop_22(i);
67508
- switch (state_8) {
67546
+ var state_9 = _loop_23(i);
67547
+ switch (state_9) {
67509
67548
  case "continue-outer": continue outer;
67510
67549
  }
67511
67550
  }
@@ -67518,9 +67557,9 @@ var ts;
67518
67557
  };
67519
67558
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67520
67559
  var combination = discriminantCombinations_1[_a];
67521
- var state_7 = _loop_21(combination);
67522
- if (typeof state_7 === "object")
67523
- return state_7.value;
67560
+ var state_8 = _loop_22(combination);
67561
+ if (typeof state_8 === "object")
67562
+ return state_8.value;
67524
67563
  }
67525
67564
  // Compare the remaining non-discriminant properties of each match.
67526
67565
  var result = -1 /* Ternary.True */;
@@ -68225,7 +68264,7 @@ var ts;
68225
68264
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68226
68265
  links.variances = ts.emptyArray;
68227
68266
  var variances = [];
68228
- var _loop_23 = function (tp) {
68267
+ var _loop_24 = function (tp) {
68229
68268
  var modifiers = getVarianceModifiers(tp);
68230
68269
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68231
68270
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68263,7 +68302,7 @@ var ts;
68263
68302
  };
68264
68303
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68265
68304
  var tp = typeParameters_2[_i];
68266
- _loop_23(tp);
68305
+ _loop_24(tp);
68267
68306
  }
68268
68307
  links.variances = variances;
68269
68308
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -68855,7 +68894,8 @@ var ts;
68855
68894
  function getOptionalType(type, isProperty) {
68856
68895
  if (isProperty === void 0) { isProperty = false; }
68857
68896
  ts.Debug.assert(strictNullChecks);
68858
- return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
68897
+ var missingOrUndefined = isProperty ? missingType : undefinedType;
68898
+ return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]);
68859
68899
  }
68860
68900
  function getGlobalNonNullableTypeInstantiation(type) {
68861
68901
  if (!deferredGlobalNonNullableTypeAlias) {
@@ -70220,7 +70260,7 @@ var ts;
70220
70260
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70221
70261
  // succeed. That would be a pointless and confusing outcome.
70222
70262
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70223
- var _loop_24 = function (i) {
70263
+ var _loop_25 = function (i) {
70224
70264
  var source_1 = matches ? matches[i] : neverType;
70225
70265
  var target_3 = types[i];
70226
70266
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70270,7 +70310,7 @@ var ts;
70270
70310
  inferFromTypes(source_1, target_3);
70271
70311
  };
70272
70312
  for (var i = 0; i < types.length; i++) {
70273
- _loop_24(i);
70313
+ _loop_25(i);
70274
70314
  }
70275
70315
  }
70276
70316
  }
@@ -70734,7 +70774,7 @@ var ts;
70734
70774
  return name;
70735
70775
  }
70736
70776
  }
70737
- if (ts.hasOnlyExpressionInitializer(declaration)) {
70777
+ if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
70738
70778
  var initializer = ts.getEffectiveInitializer(declaration);
70739
70779
  return initializer && tryGetNameFromType(getTypeOfExpression(initializer));
70740
70780
  }
@@ -70794,7 +70834,7 @@ var ts;
70794
70834
  function mapTypesByKeyProperty(types, name) {
70795
70835
  var map = new ts.Map();
70796
70836
  var count = 0;
70797
- var _loop_25 = function (type) {
70837
+ var _loop_26 = function (type) {
70798
70838
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70799
70839
  var discriminant = getTypeOfPropertyOfType(type, name);
70800
70840
  if (discriminant) {
@@ -70820,9 +70860,9 @@ var ts;
70820
70860
  };
70821
70861
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70822
70862
  var type = types_15[_i];
70823
- var state_9 = _loop_25(type);
70824
- if (typeof state_9 === "object")
70825
- return state_9.value;
70863
+ var state_10 = _loop_26(type);
70864
+ if (typeof state_10 === "object")
70865
+ return state_10.value;
70826
70866
  }
70827
70867
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70828
70868
  }
@@ -77277,7 +77317,7 @@ var ts;
77277
77317
  if (spreadIndex >= 0) {
77278
77318
  // Create synthetic arguments from spreads of tuple types.
77279
77319
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77280
- var _loop_26 = function (i) {
77320
+ var _loop_27 = function (i) {
77281
77321
  var arg = args[i];
77282
77322
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77283
77323
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77294,7 +77334,7 @@ var ts;
77294
77334
  }
77295
77335
  };
77296
77336
  for (var i = spreadIndex; i < args.length; i++) {
77297
- _loop_26(i);
77337
+ _loop_27(i);
77298
77338
  }
77299
77339
  return effectiveArgs_1;
77300
77340
  }
@@ -77623,7 +77663,7 @@ var ts;
77623
77663
  var min_3 = Number.MAX_VALUE;
77624
77664
  var minIndex = 0;
77625
77665
  var i_1 = 0;
77626
- var _loop_27 = function (c) {
77666
+ var _loop_28 = function (c) {
77627
77667
  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)); };
77628
77668
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77629
77669
  if (diags_2) {
@@ -77641,7 +77681,7 @@ var ts;
77641
77681
  };
77642
77682
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77643
77683
  var c = candidatesForArgumentError_1[_a];
77644
- _loop_27(c);
77684
+ _loop_28(c);
77645
77685
  }
77646
77686
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77647
77687
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77799,7 +77839,7 @@ var ts;
77799
77839
  }
77800
77840
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77801
77841
  var parameters = [];
77802
- var _loop_28 = function (i) {
77842
+ var _loop_29 = function (i) {
77803
77843
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77804
77844
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77805
77845
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77807,7 +77847,7 @@ var ts;
77807
77847
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77808
77848
  };
77809
77849
  for (var i = 0; i < maxNonRestParam; i++) {
77810
- _loop_28(i);
77850
+ _loop_29(i);
77811
77851
  }
77812
77852
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77813
77853
  var flags = 0 /* SignatureFlags.None */;
@@ -80589,6 +80629,7 @@ var ts;
80589
80629
  var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */;
80590
80630
  error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
80591
80631
  }
80632
+ checkNaNEquality(errorNode, operator, left, right);
80592
80633
  reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); });
80593
80634
  return booleanType;
80594
80635
  case 102 /* SyntaxKind.InstanceOfKeyword */:
@@ -80794,6 +80835,26 @@ var ts;
80794
80835
  return undefined;
80795
80836
  }
80796
80837
  }
80838
+ function checkNaNEquality(errorNode, operator, left, right) {
80839
+ var isLeftNaN = isGlobalNaN(ts.skipParentheses(left));
80840
+ var isRightNaN = isGlobalNaN(ts.skipParentheses(right));
80841
+ if (isLeftNaN || isRightNaN) {
80842
+ 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 */));
80843
+ if (isLeftNaN && isRightNaN)
80844
+ return;
80845
+ var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : "";
80846
+ var location = isLeftNaN ? right : left;
80847
+ var expression = ts.skipParentheses(location);
80848
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")")));
80849
+ }
80850
+ }
80851
+ function isGlobalNaN(expr) {
80852
+ if (ts.isIdentifier(expr) && expr.escapedText === "NaN") {
80853
+ var globalNaNSymbol = getGlobalNaNSymbol();
80854
+ return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr);
80855
+ }
80856
+ return false;
80857
+ }
80797
80858
  }
80798
80859
  function getBaseTypesIfUnrelated(leftType, rightType, isRelated) {
80799
80860
  var effectiveLeft = leftType;
@@ -81831,7 +81892,7 @@ var ts;
81831
81892
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81832
81893
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81833
81894
  var indexSignatureMap_1 = new ts.Map();
81834
- var _loop_29 = function (declaration) {
81895
+ var _loop_30 = function (declaration) {
81835
81896
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81836
81897
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
81837
81898
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -81846,7 +81907,7 @@ var ts;
81846
81907
  };
81847
81908
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
81848
81909
  var declaration = _a[_i];
81849
- _loop_29(declaration);
81910
+ _loop_30(declaration);
81850
81911
  }
81851
81912
  indexSignatureMap_1.forEach(function (entry) {
81852
81913
  if (entry.declarations.length > 1) {
@@ -85446,7 +85507,7 @@ var ts;
85446
85507
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85447
85508
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85448
85509
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85449
- var _loop_30 = function (info) {
85510
+ var _loop_31 = function (info) {
85450
85511
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85451
85512
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85452
85513
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85463,7 +85524,7 @@ var ts;
85463
85524
  };
85464
85525
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85465
85526
  var info = indexInfos_9[_i];
85466
- _loop_30(info);
85527
+ _loop_31(info);
85467
85528
  }
85468
85529
  }
85469
85530
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85471,7 +85532,7 @@ var ts;
85471
85532
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85472
85533
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85473
85534
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85474
- var _loop_31 = function (info) {
85535
+ var _loop_32 = function (info) {
85475
85536
  if (info === checkInfo)
85476
85537
  return "continue";
85477
85538
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85486,7 +85547,7 @@ var ts;
85486
85547
  };
85487
85548
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85488
85549
  var info = indexInfos_10[_i];
85489
- _loop_31(info);
85550
+ _loop_32(info);
85490
85551
  }
85491
85552
  }
85492
85553
  function checkTypeNameIsReserved(name, message) {
@@ -85806,7 +85867,7 @@ var ts;
85806
85867
  var baseTypes = baseTypeNode && getBaseTypes(type);
85807
85868
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85808
85869
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85809
- var _loop_32 = function (member) {
85870
+ var _loop_33 = function (member) {
85810
85871
  if (ts.hasAmbientModifier(member)) {
85811
85872
  return "continue";
85812
85873
  }
@@ -85823,7 +85884,7 @@ var ts;
85823
85884
  };
85824
85885
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85825
85886
  var member = _a[_i];
85826
- _loop_32(member);
85887
+ _loop_33(member);
85827
85888
  }
85828
85889
  }
85829
85890
  /**
@@ -85911,7 +85972,7 @@ var ts;
85911
85972
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
85912
85973
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
85913
85974
  var issuedMemberError = false;
85914
- var _loop_33 = function (member) {
85975
+ var _loop_34 = function (member) {
85915
85976
  if (ts.isStatic(member)) {
85916
85977
  return "continue";
85917
85978
  }
@@ -85930,7 +85991,7 @@ var ts;
85930
85991
  };
85931
85992
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85932
85993
  var member = _a[_i];
85933
- _loop_33(member);
85994
+ _loop_34(member);
85934
85995
  }
85935
85996
  if (!issuedMemberError) {
85936
85997
  // check again with diagnostics to generate a less-specific error
@@ -86001,7 +86062,7 @@ var ts;
86001
86062
  var _a, _b, _c, _d;
86002
86063
  // NOTE: assignability is checked in checkClassDeclaration
86003
86064
  var baseProperties = getPropertiesOfType(baseType);
86004
- var _loop_34 = function (baseProperty) {
86065
+ var _loop_35 = function (baseProperty) {
86005
86066
  var base = getTargetSymbol(baseProperty);
86006
86067
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86007
86068
  return "continue";
@@ -86111,8 +86172,8 @@ var ts;
86111
86172
  };
86112
86173
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86113
86174
  var baseProperty = baseProperties_1[_i];
86114
- var state_10 = _loop_34(baseProperty);
86115
- switch (state_10) {
86175
+ var state_11 = _loop_35(baseProperty);
86176
+ switch (state_11) {
86116
86177
  case "continue-basePropertyCheck": continue basePropertyCheck;
86117
86178
  }
86118
86179
  }
@@ -115353,6 +115414,7 @@ var ts;
115353
115414
  writeTrailingSemicolon();
115354
115415
  }
115355
115416
  function emitExportDeclaration(node) {
115417
+ emitModifiers(node, node.modifiers);
115356
115418
  var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node);
115357
115419
  writeSpace();
115358
115420
  if (node.isTypeOnly) {
@@ -123836,17 +123898,13 @@ var ts;
123836
123898
  var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
123837
123899
  return !!value && !!value.length;
123838
123900
  }
123839
- function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
123901
+ function createHasInvalidatedResolution(userProvidedHasInvalidatedResolution) {
123840
123902
  // Ensure pending resolutions are applied
123841
123903
  invalidateResolutionsOfFailedLookupLocations();
123842
- if (forceAllFilesAsInvalidated) {
123843
- // Any file asked would have invalidated resolution
123844
- filesWithInvalidatedResolutions = undefined;
123845
- return ts.returnTrue;
123846
- }
123847
123904
  var collected = filesWithInvalidatedResolutions;
123848
123905
  filesWithInvalidatedResolutions = undefined;
123849
- return function (path) { return (!!collected && collected.has(path)) ||
123906
+ return function (path) { return (userProvidedHasInvalidatedResolution === null || userProvidedHasInvalidatedResolution === void 0 ? void 0 : userProvidedHasInvalidatedResolution(path)) ||
123907
+ !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
123850
123908
  isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
123851
123909
  }
123852
123910
  function startCachingPerDirectoryResolution() {
@@ -124955,7 +125013,7 @@ var ts;
124955
125013
  });
124956
125014
  // Sort by paths closest to importing file Name directory
124957
125015
  var sortedPaths = [];
124958
- var _loop_35 = function (directory) {
125016
+ var _loop_36 = function (directory) {
124959
125017
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
124960
125018
  var pathsInDirectory;
124961
125019
  allFileNames.forEach(function (_a, fileName) {
@@ -124979,9 +125037,9 @@ var ts;
124979
125037
  };
124980
125038
  var out_directory_1;
124981
125039
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
124982
- var state_11 = _loop_35(directory);
125040
+ var state_12 = _loop_36(directory);
124983
125041
  directory = out_directory_1;
124984
- if (state_11 === "break")
125042
+ if (state_12 === "break")
124985
125043
  break;
124986
125044
  }
124987
125045
  if (allFileNames.size) {
@@ -125050,7 +125108,7 @@ var ts;
125050
125108
  }
125051
125109
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125052
125110
  for (var key in paths) {
125053
- var _loop_36 = function (patternText_1) {
125111
+ var _loop_37 = function (patternText_1) {
125054
125112
  var pattern = ts.normalizePath(patternText_1);
125055
125113
  var indexOfStar = pattern.indexOf("*");
125056
125114
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125117,9 +125175,9 @@ var ts;
125117
125175
  };
125118
125176
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125119
125177
  var patternText_1 = _a[_i];
125120
- var state_12 = _loop_36(patternText_1);
125121
- if (typeof state_12 === "object")
125122
- return state_12.value;
125178
+ var state_13 = _loop_37(patternText_1);
125179
+ if (typeof state_13 === "object")
125180
+ return state_13.value;
125123
125181
  }
125124
125182
  }
125125
125183
  function validateEnding(_a) {
@@ -126226,6 +126284,7 @@ var ts;
126226
126284
  ts.maybeBind(host, host.getModuleResolutionCache) :
126227
126285
  (function () { return resolutionCache.getModuleResolutionCache(); });
126228
126286
  var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
126287
+ var userProvidedHasInvalidatedResolution = ts.maybeBind(host, host.hasInvalidatedResolution) || ts.returnTrue;
126229
126288
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
126230
126289
  synchronizeProgram();
126231
126290
  // Update the wild card directory watch
@@ -126292,7 +126351,7 @@ var ts;
126292
126351
  }
126293
126352
  }
126294
126353
  // All resolutions are invalid if user provided resolutions
126295
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
126354
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution ? userProvidedHasInvalidatedResolution : undefined);
126296
126355
  var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
126297
126356
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
126298
126357
  if (hasChangedConfigFileParsingErrors) {
@@ -135039,7 +135098,7 @@ var ts;
135039
135098
  return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
135040
135099
  }
135041
135100
  function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
135042
- var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
135101
+ var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
135043
135102
  // Verify if the file is JSX language variant
135044
135103
  if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) {
135045
135104
  var completionInfo = getJsxClosingTagCompletion(location, sourceFile);
@@ -135053,7 +135112,7 @@ var ts;
135053
135112
  return undefined;
135054
135113
  }
135055
135114
  var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
135056
- /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
135115
+ /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag);
135057
135116
  if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) {
135058
135117
  for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
135059
135118
  var keywordEntry = _a[_i];
@@ -135171,7 +135230,7 @@ var ts;
135171
135230
  function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
135172
135231
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority };
135173
135232
  }
135174
- function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
135233
+ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
135175
135234
  var _a, _b;
135176
135235
  var insertText;
135177
135236
  var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
@@ -135227,8 +135286,8 @@ var ts;
135227
135286
  }
135228
135287
  if (originIsResolvedExport(origin)) {
135229
135288
  sourceDisplay = [ts.textPart(origin.moduleSpecifier)];
135230
- if (importCompletionNode) {
135231
- (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
135289
+ if (importStatementCompletion) {
135290
+ (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan);
135232
135291
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
135233
135292
  }
135234
135293
  }
@@ -135283,7 +135342,7 @@ var ts;
135283
135342
  }
135284
135343
  if (originIsExport(origin) || originIsResolvedExport(origin)) {
135285
135344
  data = originToCompletionEntryData(origin);
135286
- hasAction = !importCompletionNode;
135345
+ hasAction = !importStatementCompletion;
135287
135346
  }
135288
135347
  // TODO(drosen): Right now we just permit *all* semantic meanings when calling
135289
135348
  // 'getSymbolKind' which is permissible given that it is backwards compatible; but
@@ -135306,7 +135365,7 @@ var ts;
135306
135365
  labelDetails: labelDetails,
135307
135366
  isSnippet: isSnippet,
135308
135367
  isPackageJsonImport: originIsPackageJsonImport(origin) || undefined,
135309
- isImportStatementCompletion: !!importCompletionNode || undefined,
135368
+ isImportStatementCompletion: !!importStatementCompletion || undefined,
135310
135369
  data: data,
135311
135370
  };
135312
135371
  }
@@ -135678,19 +135737,16 @@ var ts;
135678
135737
  };
135679
135738
  return unresolvedOrigin;
135680
135739
  }
135681
- function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) {
135682
- var _a, _b, _c;
135683
- var sourceFile = importCompletionNode.getSourceFile();
135684
- var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile);
135740
+ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
135741
+ var replacementSpan = importStatementCompletion.replacementSpan;
135685
135742
  var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier);
135686
135743
  var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ :
135687
135744
  origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ :
135688
135745
  0 /* ExportKind.Named */;
135689
135746
  var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : "";
135690
135747
  var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true);
135691
- var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly);
135692
- var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
135693
- var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
135748
+ var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier;
135749
+ var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " ";
135694
135750
  var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : "";
135695
135751
  var suffix = useSemicolons ? ";" : "";
135696
135752
  switch (importKind) {
@@ -135724,7 +135780,7 @@ var ts;
135724
135780
  return CompletionSource.TypeOnlyAlias;
135725
135781
  }
135726
135782
  }
135727
- function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
135783
+ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
135728
135784
  var _a;
135729
135785
  var start = ts.timestamp();
135730
135786
  var variableDeclaration = getVariableDeclaration(location);
@@ -135745,7 +135801,7 @@ var ts;
135745
135801
  var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
135746
135802
  var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority;
135747
135803
  var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText);
135748
- var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
135804
+ var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
135749
135805
  if (!entry) {
135750
135806
  continue;
135751
135807
  }
@@ -135936,7 +135992,7 @@ var ts;
135936
135992
  Completions.createCompletionDetails = createCompletionDetails;
135937
135993
  function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) {
135938
135994
  if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
135939
- if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) {
135995
+ if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) {
135940
135996
  // Import statement completion: 'import c|'
135941
135997
  return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
135942
135998
  }
@@ -136137,34 +136193,34 @@ var ts;
136137
136193
  var isStartingCloseTag = false;
136138
136194
  var isJsxInitializer = false;
136139
136195
  var isJsxIdentifierExpected = false;
136140
- var importCompletionNode;
136196
+ var importStatementCompletion;
136141
136197
  var location = ts.getTouchingPropertyName(sourceFile, position);
136142
136198
  var keywordFilters = 0 /* KeywordCompletionFilters.None */;
136143
136199
  var isNewIdentifierLocation = false;
136144
136200
  var flags = 0 /* CompletionInfoFlags.None */;
136145
136201
  if (contextToken) {
136146
- var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
136147
- isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
136148
- if (importStatementCompletion.keywordCompletion) {
136149
- if (importStatementCompletion.isKeywordOnlyCompletion) {
136202
+ var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken);
136203
+ if (importStatementCompletionInfo.keywordCompletion) {
136204
+ if (importStatementCompletionInfo.isKeywordOnlyCompletion) {
136150
136205
  return {
136151
136206
  kind: 4 /* CompletionDataKind.Keywords */,
136152
- keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)],
136153
- isNewIdentifierLocation: isNewIdentifierLocation,
136207
+ keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)],
136208
+ isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation,
136154
136209
  };
136155
136210
  }
136156
- keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion);
136211
+ keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion);
136157
136212
  }
136158
- if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
136213
+ if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
136159
136214
  // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
136160
136215
  // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
136161
136216
  // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
136162
136217
  // to opt in with the `includeCompletionsForImportStatements` user preference.
136163
- importCompletionNode = importStatementCompletion.replacementNode;
136164
136218
  flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */;
136219
+ importStatementCompletion = importStatementCompletionInfo;
136220
+ isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation;
136165
136221
  }
136166
136222
  // Bail out if this is a known invalid completion location
136167
- if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
136223
+ if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) {
136168
136224
  log("Returning an empty list because completion was requested in an invalid position.");
136169
136225
  return keywordFilters
136170
136226
  ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation())
@@ -136210,7 +136266,7 @@ var ts;
136210
136266
  return undefined;
136211
136267
  }
136212
136268
  }
136213
- else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) {
136269
+ else if (!importStatementCompletion) {
136214
136270
  // <UI.Test /* completion position */ />
136215
136271
  // If the tagname is a property access expression, we will then walk up to the top most of property access expression.
136216
136272
  // Then, try to get a JSX container and its associated attributes type.
@@ -136353,7 +136409,7 @@ var ts;
136353
136409
  isTypeOnlyLocation: isTypeOnlyLocation,
136354
136410
  isJsxIdentifierExpected: isJsxIdentifierExpected,
136355
136411
  isRightOfOpenTag: isRightOfOpenTag,
136356
- importCompletionNode: importCompletionNode,
136412
+ importStatementCompletion: importStatementCompletion,
136357
136413
  hasUnresolvedAutoImports: hasUnresolvedAutoImports,
136358
136414
  flags: flags,
136359
136415
  };
@@ -136607,7 +136663,7 @@ var ts;
136607
136663
  return 1 /* GlobalsSearch.Success */;
136608
136664
  }
136609
136665
  function tryGetImportCompletionSymbols() {
136610
- if (!importCompletionNode)
136666
+ if (!importStatementCompletion)
136611
136667
  return 0 /* GlobalsSearch.Continue */;
136612
136668
  isNewIdentifierLocation = true;
136613
136669
  collectAutoImports();
@@ -136690,7 +136746,7 @@ var ts;
136690
136746
  }
136691
136747
  function shouldOfferImportCompletions() {
136692
136748
  // If already typing an import statement, provide completions for it.
136693
- if (importCompletionNode)
136749
+ if (importStatementCompletion)
136694
136750
  return true;
136695
136751
  // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols
136696
136752
  if (isNonContextualObjectLiteral)
@@ -136720,7 +136776,7 @@ var ts;
136720
136776
  }
136721
136777
  function isTypeOnlyCompletion() {
136722
136778
  return insideJsDocTagTypeExpression
136723
- || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
136779
+ || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent)
136724
136780
  || !isContextTokenValueLocation(contextToken) &&
136725
136781
  (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker)
136726
136782
  || ts.isPartOfTypeNode(location)
@@ -136770,8 +136826,7 @@ var ts;
136770
136826
  flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */;
136771
136827
  // import { type | -> token text should be blank
136772
136828
  var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
136773
- && importCompletionNode
136774
- && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken);
136829
+ && importStatementCompletion;
136775
136830
  var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" :
136776
136831
  previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() :
136777
136832
  "";
@@ -136779,14 +136834,14 @@ var ts;
136779
136834
  var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken);
136780
136835
  var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host);
136781
136836
  var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host);
136782
- resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
136837
+ resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
136783
136838
  exportInfo.search(sourceFile.path,
136784
136839
  /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) {
136785
136840
  if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings())))
136786
136841
  return false;
136787
136842
  if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName))
136788
136843
  return false;
136789
- if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */))
136844
+ if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */))
136790
136845
  return false;
136791
136846
  if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */)))
136792
136847
  return false;
@@ -136867,7 +136922,7 @@ var ts;
136867
136922
  return;
136868
136923
  }
136869
136924
  symbolToOriginInfoMap[symbols.length] = origin;
136870
- symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
136925
+ symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions;
136871
136926
  symbols.push(symbol);
136872
136927
  }
136873
136928
  /* Mutates `symbols` and `symbolToOriginInfoMap`. */
@@ -138134,6 +138189,7 @@ var ts;
138134
138189
  return undefined;
138135
138190
  }
138136
138191
  function getImportStatementCompletionInfo(contextToken) {
138192
+ var _a, _b, _c;
138137
138193
  var keywordCompletion;
138138
138194
  var isKeywordOnlyCompletion = false;
138139
138195
  var candidate = getCandidate();
@@ -138141,9 +138197,9 @@ var ts;
138141
138197
  isKeywordOnlyCompletion: isKeywordOnlyCompletion,
138142
138198
  keywordCompletion: keywordCompletion,
138143
138199
  isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */),
138144
- replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile())
138145
- ? candidate
138146
- : undefined
138200
+ isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly),
138201
+ couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken),
138202
+ replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate),
138147
138203
  };
138148
138204
  function getCandidate() {
138149
138205
  var parent = contextToken.parent;
@@ -138185,14 +138241,71 @@ var ts;
138185
138241
  return undefined;
138186
138242
  }
138187
138243
  }
138244
+ function getSingleLineReplacementSpanForImportCompletionNode(node) {
138245
+ var _a, _b, _c;
138246
+ if (!node)
138247
+ return undefined;
138248
+ var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node;
138249
+ var sourceFile = top.getSourceFile();
138250
+ if (ts.rangeIsOnSingleLine(top, sourceFile)) {
138251
+ return ts.createTextSpanFromNode(top, sourceFile);
138252
+ }
138253
+ // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration
138254
+ ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */);
138255
+ // Guess which point in the import might actually be a later statement parsed as part of the import
138256
+ // during parser recovery - either in the middle of named imports, or the module specifier.
138257
+ var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */
138258
+ ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier
138259
+ : top.moduleReference;
138260
+ var withoutModuleSpecifier = {
138261
+ pos: top.getFirstToken().getStart(),
138262
+ end: potentialSplitPoint.pos,
138263
+ };
138264
+ // The module specifier/reference was previously found to be missing, empty, or
138265
+ // not a string literal - in this last case, it's likely that statement on a following
138266
+ // line was parsed as the module specifier of a partially-typed import, e.g.
138267
+ // import Foo|
138268
+ // interface Blah {}
138269
+ // This appears to be a multiline-import, and editors can't replace multiple lines.
138270
+ // But if everything but the "module specifier" is on one line, by this point we can
138271
+ // assume that the "module specifier" is actually just another statement, and return
138272
+ // the single-line range of the import excluding that probable statement.
138273
+ if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) {
138274
+ return ts.createTextSpanFromRange(withoutModuleSpecifier);
138275
+ }
138276
+ }
138277
+ // Tries to identify the first named import that is not really a named import, but rather
138278
+ // just parser recovery for a situation like:
138279
+ // import { Foo|
138280
+ // interface Bar {}
138281
+ // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller
138282
+ // will also check if this token is on a separate line from the rest of the import.
138283
+ function getPotentiallyInvalidImportSpecifier(namedBindings) {
138284
+ var _a;
138285
+ return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) {
138286
+ var _a;
138287
+ return !e.propertyName &&
138288
+ ts.isStringANonContextualKeyword(e.name.text) &&
138289
+ ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */;
138290
+ });
138291
+ }
138188
138292
  function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) {
138189
138293
  return ts.isImportSpecifier(importSpecifier)
138190
138294
  && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken));
138191
138295
  }
138192
138296
  function canCompleteFromNamedBindings(namedBindings) {
138193
- return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier)
138194
- && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2)
138195
- && !namedBindings.parent.name;
138297
+ if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) {
138298
+ return false;
138299
+ }
138300
+ if (ts.isNamedImports(namedBindings)) {
138301
+ // We can only complete on named imports if there are no other named imports already,
138302
+ // but parser recovery sometimes puts later statements in the named imports list, so
138303
+ // we try to only consider the probably-valid ones.
138304
+ var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings);
138305
+ var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length;
138306
+ return validImports < 2;
138307
+ }
138308
+ return true;
138196
138309
  }
138197
138310
  function isModuleSpecifierMissingOrEmpty(specifier) {
138198
138311
  var _a;
@@ -146227,6 +146340,10 @@ var ts;
146227
146340
  pushSelectionCommentRange(comment.pos, comment.end);
146228
146341
  }
146229
146342
  if (positionShouldSnapToNode(sourceFile, pos, node)) {
146343
+ if (ts.isFunctionBody(node)
146344
+ && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) {
146345
+ pushSelectionRange(node.getStart(sourceFile), node.getEnd());
146346
+ }
146230
146347
  // 1. Blocks are effectively redundant with SyntaxLists.
146231
146348
  // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
146232
146349
  // of things that should be considered independently.
@@ -156925,7 +157042,7 @@ var ts;
156925
157042
  var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; });
156926
157043
  if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
156927
157044
  return;
156928
- var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
157045
+ var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
156929
157046
  if (declaration === undefined)
156930
157047
  return;
156931
157048
  if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) {
@@ -156959,14 +157076,6 @@ var ts;
156959
157076
  }
156960
157077
  }
156961
157078
  }
156962
- function findAncestorMatchingSpan(sourceFile, span) {
156963
- var end = ts.textSpanEnd(span);
156964
- var token = ts.getTokenAtPosition(sourceFile, span.start);
156965
- while (token.end < end) {
156966
- token = token.parent;
156967
- }
156968
- return token;
156969
- }
156970
157079
  function tryGetConstraintFromDiagnosticMessage(messageText) {
156971
157080
  var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1];
156972
157081
  return constraint;
@@ -157847,7 +157956,7 @@ var ts;
157847
157956
  return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
157848
157957
  }
157849
157958
  var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
157850
- if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
157959
+ if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
157851
157960
  return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
157852
157961
  }
157853
157962
  return undefined;
@@ -158512,6 +158621,63 @@ var ts;
158512
158621
  })(ts || (ts = {}));
158513
158622
  /* @internal */
158514
158623
  var ts;
158624
+ (function (ts) {
158625
+ var codefix;
158626
+ (function (codefix) {
158627
+ var fixId = "fixNaNEquality";
158628
+ var errorCodes = [
158629
+ ts.Diagnostics.This_condition_will_always_return_0.code,
158630
+ ];
158631
+ codefix.registerCodeFix({
158632
+ errorCodes: errorCodes,
158633
+ getCodeActions: function (context) {
158634
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
158635
+ var info = getInfo(program, sourceFile, span);
158636
+ if (info === undefined)
158637
+ return;
158638
+ var suggestion = info.suggestion, expression = info.expression, arg = info.arg;
158639
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); });
158640
+ return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)];
158641
+ },
158642
+ fixIds: [fixId],
158643
+ getAllCodeActions: function (context) {
158644
+ return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
158645
+ var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length));
158646
+ if (info) {
158647
+ doChange(changes, diag.file, info.arg, info.expression);
158648
+ }
158649
+ });
158650
+ }
158651
+ });
158652
+ function getInfo(program, sourceFile, span) {
158653
+ var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; });
158654
+ if (diag === undefined || diag.relatedInformation === undefined)
158655
+ return;
158656
+ var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; });
158657
+ if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined)
158658
+ return;
158659
+ var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length));
158660
+ if (token === undefined)
158661
+ return;
158662
+ if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) {
158663
+ return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token };
158664
+ }
158665
+ return undefined;
158666
+ }
158667
+ function doChange(changes, sourceFile, arg, expression) {
158668
+ var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]);
158669
+ var operator = expression.operatorToken.kind;
158670
+ changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */
158671
+ ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression);
158672
+ }
158673
+ function getSuggestion(messageText) {
158674
+ var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1];
158675
+ return suggestion;
158676
+ }
158677
+ })(codefix = ts.codefix || (ts.codefix = {}));
158678
+ })(ts || (ts = {}));
158679
+ /* @internal */
158680
+ var ts;
158515
158681
  (function (ts) {
158516
158682
  var codefix;
158517
158683
  (function (codefix) {
@@ -161229,6 +161395,15 @@ var ts;
161229
161395
  symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); });
161230
161396
  }
161231
161397
  codefix.importSymbols = importSymbols;
161398
+ function findAncestorMatchingSpan(sourceFile, span) {
161399
+ var end = ts.textSpanEnd(span);
161400
+ var token = ts.getTokenAtPosition(sourceFile, span.start);
161401
+ while (token.end < end) {
161402
+ token = token.parent;
161403
+ }
161404
+ return token;
161405
+ }
161406
+ codefix.findAncestorMatchingSpan = findAncestorMatchingSpan;
161232
161407
  })(codefix = ts.codefix || (ts.codefix = {}));
161233
161408
  })(ts || (ts = {}));
161234
161409
  /* @internal */