typescript 4.9.0-dev.20221013 → 4.9.0-dev.20221015

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/typescript.js CHANGED
@@ -99,7 +99,7 @@ var ts;
99
99
  // The following is baselined as a literal template type without intervention
100
100
  /** The version of the TypeScript compiler release */
101
101
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
102
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221013");
102
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221015");
103
103
  /* @internal */
104
104
  var Comparison;
105
105
  (function (Comparison) {
@@ -9594,6 +9594,10 @@ var ts;
9594
9594
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
9595
9595
  Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
9596
9596
  Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
9597
+ Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."),
9598
+ Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."),
9599
+ Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."),
9600
+ Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."),
9597
9601
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
9598
9602
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
9599
9603
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -9910,6 +9914,8 @@ var ts;
9910
9914
  Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
9911
9915
  Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
9912
9916
  Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
9917
+ Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
9918
+ Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
9913
9919
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9914
9920
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9915
9921
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -21670,6 +21676,32 @@ var ts;
21670
21676
  return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21671
21677
  }
21672
21678
  ts.getParameterTypeNode = getParameterTypeNode;
21679
+ function isTypeDeclaration(node) {
21680
+ switch (node.kind) {
21681
+ case 165 /* SyntaxKind.TypeParameter */:
21682
+ case 260 /* SyntaxKind.ClassDeclaration */:
21683
+ case 261 /* SyntaxKind.InterfaceDeclaration */:
21684
+ case 262 /* SyntaxKind.TypeAliasDeclaration */:
21685
+ case 263 /* SyntaxKind.EnumDeclaration */:
21686
+ case 348 /* SyntaxKind.JSDocTypedefTag */:
21687
+ case 341 /* SyntaxKind.JSDocCallbackTag */:
21688
+ case 342 /* SyntaxKind.JSDocEnumTag */:
21689
+ return true;
21690
+ case 270 /* SyntaxKind.ImportClause */:
21691
+ return node.isTypeOnly;
21692
+ case 273 /* SyntaxKind.ImportSpecifier */:
21693
+ case 278 /* SyntaxKind.ExportSpecifier */:
21694
+ return node.parent.parent.isTypeOnly;
21695
+ default:
21696
+ return false;
21697
+ }
21698
+ }
21699
+ ts.isTypeDeclaration = isTypeDeclaration;
21700
+ function canHaveExportModifier(node) {
21701
+ return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
21702
+ || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
21703
+ }
21704
+ ts.canHaveExportModifier = canHaveExportModifier;
21673
21705
  })(ts || (ts = {}));
21674
21706
  /* @internal */
21675
21707
  var ts;
@@ -44294,6 +44326,9 @@ var ts;
44294
44326
  requestContainingDirectory: containingDirectory,
44295
44327
  reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
44296
44328
  };
44329
+ if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) {
44330
+ trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", "));
44331
+ }
44297
44332
  var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
44298
44333
  return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
44299
44334
  function tryResolve(extensions) {
@@ -44883,7 +44918,7 @@ var ts;
44883
44918
  }
44884
44919
  if (mainExport) {
44885
44920
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
44886
- return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
44921
+ return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, ".");
44887
44922
  }
44888
44923
  }
44889
44924
  else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
@@ -44963,7 +44998,7 @@ var ts;
44963
44998
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
44964
44999
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
44965
45000
  var target = lookupTable[moduleName];
44966
- return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
45001
+ return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName);
44967
45002
  }
44968
45003
  var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
44969
45004
  for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
@@ -44972,17 +45007,17 @@ var ts;
44972
45007
  var target = lookupTable[potentialTarget];
44973
45008
  var starPos = potentialTarget.indexOf("*");
44974
45009
  var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
44975
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45010
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44976
45011
  }
44977
45012
  else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
44978
45013
  var target = lookupTable[potentialTarget];
44979
45014
  var subpath = moduleName.substring(potentialTarget.length - 1);
44980
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
45015
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
44981
45016
  }
44982
45017
  else if (ts.startsWith(moduleName, potentialTarget)) {
44983
45018
  var target = lookupTable[potentialTarget];
44984
45019
  var subpath = moduleName.substring(potentialTarget.length);
44985
- return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
45020
+ return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget);
44986
45021
  }
44987
45022
  }
44988
45023
  function matchesPatternWithTrailer(target, name) {
@@ -44999,7 +45034,7 @@ var ts;
44999
45034
  */
45000
45035
  function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
45001
45036
  return loadModuleFromTargetImportOrExport;
45002
- function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
45037
+ function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
45003
45038
  if (typeof target === "string") {
45004
45039
  if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
45005
45040
  if (state.traceEnabled) {
@@ -45010,6 +45045,8 @@ var ts;
45010
45045
  if (!ts.startsWith(target, "./")) {
45011
45046
  if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
45012
45047
  var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
45048
+ traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
45049
+ traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
45013
45050
  var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
45014
45051
  return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
45015
45052
  }
@@ -45036,6 +45073,9 @@ var ts;
45036
45073
  }
45037
45074
  return toSearchResult(/*value*/ undefined);
45038
45075
  }
45076
+ if (state.traceEnabled) {
45077
+ trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
45078
+ }
45039
45079
  var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
45040
45080
  var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
45041
45081
  if (inputLink)
@@ -45045,14 +45085,18 @@ var ts;
45045
45085
  else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
45046
45086
  if (!Array.isArray(target)) {
45047
45087
  for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
45048
- var key = _a[_i];
45049
- if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
45050
- var subTarget = target[key];
45051
- var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
45088
+ var condition = _a[_i];
45089
+ if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
45090
+ traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
45091
+ var subTarget = target[condition];
45092
+ var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
45052
45093
  if (result) {
45053
45094
  return result;
45054
45095
  }
45055
45096
  }
45097
+ else {
45098
+ traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition);
45099
+ }
45056
45100
  }
45057
45101
  return undefined;
45058
45102
  }
@@ -45065,7 +45109,7 @@ var ts;
45065
45109
  }
45066
45110
  for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
45067
45111
  var elem = target_2[_b];
45068
- var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
45112
+ var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
45069
45113
  if (result) {
45070
45114
  return result;
45071
45115
  }
@@ -45481,6 +45525,15 @@ var ts;
45481
45525
  function toSearchResult(value) {
45482
45526
  return value !== undefined ? { value: value } : undefined;
45483
45527
  }
45528
+ function traceIfEnabled(state, diagnostic) {
45529
+ var args = [];
45530
+ for (var _i = 2; _i < arguments.length; _i++) {
45531
+ args[_i - 2] = arguments[_i];
45532
+ }
45533
+ if (state.traceEnabled) {
45534
+ trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false));
45535
+ }
45536
+ }
45484
45537
  })(ts || (ts = {}));
45485
45538
  /* @internal */
45486
45539
  var ts;
@@ -49072,8 +49125,6 @@ var ts;
49072
49125
  IntersectionState[IntersectionState["None"] = 0] = "None";
49073
49126
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49074
49127
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49075
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49076
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49077
49128
  })(IntersectionState || (IntersectionState = {}));
49078
49129
  var RecursionFlags;
49079
49130
  (function (RecursionFlags) {
@@ -55415,7 +55466,7 @@ var ts;
55415
55466
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55416
55467
  var indices = ts.indicesOf(statements);
55417
55468
  var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
55418
- if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
55469
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55419
55470
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55420
55471
  var index_1 = associatedIndices_1[_i];
55421
55472
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55449,15 +55500,6 @@ var ts;
55449
55500
  }
55450
55501
  return statements;
55451
55502
  }
55452
- function canHaveExportModifier(node) {
55453
- return ts.isEnumDeclaration(node) ||
55454
- ts.isVariableStatement(node) ||
55455
- ts.isFunctionDeclaration(node) ||
55456
- ts.isClassDeclaration(node) ||
55457
- (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
55458
- ts.isInterfaceDeclaration(node) ||
55459
- isTypeDeclaration(node);
55460
- }
55461
55503
  function addExportModifier(node) {
55462
55504
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55463
55505
  return ts.factory.updateModifiers(node, flags);
@@ -55704,7 +55746,7 @@ var ts;
55704
55746
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55705
55747
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55706
55748
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55707
- canHaveExportModifier(node)) {
55749
+ ts.canHaveExportModifier(node)) {
55708
55750
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55709
55751
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55710
55752
  }
@@ -63831,18 +63873,23 @@ var ts;
63831
63873
  var result;
63832
63874
  var extraTypes;
63833
63875
  var tailCount = 0;
63834
- var _loop_20 = function () {
63876
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63877
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63878
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63879
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63880
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63881
+ while (true) {
63835
63882
  if (tailCount === 1000) {
63836
63883
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63837
63884
  result = errorType;
63838
- return "break";
63885
+ break;
63839
63886
  }
63840
63887
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63841
63888
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63842
63889
  var checkTypeInstantiable = isGenericType(checkType);
63843
63890
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63844
63891
  if (checkType === wildcardType || extendsType === wildcardType) {
63845
- return { value: wildcardType };
63892
+ return wildcardType;
63846
63893
  }
63847
63894
  var combinedMapper = void 0;
63848
63895
  if (root.inferTypeParameters) {
@@ -63875,11 +63922,7 @@ var ts;
63875
63922
  }
63876
63923
  }
63877
63924
  }
63878
- // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
63879
- // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
63880
- // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
63881
- // so in those cases we refain from performing inference and retain the uninfered type parameter
63882
- if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
63925
+ if (!checkTypeInstantiable) {
63883
63926
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63884
63927
  // conditional type instead of deferring resolution. Also, we always want strict function
63885
63928
  // types rules (i.e. proper contravariance) for inferences.
@@ -63911,14 +63954,14 @@ var ts;
63911
63954
  var newRoot = falseType_1.root;
63912
63955
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63913
63956
  root = newRoot;
63914
- return "continue";
63957
+ continue;
63915
63958
  }
63916
63959
  if (canTailRecurse(falseType_1, mapper)) {
63917
- return "continue";
63960
+ continue;
63918
63961
  }
63919
63962
  }
63920
63963
  result = instantiateType(falseType_1, mapper);
63921
- return "break";
63964
+ break;
63922
63965
  }
63923
63966
  // Return trueType for a definitely true extends check. We check instantiations of the two
63924
63967
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63929,10 +63972,10 @@ var ts;
63929
63972
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63930
63973
  var trueMapper = combinedMapper || mapper;
63931
63974
  if (canTailRecurse(trueType_1, trueMapper)) {
63932
- return "continue";
63975
+ continue;
63933
63976
  }
63934
63977
  result = instantiateType(trueType_1, trueMapper);
63935
- return "break";
63978
+ break;
63936
63979
  }
63937
63980
  }
63938
63981
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63944,19 +63987,7 @@ var ts;
63944
63987
  result.combinedMapper = combinedMapper;
63945
63988
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63946
63989
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
63947
- return "break";
63948
- };
63949
- // We loop here for an immediately nested conditional type in the false position, effectively treating
63950
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63951
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63952
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63953
- // cases we increment the tail recursion counter and stop after 1000 iterations.
63954
- while (true) {
63955
- var state_6 = _loop_20();
63956
- if (typeof state_6 === "object")
63957
- return state_6.value;
63958
- if (state_6 === "break")
63959
- break;
63990
+ break;
63960
63991
  }
63961
63992
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63962
63993
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66410,7 +66441,7 @@ var ts;
66410
66441
  return 0 /* Ternary.False */;
66411
66442
  }
66412
66443
  }
66413
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66444
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66414
66445
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66415
66446
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66416
66447
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66438,27 +66469,6 @@ var ts;
66438
66469
  var result_7 = skipCaching ?
66439
66470
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66440
66471
  recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
66441
- // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66442
- // an extra property check where the intersection is viewed as a single object. The following are motivating
66443
- // examples that all should be errors, but aren't without this extra property check:
66444
- //
66445
- // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66446
- //
66447
- // declare let wrong: { a: { y: string } };
66448
- // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66449
- //
66450
- // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66451
- // x = y; // Mismatched property in source intersection
66452
- // }
66453
- //
66454
- // We suppress recursive intersection property checks because they can generate lots of work when relating
66455
- // recursive intersections that are structurally similar but not exactly identical. See #37854.
66456
- if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
66457
- isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
66458
- inPropertyCheck = true;
66459
- result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
66460
- inPropertyCheck = false;
66461
- }
66462
66472
  if (result_7) {
66463
66473
  return result_7;
66464
66474
  }
@@ -66570,7 +66580,7 @@ var ts;
66570
66580
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66571
66581
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66572
66582
  }
66573
- var _loop_21 = function (prop) {
66583
+ var _loop_20 = function (prop) {
66574
66584
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66575
66585
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66576
66586
  if (reportErrors) {
@@ -66633,9 +66643,9 @@ var ts;
66633
66643
  };
66634
66644
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66635
66645
  var prop = _b[_i];
66636
- var state_7 = _loop_21(prop);
66637
- if (typeof state_7 === "object")
66638
- return state_7.value;
66646
+ var state_6 = _loop_20(prop);
66647
+ if (typeof state_6 === "object")
66648
+ return state_6.value;
66639
66649
  }
66640
66650
  return false;
66641
66651
  }
@@ -66856,8 +66866,7 @@ var ts;
66856
66866
  if (overflow) {
66857
66867
  return 0 /* Ternary.False */;
66858
66868
  }
66859
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66860
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66869
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66861
66870
  var entry = relation.get(id);
66862
66871
  if (entry !== undefined) {
66863
66872
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66887,7 +66896,7 @@ var ts;
66887
66896
  // A key that starts with "*" is an indication that we have type references that reference constrained
66888
66897
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66889
66898
  // were unconstrained.
66890
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66899
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66891
66900
  for (var i = 0; i < maybeCount; i++) {
66892
66901
  // If source and target are already being compared, consider them related with assumptions
66893
66902
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66974,7 +66983,7 @@ var ts;
66974
66983
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66975
66984
  var saveErrorInfo = captureErrorCalculationState();
66976
66985
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66977
- if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66986
+ if (relation !== identityRelation) {
66978
66987
  // The combined constraint of an intersection type is the intersection of the constraints of
66979
66988
  // the constituents. When an intersection type contains instantiable types with union type
66980
66989
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66988,10 +66997,33 @@ var ts;
66988
66997
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66989
66998
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66990
66999
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66991
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66992
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66993
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66994
- result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67000
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
67001
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67002
+ if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67003
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67004
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
67005
+ }
67006
+ }
67007
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
67008
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
67009
+ // examples that all should be errors, but aren't without this extra property check:
67010
+ //
67011
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
67012
+ //
67013
+ // declare let wrong: { a: { y: string } };
67014
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
67015
+ //
67016
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
67017
+ // x = y; // Mismatched property in source intersection
67018
+ // }
67019
+ //
67020
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
67021
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
67022
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
67023
+ isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
67024
+ inPropertyCheck = true;
67025
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67026
+ inPropertyCheck = false;
66995
67027
  }
66996
67028
  }
66997
67029
  if (result) {
@@ -67000,9 +67032,6 @@ var ts;
67000
67032
  return result;
67001
67033
  }
67002
67034
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
67003
- if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
67004
- return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67005
- }
67006
67035
  var result;
67007
67036
  var originalErrorInfo;
67008
67037
  var varianceCheckFailed = false;
@@ -67626,11 +67655,11 @@ var ts;
67626
67655
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67627
67656
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67628
67657
  var matchingTypes = [];
67629
- var _loop_22 = function (combination) {
67658
+ var _loop_21 = function (combination) {
67630
67659
  var hasMatch = false;
67631
67660
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67632
67661
  var type = _d[_c];
67633
- var _loop_23 = function (i) {
67662
+ var _loop_22 = function (i) {
67634
67663
  var sourceProperty = sourcePropertiesFiltered[i];
67635
67664
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67636
67665
  if (!targetProperty)
@@ -67646,8 +67675,8 @@ var ts;
67646
67675
  }
67647
67676
  };
67648
67677
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67649
- var state_9 = _loop_23(i);
67650
- switch (state_9) {
67678
+ var state_8 = _loop_22(i);
67679
+ switch (state_8) {
67651
67680
  case "continue-outer": continue outer;
67652
67681
  }
67653
67682
  }
@@ -67660,9 +67689,9 @@ var ts;
67660
67689
  };
67661
67690
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67662
67691
  var combination = discriminantCombinations_1[_a];
67663
- var state_8 = _loop_22(combination);
67664
- if (typeof state_8 === "object")
67665
- return state_8.value;
67692
+ var state_7 = _loop_21(combination);
67693
+ if (typeof state_7 === "object")
67694
+ return state_7.value;
67666
67695
  }
67667
67696
  // Compare the remaining non-discriminant properties of each match.
67668
67697
  var result = -1 /* Ternary.True */;
@@ -68367,7 +68396,7 @@ var ts;
68367
68396
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68368
68397
  links.variances = ts.emptyArray;
68369
68398
  var variances = [];
68370
- var _loop_24 = function (tp) {
68399
+ var _loop_23 = function (tp) {
68371
68400
  var modifiers = getVarianceModifiers(tp);
68372
68401
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68373
68402
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68405,7 +68434,7 @@ var ts;
68405
68434
  };
68406
68435
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68407
68436
  var tp = typeParameters_2[_i];
68408
- _loop_24(tp);
68437
+ _loop_23(tp);
68409
68438
  }
68410
68439
  links.variances = variances;
68411
68440
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -70363,7 +70392,7 @@ var ts;
70363
70392
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70364
70393
  // succeed. That would be a pointless and confusing outcome.
70365
70394
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70366
- var _loop_25 = function (i) {
70395
+ var _loop_24 = function (i) {
70367
70396
  var source_1 = matches ? matches[i] : neverType;
70368
70397
  var target_3 = types[i];
70369
70398
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70413,7 +70442,7 @@ var ts;
70413
70442
  inferFromTypes(source_1, target_3);
70414
70443
  };
70415
70444
  for (var i = 0; i < types.length; i++) {
70416
- _loop_25(i);
70445
+ _loop_24(i);
70417
70446
  }
70418
70447
  }
70419
70448
  }
@@ -70942,7 +70971,7 @@ var ts;
70942
70971
  function mapTypesByKeyProperty(types, name) {
70943
70972
  var map = new ts.Map();
70944
70973
  var count = 0;
70945
- var _loop_26 = function (type) {
70974
+ var _loop_25 = function (type) {
70946
70975
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70947
70976
  var discriminant = getTypeOfPropertyOfType(type, name);
70948
70977
  if (discriminant) {
@@ -70968,9 +70997,9 @@ var ts;
70968
70997
  };
70969
70998
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70970
70999
  var type = types_15[_i];
70971
- var state_10 = _loop_26(type);
70972
- if (typeof state_10 === "object")
70973
- return state_10.value;
71000
+ var state_9 = _loop_25(type);
71001
+ if (typeof state_9 === "object")
71002
+ return state_9.value;
70974
71003
  }
70975
71004
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70976
71005
  }
@@ -77426,7 +77455,7 @@ var ts;
77426
77455
  if (spreadIndex >= 0) {
77427
77456
  // Create synthetic arguments from spreads of tuple types.
77428
77457
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77429
- var _loop_27 = function (i) {
77458
+ var _loop_26 = function (i) {
77430
77459
  var arg = args[i];
77431
77460
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77432
77461
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77443,7 +77472,7 @@ var ts;
77443
77472
  }
77444
77473
  };
77445
77474
  for (var i = spreadIndex; i < args.length; i++) {
77446
- _loop_27(i);
77475
+ _loop_26(i);
77447
77476
  }
77448
77477
  return effectiveArgs_1;
77449
77478
  }
@@ -77772,7 +77801,7 @@ var ts;
77772
77801
  var min_3 = Number.MAX_VALUE;
77773
77802
  var minIndex = 0;
77774
77803
  var i_1 = 0;
77775
- var _loop_28 = function (c) {
77804
+ var _loop_27 = function (c) {
77776
77805
  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)); };
77777
77806
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77778
77807
  if (diags_2) {
@@ -77790,7 +77819,7 @@ var ts;
77790
77819
  };
77791
77820
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77792
77821
  var c = candidatesForArgumentError_1[_a];
77793
- _loop_28(c);
77822
+ _loop_27(c);
77794
77823
  }
77795
77824
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77796
77825
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77948,7 +77977,7 @@ var ts;
77948
77977
  }
77949
77978
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77950
77979
  var parameters = [];
77951
- var _loop_29 = function (i) {
77980
+ var _loop_28 = function (i) {
77952
77981
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77953
77982
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77954
77983
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77956,7 +77985,7 @@ var ts;
77956
77985
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77957
77986
  };
77958
77987
  for (var i = 0; i < maxNonRestParam; i++) {
77959
- _loop_29(i);
77988
+ _loop_28(i);
77960
77989
  }
77961
77990
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77962
77991
  var flags = 0 /* SignatureFlags.None */;
@@ -82014,7 +82043,7 @@ var ts;
82014
82043
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
82015
82044
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
82016
82045
  var indexSignatureMap_1 = new ts.Map();
82017
- var _loop_30 = function (declaration) {
82046
+ var _loop_29 = function (declaration) {
82018
82047
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
82019
82048
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
82020
82049
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -82029,7 +82058,7 @@ var ts;
82029
82058
  };
82030
82059
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
82031
82060
  var declaration = _a[_i];
82032
- _loop_30(declaration);
82061
+ _loop_29(declaration);
82033
82062
  }
82034
82063
  indexSignatureMap_1.forEach(function (entry) {
82035
82064
  if (entry.declarations.length > 1) {
@@ -82306,7 +82335,7 @@ var ts;
82306
82335
  }
82307
82336
  var symbol = getNodeLinks(node).resolvedSymbol;
82308
82337
  if (symbol) {
82309
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82338
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82310
82339
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82311
82340
  }
82312
82341
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -83684,7 +83713,7 @@ var ts;
83684
83713
  }
83685
83714
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83686
83715
  var node = ts.getNameOfDeclaration(declaration) || declaration;
83687
- var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83716
+ var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83688
83717
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83689
83718
  }
83690
83719
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -85638,7 +85667,7 @@ var ts;
85638
85667
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85639
85668
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85640
85669
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85641
- var _loop_31 = function (info) {
85670
+ var _loop_30 = function (info) {
85642
85671
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85643
85672
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85644
85673
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85655,7 +85684,7 @@ var ts;
85655
85684
  };
85656
85685
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85657
85686
  var info = indexInfos_9[_i];
85658
- _loop_31(info);
85687
+ _loop_30(info);
85659
85688
  }
85660
85689
  }
85661
85690
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85663,7 +85692,7 @@ var ts;
85663
85692
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85664
85693
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85665
85694
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85666
- var _loop_32 = function (info) {
85695
+ var _loop_31 = function (info) {
85667
85696
  if (info === checkInfo)
85668
85697
  return "continue";
85669
85698
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85678,7 +85707,7 @@ var ts;
85678
85707
  };
85679
85708
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85680
85709
  var info = indexInfos_10[_i];
85681
- _loop_32(info);
85710
+ _loop_31(info);
85682
85711
  }
85683
85712
  }
85684
85713
  function checkTypeNameIsReserved(name, message) {
@@ -85733,7 +85762,7 @@ var ts;
85733
85762
  }
85734
85763
  else {
85735
85764
  ts.forEach(jsdocParameters, function (_a, index) {
85736
- var name = _a.name;
85765
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85737
85766
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85738
85767
  return;
85739
85768
  }
@@ -85743,7 +85772,9 @@ var ts;
85743
85772
  }
85744
85773
  }
85745
85774
  else {
85746
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85775
+ if (!isNameFirst) {
85776
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85777
+ }
85747
85778
  }
85748
85779
  });
85749
85780
  }
@@ -85998,7 +86029,7 @@ var ts;
85998
86029
  var baseTypes = baseTypeNode && getBaseTypes(type);
85999
86030
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
86000
86031
  var baseStaticType = getBaseConstructorTypeOfClass(type);
86001
- var _loop_33 = function (member) {
86032
+ var _loop_32 = function (member) {
86002
86033
  if (ts.hasAmbientModifier(member)) {
86003
86034
  return "continue";
86004
86035
  }
@@ -86015,7 +86046,7 @@ var ts;
86015
86046
  };
86016
86047
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86017
86048
  var member = _a[_i];
86018
- _loop_33(member);
86049
+ _loop_32(member);
86019
86050
  }
86020
86051
  }
86021
86052
  /**
@@ -86103,7 +86134,7 @@ var ts;
86103
86134
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
86104
86135
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
86105
86136
  var issuedMemberError = false;
86106
- var _loop_34 = function (member) {
86137
+ var _loop_33 = function (member) {
86107
86138
  if (ts.isStatic(member)) {
86108
86139
  return "continue";
86109
86140
  }
@@ -86122,7 +86153,7 @@ var ts;
86122
86153
  };
86123
86154
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86124
86155
  var member = _a[_i];
86125
- _loop_34(member);
86156
+ _loop_33(member);
86126
86157
  }
86127
86158
  if (!issuedMemberError) {
86128
86159
  // check again with diagnostics to generate a less-specific error
@@ -86193,7 +86224,7 @@ var ts;
86193
86224
  var _a, _b, _c, _d;
86194
86225
  // NOTE: assignability is checked in checkClassDeclaration
86195
86226
  var baseProperties = getPropertiesOfType(baseType);
86196
- var _loop_35 = function (baseProperty) {
86227
+ var _loop_34 = function (baseProperty) {
86197
86228
  var base = getTargetSymbol(baseProperty);
86198
86229
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86199
86230
  return "continue";
@@ -86303,8 +86334,8 @@ var ts;
86303
86334
  };
86304
86335
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86305
86336
  var baseProperty = baseProperties_1[_i];
86306
- var state_11 = _loop_35(baseProperty);
86307
- switch (state_11) {
86337
+ var state_10 = _loop_34(baseProperty);
86338
+ switch (state_10) {
86308
86339
  case "continue-basePropertyCheck": continue basePropertyCheck;
86309
86340
  }
86310
86341
  }
@@ -88014,29 +88045,9 @@ var ts;
88014
88045
  }
88015
88046
  function isTypeDeclarationName(name) {
88016
88047
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
88017
- isTypeDeclaration(name.parent) &&
88048
+ ts.isTypeDeclaration(name.parent) &&
88018
88049
  ts.getNameOfDeclaration(name.parent) === name;
88019
88050
  }
88020
- function isTypeDeclaration(node) {
88021
- switch (node.kind) {
88022
- case 165 /* SyntaxKind.TypeParameter */:
88023
- case 260 /* SyntaxKind.ClassDeclaration */:
88024
- case 261 /* SyntaxKind.InterfaceDeclaration */:
88025
- case 262 /* SyntaxKind.TypeAliasDeclaration */:
88026
- case 263 /* SyntaxKind.EnumDeclaration */:
88027
- case 348 /* SyntaxKind.JSDocTypedefTag */:
88028
- case 341 /* SyntaxKind.JSDocCallbackTag */:
88029
- case 342 /* SyntaxKind.JSDocEnumTag */:
88030
- return true;
88031
- case 270 /* SyntaxKind.ImportClause */:
88032
- return node.isTypeOnly;
88033
- case 273 /* SyntaxKind.ImportSpecifier */:
88034
- case 278 /* SyntaxKind.ExportSpecifier */:
88035
- return node.parent.parent.isTypeOnly;
88036
- default:
88037
- return false;
88038
- }
88039
- }
88040
88051
  // True if the given identifier is part of a type reference
88041
88052
  function isTypeReferenceIdentifier(node) {
88042
88053
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88469,7 +88480,7 @@ var ts;
88469
88480
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88470
88481
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88471
88482
  }
88472
- if (isTypeDeclaration(node)) {
88483
+ if (ts.isTypeDeclaration(node)) {
88473
88484
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88474
88485
  var symbol = getSymbolOfNode(node);
88475
88486
  return getDeclaredTypeOfSymbol(symbol);
@@ -125155,7 +125166,7 @@ var ts;
125155
125166
  });
125156
125167
  // Sort by paths closest to importing file Name directory
125157
125168
  var sortedPaths = [];
125158
- var _loop_36 = function (directory) {
125169
+ var _loop_35 = function (directory) {
125159
125170
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
125160
125171
  var pathsInDirectory;
125161
125172
  allFileNames.forEach(function (_a, fileName) {
@@ -125179,9 +125190,9 @@ var ts;
125179
125190
  };
125180
125191
  var out_directory_1;
125181
125192
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125182
- var state_12 = _loop_36(directory);
125193
+ var state_11 = _loop_35(directory);
125183
125194
  directory = out_directory_1;
125184
- if (state_12 === "break")
125195
+ if (state_11 === "break")
125185
125196
  break;
125186
125197
  }
125187
125198
  if (allFileNames.size) {
@@ -125250,7 +125261,7 @@ var ts;
125250
125261
  }
125251
125262
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125252
125263
  for (var key in paths) {
125253
- var _loop_37 = function (patternText_1) {
125264
+ var _loop_36 = function (patternText_1) {
125254
125265
  var pattern = ts.normalizePath(patternText_1);
125255
125266
  var indexOfStar = pattern.indexOf("*");
125256
125267
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125317,9 +125328,9 @@ var ts;
125317
125328
  };
125318
125329
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125319
125330
  var patternText_1 = _a[_i];
125320
- var state_13 = _loop_37(patternText_1);
125321
- if (typeof state_13 === "object")
125322
- return state_13.value;
125331
+ var state_12 = _loop_36(patternText_1);
125332
+ if (typeof state_12 === "object")
125333
+ return state_12.value;
125323
125334
  }
125324
125335
  }
125325
125336
  function validateEnding(_a) {
@@ -132849,6 +132860,10 @@ var ts;
132849
132860
  return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */;
132850
132861
  }
132851
132862
  ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport;
132863
+ function isSourceFileFromLibrary(program, node) {
132864
+ return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
132865
+ }
132866
+ ts.isSourceFileFromLibrary = isSourceFileFromLibrary;
132852
132867
  // #endregion
132853
132868
  })(ts || (ts = {}));
132854
132869
  /*@internal*/
@@ -157956,6 +157971,143 @@ var ts;
157956
157971
  })(ts || (ts = {}));
157957
157972
  /* @internal */
157958
157973
  var ts;
157974
+ (function (ts) {
157975
+ var codefix;
157976
+ (function (codefix) {
157977
+ var fixId = "fixImportNonExportedMember";
157978
+ var errorCodes = [
157979
+ ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code,
157980
+ ];
157981
+ codefix.registerCodeFix({
157982
+ errorCodes: errorCodes,
157983
+ fixIds: [fixId],
157984
+ getCodeActions: function (context) {
157985
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
157986
+ var info = getInfo(sourceFile, span.start, program);
157987
+ if (info === undefined)
157988
+ return undefined;
157989
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); });
157990
+ return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)];
157991
+ },
157992
+ getAllCodeActions: function (context) {
157993
+ var program = context.program;
157994
+ return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
157995
+ var exports = new ts.Map();
157996
+ codefix.eachDiagnostic(context, errorCodes, function (diag) {
157997
+ var info = getInfo(diag.file, diag.start, program);
157998
+ if (info === undefined)
157999
+ return undefined;
158000
+ var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile;
158001
+ if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) {
158002
+ changes.insertExportModifier(moduleSourceFile, node);
158003
+ }
158004
+ else {
158005
+ var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] };
158006
+ if (exportName.isTypeOnly) {
158007
+ moduleExports.typeOnlyExports.push(exportName);
158008
+ }
158009
+ else {
158010
+ moduleExports.exports.push(exportName);
158011
+ }
158012
+ exports.set(moduleSourceFile, moduleExports);
158013
+ }
158014
+ });
158015
+ exports.forEach(function (moduleExports, moduleSourceFile) {
158016
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true);
158017
+ if (exportDeclaration && exportDeclaration.isTypeOnly) {
158018
+ doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration);
158019
+ doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false));
158020
+ }
158021
+ else {
158022
+ doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration);
158023
+ }
158024
+ });
158025
+ }));
158026
+ }
158027
+ });
158028
+ function getInfo(sourceFile, pos, program) {
158029
+ var _a;
158030
+ var token = ts.getTokenAtPosition(sourceFile, pos);
158031
+ if (ts.isIdentifier(token)) {
158032
+ var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration);
158033
+ if (importDeclaration === undefined)
158034
+ return undefined;
158035
+ var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined;
158036
+ if (moduleSpecifier === undefined)
158037
+ return undefined;
158038
+ var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined);
158039
+ if (resolvedModule === undefined)
158040
+ return undefined;
158041
+ var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
158042
+ if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile))
158043
+ return undefined;
158044
+ var moduleSymbol = moduleSourceFile.symbol;
158045
+ var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals;
158046
+ if (locals === undefined)
158047
+ return undefined;
158048
+ var localSymbol = locals.get(token.escapedText);
158049
+ if (localSymbol === undefined)
158050
+ return undefined;
158051
+ var node = getNodeOfSymbol(localSymbol);
158052
+ if (node === undefined)
158053
+ return undefined;
158054
+ var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) };
158055
+ return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier };
158056
+ }
158057
+ return undefined;
158058
+ }
158059
+ function doChange(changes, program, _a) {
158060
+ var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile;
158061
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
158062
+ if (exportDeclaration) {
158063
+ updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
158064
+ }
158065
+ else if (ts.canHaveExportModifier(node)) {
158066
+ changes.insertExportModifier(moduleSourceFile, node);
158067
+ }
158068
+ else {
158069
+ createExport(changes, program, moduleSourceFile, [exportName]);
158070
+ }
158071
+ }
158072
+ function doChanges(changes, program, sourceFile, moduleExports, node) {
158073
+ if (ts.length(moduleExports)) {
158074
+ if (node) {
158075
+ updateExport(changes, program, sourceFile, node, moduleExports);
158076
+ }
158077
+ else {
158078
+ createExport(changes, program, sourceFile, moduleExports);
158079
+ }
158080
+ }
158081
+ }
158082
+ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
158083
+ var predicate = function (node) {
158084
+ return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly);
158085
+ };
158086
+ return ts.findLast(sourceFile.statements, predicate);
158087
+ }
158088
+ function updateExport(changes, program, sourceFile, node, names) {
158089
+ var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]);
158090
+ var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; }));
158091
+ changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause));
158092
+ }
158093
+ function createExport(changes, program, sourceFile, names) {
158094
+ changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined));
158095
+ }
158096
+ function createExportSpecifiers(names, allowTypeModifier) {
158097
+ return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); }));
158098
+ }
158099
+ function getNodeOfSymbol(symbol) {
158100
+ if (symbol.valueDeclaration === undefined) {
158101
+ return ts.firstOrUndefined(symbol.declarations);
158102
+ }
158103
+ var declaration = symbol.valueDeclaration;
158104
+ var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined;
158105
+ return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
158106
+ }
158107
+ })(codefix = ts.codefix || (ts.codefix = {}));
158108
+ })(ts || (ts = {}));
158109
+ /* @internal */
158110
+ var ts;
157959
158111
  (function (ts) {
157960
158112
  var codefix;
157961
158113
  (function (codefix) {
@@ -158486,7 +158638,7 @@ var ts;
158486
158638
  var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; });
158487
158639
  if (argIndex < 0)
158488
158640
  return undefined;
158489
- var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */));
158641
+ var signature = checker.getResolvedSignature(parent.parent);
158490
158642
  if (!(signature && signature.declaration && signature.parameters[argIndex]))
158491
158643
  return undefined;
158492
158644
  var param = signature.parameters[argIndex].valueDeclaration;
@@ -158533,13 +158685,13 @@ var ts;
158533
158685
  if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) {
158534
158686
  var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
158535
158687
  var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
158536
- if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158688
+ if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158537
158689
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration };
158538
158690
  }
158539
158691
  var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
158540
158692
  if (sourceFile.commonJsModuleIndicator)
158541
158693
  return undefined;
158542
- if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
158694
+ if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) {
158543
158695
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile };
158544
158696
  }
158545
158697
  }
@@ -158549,7 +158701,7 @@ var ts;
158549
158701
  return undefined;
158550
158702
  // Prefer to change the class instead of the interface if they are merged
158551
158703
  var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); });
158552
- if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158704
+ if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158553
158705
  var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
158554
158706
  if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration)))
158555
158707
  return undefined;
@@ -158561,14 +158713,11 @@ var ts;
158561
158713
  return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
158562
158714
  }
158563
158715
  var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
158564
- if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158716
+ if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158565
158717
  return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
158566
158718
  }
158567
158719
  return undefined;
158568
158720
  }
158569
- function isSourceFileFromLibrary(program, node) {
158570
- return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
158571
- }
158572
158721
  function getActionsForMissingMemberDeclaration(context, info) {
158573
158722
  return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) :
158574
158723
  createActionsForAddMissingMemberInTypeScriptFile(context, info);
@@ -163994,8 +164143,8 @@ var ts;
163994
164143
  var i = 0;
163995
164144
  for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) {
163996
164145
  var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction;
163997
- var description = functionExtraction.description;
163998
164146
  if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
164147
+ var description = functionExtraction.description;
163999
164148
  if (functionExtraction.errors.length === 0) {
164000
164149
  // Don't issue refactorings with duplicated names.
164001
164150
  // Scopes come back in "innermost first" order, so extractions will
@@ -164019,15 +164168,15 @@ var ts;
164019
164168
  }
164020
164169
  }
164021
164170
  if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
164171
+ var description = constantExtraction.description;
164022
164172
  if (constantExtraction.errors.length === 0) {
164023
164173
  // Don't issue refactorings with duplicated names.
164024
164174
  // Scopes come back in "innermost first" order, so extractions will
164025
164175
  // preferentially go into nearer scopes
164026
- var description_1 = constantExtraction.description;
164027
- if (!usedConstantNames.has(description_1)) {
164028
- usedConstantNames.set(description_1, true);
164176
+ if (!usedConstantNames.has(description)) {
164177
+ usedConstantNames.set(description, true);
164029
164178
  constantActions.push({
164030
- description: description_1,
164179
+ description: description,
164031
164180
  name: "constant_scope_".concat(i),
164032
164181
  kind: extractConstantAction.kind
164033
164182
  });