typescript 4.9.0-dev.20221012 → 4.9.0-dev.20221014

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsserver.js CHANGED
@@ -109,7 +109,7 @@ var ts;
109
109
  // The following is baselined as a literal template type without intervention
110
110
  /** The version of the TypeScript compiler release */
111
111
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
112
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
112
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221014");
113
113
  /* @internal */
114
114
  var Comparison;
115
115
  (function (Comparison) {
@@ -9920,6 +9920,8 @@ var ts;
9920
9920
  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}\""),
9921
9921
  Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
9922
9922
  Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
9923
+ Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
9924
+ Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
9923
9925
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9924
9926
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9925
9927
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -21680,6 +21682,32 @@ var ts;
21680
21682
  return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21681
21683
  }
21682
21684
  ts.getParameterTypeNode = getParameterTypeNode;
21685
+ function isTypeDeclaration(node) {
21686
+ switch (node.kind) {
21687
+ case 165 /* SyntaxKind.TypeParameter */:
21688
+ case 260 /* SyntaxKind.ClassDeclaration */:
21689
+ case 261 /* SyntaxKind.InterfaceDeclaration */:
21690
+ case 262 /* SyntaxKind.TypeAliasDeclaration */:
21691
+ case 263 /* SyntaxKind.EnumDeclaration */:
21692
+ case 348 /* SyntaxKind.JSDocTypedefTag */:
21693
+ case 341 /* SyntaxKind.JSDocCallbackTag */:
21694
+ case 342 /* SyntaxKind.JSDocEnumTag */:
21695
+ return true;
21696
+ case 270 /* SyntaxKind.ImportClause */:
21697
+ return node.isTypeOnly;
21698
+ case 273 /* SyntaxKind.ImportSpecifier */:
21699
+ case 278 /* SyntaxKind.ExportSpecifier */:
21700
+ return node.parent.parent.isTypeOnly;
21701
+ default:
21702
+ return false;
21703
+ }
21704
+ }
21705
+ ts.isTypeDeclaration = isTypeDeclaration;
21706
+ function canHaveExportModifier(node) {
21707
+ return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
21708
+ || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
21709
+ }
21710
+ ts.canHaveExportModifier = canHaveExportModifier;
21683
21711
  })(ts || (ts = {}));
21684
21712
  /* @internal */
21685
21713
  var ts;
@@ -49082,8 +49110,6 @@ var ts;
49082
49110
  IntersectionState[IntersectionState["None"] = 0] = "None";
49083
49111
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49084
49112
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49085
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49086
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49087
49113
  })(IntersectionState || (IntersectionState = {}));
49088
49114
  var RecursionFlags;
49089
49115
  (function (RecursionFlags) {
@@ -55425,7 +55451,7 @@ var ts;
55425
55451
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55426
55452
  var indices = ts.indicesOf(statements);
55427
55453
  var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
55428
- if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
55454
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55429
55455
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55430
55456
  var index_1 = associatedIndices_1[_i];
55431
55457
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55459,15 +55485,6 @@ var ts;
55459
55485
  }
55460
55486
  return statements;
55461
55487
  }
55462
- function canHaveExportModifier(node) {
55463
- return ts.isEnumDeclaration(node) ||
55464
- ts.isVariableStatement(node) ||
55465
- ts.isFunctionDeclaration(node) ||
55466
- ts.isClassDeclaration(node) ||
55467
- (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
55468
- ts.isInterfaceDeclaration(node) ||
55469
- isTypeDeclaration(node);
55470
- }
55471
55488
  function addExportModifier(node) {
55472
55489
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55473
55490
  return ts.factory.updateModifiers(node, flags);
@@ -55714,7 +55731,7 @@ var ts;
55714
55731
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55715
55732
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55716
55733
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55717
- canHaveExportModifier(node)) {
55734
+ ts.canHaveExportModifier(node)) {
55718
55735
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55719
55736
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55720
55737
  }
@@ -63841,18 +63858,23 @@ var ts;
63841
63858
  var result;
63842
63859
  var extraTypes;
63843
63860
  var tailCount = 0;
63844
- var _loop_20 = function () {
63861
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63862
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63863
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63864
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63865
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63866
+ while (true) {
63845
63867
  if (tailCount === 1000) {
63846
63868
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63847
63869
  result = errorType;
63848
- return "break";
63870
+ break;
63849
63871
  }
63850
63872
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63851
63873
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63852
63874
  var checkTypeInstantiable = isGenericType(checkType);
63853
63875
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63854
63876
  if (checkType === wildcardType || extendsType === wildcardType) {
63855
- return { value: wildcardType };
63877
+ return wildcardType;
63856
63878
  }
63857
63879
  var combinedMapper = void 0;
63858
63880
  if (root.inferTypeParameters) {
@@ -63885,11 +63907,7 @@ var ts;
63885
63907
  }
63886
63908
  }
63887
63909
  }
63888
- // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
63889
- // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
63890
- // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
63891
- // so in those cases we refain from performing inference and retain the uninfered type parameter
63892
- if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
63910
+ if (!checkTypeInstantiable) {
63893
63911
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63894
63912
  // conditional type instead of deferring resolution. Also, we always want strict function
63895
63913
  // types rules (i.e. proper contravariance) for inferences.
@@ -63921,14 +63939,14 @@ var ts;
63921
63939
  var newRoot = falseType_1.root;
63922
63940
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63923
63941
  root = newRoot;
63924
- return "continue";
63942
+ continue;
63925
63943
  }
63926
63944
  if (canTailRecurse(falseType_1, mapper)) {
63927
- return "continue";
63945
+ continue;
63928
63946
  }
63929
63947
  }
63930
63948
  result = instantiateType(falseType_1, mapper);
63931
- return "break";
63949
+ break;
63932
63950
  }
63933
63951
  // Return trueType for a definitely true extends check. We check instantiations of the two
63934
63952
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63939,10 +63957,10 @@ var ts;
63939
63957
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63940
63958
  var trueMapper = combinedMapper || mapper;
63941
63959
  if (canTailRecurse(trueType_1, trueMapper)) {
63942
- return "continue";
63960
+ continue;
63943
63961
  }
63944
63962
  result = instantiateType(trueType_1, trueMapper);
63945
- return "break";
63963
+ break;
63946
63964
  }
63947
63965
  }
63948
63966
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63954,19 +63972,7 @@ var ts;
63954
63972
  result.combinedMapper = combinedMapper;
63955
63973
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63956
63974
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
63957
- return "break";
63958
- };
63959
- // We loop here for an immediately nested conditional type in the false position, effectively treating
63960
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63961
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63962
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63963
- // cases we increment the tail recursion counter and stop after 1000 iterations.
63964
- while (true) {
63965
- var state_6 = _loop_20();
63966
- if (typeof state_6 === "object")
63967
- return state_6.value;
63968
- if (state_6 === "break")
63969
- break;
63975
+ break;
63970
63976
  }
63971
63977
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63972
63978
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66420,7 +66426,7 @@ var ts;
66420
66426
  return 0 /* Ternary.False */;
66421
66427
  }
66422
66428
  }
66423
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66429
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66424
66430
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66425
66431
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66426
66432
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66448,27 +66454,6 @@ var ts;
66448
66454
  var result_7 = skipCaching ?
66449
66455
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66450
66456
  recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
66451
- // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66452
- // an extra property check where the intersection is viewed as a single object. The following are motivating
66453
- // examples that all should be errors, but aren't without this extra property check:
66454
- //
66455
- // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66456
- //
66457
- // declare let wrong: { a: { y: string } };
66458
- // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66459
- //
66460
- // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66461
- // x = y; // Mismatched property in source intersection
66462
- // }
66463
- //
66464
- // We suppress recursive intersection property checks because they can generate lots of work when relating
66465
- // recursive intersections that are structurally similar but not exactly identical. See #37854.
66466
- if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
66467
- 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 */); }))) {
66468
- inPropertyCheck = true;
66469
- result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
66470
- inPropertyCheck = false;
66471
- }
66472
66457
  if (result_7) {
66473
66458
  return result_7;
66474
66459
  }
@@ -66580,7 +66565,7 @@ var ts;
66580
66565
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66581
66566
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66582
66567
  }
66583
- var _loop_21 = function (prop) {
66568
+ var _loop_20 = function (prop) {
66584
66569
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66585
66570
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66586
66571
  if (reportErrors) {
@@ -66643,9 +66628,9 @@ var ts;
66643
66628
  };
66644
66629
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66645
66630
  var prop = _b[_i];
66646
- var state_7 = _loop_21(prop);
66647
- if (typeof state_7 === "object")
66648
- return state_7.value;
66631
+ var state_6 = _loop_20(prop);
66632
+ if (typeof state_6 === "object")
66633
+ return state_6.value;
66649
66634
  }
66650
66635
  return false;
66651
66636
  }
@@ -66866,8 +66851,7 @@ var ts;
66866
66851
  if (overflow) {
66867
66852
  return 0 /* Ternary.False */;
66868
66853
  }
66869
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66870
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66854
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66871
66855
  var entry = relation.get(id);
66872
66856
  if (entry !== undefined) {
66873
66857
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66897,7 +66881,7 @@ var ts;
66897
66881
  // A key that starts with "*" is an indication that we have type references that reference constrained
66898
66882
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66899
66883
  // were unconstrained.
66900
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66884
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66901
66885
  for (var i = 0; i < maybeCount; i++) {
66902
66886
  // If source and target are already being compared, consider them related with assumptions
66903
66887
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66984,7 +66968,7 @@ var ts;
66984
66968
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66985
66969
  var saveErrorInfo = captureErrorCalculationState();
66986
66970
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66987
- if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66971
+ if (relation !== identityRelation) {
66988
66972
  // The combined constraint of an intersection type is the intersection of the constraints of
66989
66973
  // the constituents. When an intersection type contains instantiable types with union type
66990
66974
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66998,10 +66982,33 @@ var ts;
66998
66982
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66999
66983
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
67000
66984
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
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);
66985
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66986
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66987
+ if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66988
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66989
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66990
+ }
66991
+ }
66992
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66993
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
66994
+ // examples that all should be errors, but aren't without this extra property check:
66995
+ //
66996
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66997
+ //
66998
+ // declare let wrong: { a: { y: string } };
66999
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
67000
+ //
67001
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
67002
+ // x = y; // Mismatched property in source intersection
67003
+ // }
67004
+ //
67005
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
67006
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
67007
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
67008
+ 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 */); }))) {
67009
+ inPropertyCheck = true;
67010
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67011
+ inPropertyCheck = false;
67005
67012
  }
67006
67013
  }
67007
67014
  if (result) {
@@ -67010,9 +67017,6 @@ var ts;
67010
67017
  return result;
67011
67018
  }
67012
67019
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
67013
- if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
67014
- return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67015
- }
67016
67020
  var result;
67017
67021
  var originalErrorInfo;
67018
67022
  var varianceCheckFailed = false;
@@ -67636,11 +67640,11 @@ var ts;
67636
67640
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67637
67641
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67638
67642
  var matchingTypes = [];
67639
- var _loop_22 = function (combination) {
67643
+ var _loop_21 = function (combination) {
67640
67644
  var hasMatch = false;
67641
67645
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67642
67646
  var type = _d[_c];
67643
- var _loop_23 = function (i) {
67647
+ var _loop_22 = function (i) {
67644
67648
  var sourceProperty = sourcePropertiesFiltered[i];
67645
67649
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67646
67650
  if (!targetProperty)
@@ -67656,8 +67660,8 @@ var ts;
67656
67660
  }
67657
67661
  };
67658
67662
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67659
- var state_9 = _loop_23(i);
67660
- switch (state_9) {
67663
+ var state_8 = _loop_22(i);
67664
+ switch (state_8) {
67661
67665
  case "continue-outer": continue outer;
67662
67666
  }
67663
67667
  }
@@ -67670,9 +67674,9 @@ var ts;
67670
67674
  };
67671
67675
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67672
67676
  var combination = discriminantCombinations_1[_a];
67673
- var state_8 = _loop_22(combination);
67674
- if (typeof state_8 === "object")
67675
- return state_8.value;
67677
+ var state_7 = _loop_21(combination);
67678
+ if (typeof state_7 === "object")
67679
+ return state_7.value;
67676
67680
  }
67677
67681
  // Compare the remaining non-discriminant properties of each match.
67678
67682
  var result = -1 /* Ternary.True */;
@@ -68377,7 +68381,7 @@ var ts;
68377
68381
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68378
68382
  links.variances = ts.emptyArray;
68379
68383
  var variances = [];
68380
- var _loop_24 = function (tp) {
68384
+ var _loop_23 = function (tp) {
68381
68385
  var modifiers = getVarianceModifiers(tp);
68382
68386
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68383
68387
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68415,7 +68419,7 @@ var ts;
68415
68419
  };
68416
68420
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68417
68421
  var tp = typeParameters_2[_i];
68418
- _loop_24(tp);
68422
+ _loop_23(tp);
68419
68423
  }
68420
68424
  links.variances = variances;
68421
68425
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -70373,7 +70377,7 @@ var ts;
70373
70377
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70374
70378
  // succeed. That would be a pointless and confusing outcome.
70375
70379
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70376
- var _loop_25 = function (i) {
70380
+ var _loop_24 = function (i) {
70377
70381
  var source_1 = matches ? matches[i] : neverType;
70378
70382
  var target_3 = types[i];
70379
70383
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70423,7 +70427,7 @@ var ts;
70423
70427
  inferFromTypes(source_1, target_3);
70424
70428
  };
70425
70429
  for (var i = 0; i < types.length; i++) {
70426
- _loop_25(i);
70430
+ _loop_24(i);
70427
70431
  }
70428
70432
  }
70429
70433
  }
@@ -70952,7 +70956,7 @@ var ts;
70952
70956
  function mapTypesByKeyProperty(types, name) {
70953
70957
  var map = new ts.Map();
70954
70958
  var count = 0;
70955
- var _loop_26 = function (type) {
70959
+ var _loop_25 = function (type) {
70956
70960
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70957
70961
  var discriminant = getTypeOfPropertyOfType(type, name);
70958
70962
  if (discriminant) {
@@ -70978,9 +70982,9 @@ var ts;
70978
70982
  };
70979
70983
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70980
70984
  var type = types_15[_i];
70981
- var state_10 = _loop_26(type);
70982
- if (typeof state_10 === "object")
70983
- return state_10.value;
70985
+ var state_9 = _loop_25(type);
70986
+ if (typeof state_9 === "object")
70987
+ return state_9.value;
70984
70988
  }
70985
70989
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70986
70990
  }
@@ -77436,7 +77440,7 @@ var ts;
77436
77440
  if (spreadIndex >= 0) {
77437
77441
  // Create synthetic arguments from spreads of tuple types.
77438
77442
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77439
- var _loop_27 = function (i) {
77443
+ var _loop_26 = function (i) {
77440
77444
  var arg = args[i];
77441
77445
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77442
77446
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77453,7 +77457,7 @@ var ts;
77453
77457
  }
77454
77458
  };
77455
77459
  for (var i = spreadIndex; i < args.length; i++) {
77456
- _loop_27(i);
77460
+ _loop_26(i);
77457
77461
  }
77458
77462
  return effectiveArgs_1;
77459
77463
  }
@@ -77782,7 +77786,7 @@ var ts;
77782
77786
  var min_3 = Number.MAX_VALUE;
77783
77787
  var minIndex = 0;
77784
77788
  var i_1 = 0;
77785
- var _loop_28 = function (c) {
77789
+ var _loop_27 = function (c) {
77786
77790
  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)); };
77787
77791
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77788
77792
  if (diags_2) {
@@ -77800,7 +77804,7 @@ var ts;
77800
77804
  };
77801
77805
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77802
77806
  var c = candidatesForArgumentError_1[_a];
77803
- _loop_28(c);
77807
+ _loop_27(c);
77804
77808
  }
77805
77809
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77806
77810
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77958,7 +77962,7 @@ var ts;
77958
77962
  }
77959
77963
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77960
77964
  var parameters = [];
77961
- var _loop_29 = function (i) {
77965
+ var _loop_28 = function (i) {
77962
77966
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77963
77967
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77964
77968
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77966,7 +77970,7 @@ var ts;
77966
77970
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77967
77971
  };
77968
77972
  for (var i = 0; i < maxNonRestParam; i++) {
77969
- _loop_29(i);
77973
+ _loop_28(i);
77970
77974
  }
77971
77975
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77972
77976
  var flags = 0 /* SignatureFlags.None */;
@@ -79598,7 +79602,17 @@ var ts;
79598
79602
  }
79599
79603
  function isExhaustiveSwitchStatement(node) {
79600
79604
  var links = getNodeLinks(node);
79601
- return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
79605
+ if (links.isExhaustive === undefined) {
79606
+ links.isExhaustive = 0; // Indicate resolution is in process
79607
+ var exhaustive = computeExhaustiveSwitchStatement(node);
79608
+ if (links.isExhaustive === 0) {
79609
+ links.isExhaustive = exhaustive;
79610
+ }
79611
+ }
79612
+ else if (links.isExhaustive === 0) {
79613
+ links.isExhaustive = false; // Resolve circularity to false
79614
+ }
79615
+ return links.isExhaustive;
79602
79616
  }
79603
79617
  function computeExhaustiveSwitchStatement(node) {
79604
79618
  if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) {
@@ -79606,7 +79620,7 @@ var ts;
79606
79620
  if (!witnesses) {
79607
79621
  return false;
79608
79622
  }
79609
- var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
79623
+ var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
79610
79624
  // Get the not-equal flags for all handled cases.
79611
79625
  var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
79612
79626
  if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) {
@@ -79616,7 +79630,7 @@ var ts;
79616
79630
  // A missing not-equal flag indicates that the type wasn't handled by some case.
79617
79631
  return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
79618
79632
  }
79619
- var type = getTypeOfExpression(node.expression);
79633
+ var type = checkExpressionCached(node.expression);
79620
79634
  if (!isLiteralType(type)) {
79621
79635
  return false;
79622
79636
  }
@@ -82014,7 +82028,7 @@ var ts;
82014
82028
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
82015
82029
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
82016
82030
  var indexSignatureMap_1 = new ts.Map();
82017
- var _loop_30 = function (declaration) {
82031
+ var _loop_29 = function (declaration) {
82018
82032
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
82019
82033
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
82020
82034
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -82029,7 +82043,7 @@ var ts;
82029
82043
  };
82030
82044
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
82031
82045
  var declaration = _a[_i];
82032
- _loop_30(declaration);
82046
+ _loop_29(declaration);
82033
82047
  }
82034
82048
  indexSignatureMap_1.forEach(function (entry) {
82035
82049
  if (entry.declarations.length > 1) {
@@ -82306,7 +82320,7 @@ var ts;
82306
82320
  }
82307
82321
  var symbol = getNodeLinks(node).resolvedSymbol;
82308
82322
  if (symbol) {
82309
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82323
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82310
82324
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82311
82325
  }
82312
82326
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -83684,7 +83698,7 @@ var ts;
83684
83698
  }
83685
83699
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83686
83700
  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;
83701
+ 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
83702
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83689
83703
  }
83690
83704
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -85638,7 +85652,7 @@ var ts;
85638
85652
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85639
85653
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85640
85654
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85641
- var _loop_31 = function (info) {
85655
+ var _loop_30 = function (info) {
85642
85656
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85643
85657
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85644
85658
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85655,7 +85669,7 @@ var ts;
85655
85669
  };
85656
85670
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85657
85671
  var info = indexInfos_9[_i];
85658
- _loop_31(info);
85672
+ _loop_30(info);
85659
85673
  }
85660
85674
  }
85661
85675
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85663,7 +85677,7 @@ var ts;
85663
85677
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85664
85678
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85665
85679
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85666
- var _loop_32 = function (info) {
85680
+ var _loop_31 = function (info) {
85667
85681
  if (info === checkInfo)
85668
85682
  return "continue";
85669
85683
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85678,7 +85692,7 @@ var ts;
85678
85692
  };
85679
85693
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85680
85694
  var info = indexInfos_10[_i];
85681
- _loop_32(info);
85695
+ _loop_31(info);
85682
85696
  }
85683
85697
  }
85684
85698
  function checkTypeNameIsReserved(name, message) {
@@ -85733,7 +85747,7 @@ var ts;
85733
85747
  }
85734
85748
  else {
85735
85749
  ts.forEach(jsdocParameters, function (_a, index) {
85736
- var name = _a.name;
85750
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85737
85751
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85738
85752
  return;
85739
85753
  }
@@ -85743,7 +85757,9 @@ var ts;
85743
85757
  }
85744
85758
  }
85745
85759
  else {
85746
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85760
+ if (!isNameFirst) {
85761
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85762
+ }
85747
85763
  }
85748
85764
  });
85749
85765
  }
@@ -85998,7 +86014,7 @@ var ts;
85998
86014
  var baseTypes = baseTypeNode && getBaseTypes(type);
85999
86015
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
86000
86016
  var baseStaticType = getBaseConstructorTypeOfClass(type);
86001
- var _loop_33 = function (member) {
86017
+ var _loop_32 = function (member) {
86002
86018
  if (ts.hasAmbientModifier(member)) {
86003
86019
  return "continue";
86004
86020
  }
@@ -86015,7 +86031,7 @@ var ts;
86015
86031
  };
86016
86032
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86017
86033
  var member = _a[_i];
86018
- _loop_33(member);
86034
+ _loop_32(member);
86019
86035
  }
86020
86036
  }
86021
86037
  /**
@@ -86103,7 +86119,7 @@ var ts;
86103
86119
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
86104
86120
  // 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
86121
  var issuedMemberError = false;
86106
- var _loop_34 = function (member) {
86122
+ var _loop_33 = function (member) {
86107
86123
  if (ts.isStatic(member)) {
86108
86124
  return "continue";
86109
86125
  }
@@ -86122,7 +86138,7 @@ var ts;
86122
86138
  };
86123
86139
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86124
86140
  var member = _a[_i];
86125
- _loop_34(member);
86141
+ _loop_33(member);
86126
86142
  }
86127
86143
  if (!issuedMemberError) {
86128
86144
  // check again with diagnostics to generate a less-specific error
@@ -86193,7 +86209,7 @@ var ts;
86193
86209
  var _a, _b, _c, _d;
86194
86210
  // NOTE: assignability is checked in checkClassDeclaration
86195
86211
  var baseProperties = getPropertiesOfType(baseType);
86196
- var _loop_35 = function (baseProperty) {
86212
+ var _loop_34 = function (baseProperty) {
86197
86213
  var base = getTargetSymbol(baseProperty);
86198
86214
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86199
86215
  return "continue";
@@ -86303,8 +86319,8 @@ var ts;
86303
86319
  };
86304
86320
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86305
86321
  var baseProperty = baseProperties_1[_i];
86306
- var state_11 = _loop_35(baseProperty);
86307
- switch (state_11) {
86322
+ var state_10 = _loop_34(baseProperty);
86323
+ switch (state_10) {
86308
86324
  case "continue-basePropertyCheck": continue basePropertyCheck;
86309
86325
  }
86310
86326
  }
@@ -88014,29 +88030,9 @@ var ts;
88014
88030
  }
88015
88031
  function isTypeDeclarationName(name) {
88016
88032
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
88017
- isTypeDeclaration(name.parent) &&
88033
+ ts.isTypeDeclaration(name.parent) &&
88018
88034
  ts.getNameOfDeclaration(name.parent) === name;
88019
88035
  }
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
88036
  // True if the given identifier is part of a type reference
88041
88037
  function isTypeReferenceIdentifier(node) {
88042
88038
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88469,7 +88465,7 @@ var ts;
88469
88465
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88470
88466
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88471
88467
  }
88472
- if (isTypeDeclaration(node)) {
88468
+ if (ts.isTypeDeclaration(node)) {
88473
88469
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88474
88470
  var symbol = getSymbolOfNode(node);
88475
88471
  return getDeclaredTypeOfSymbol(symbol);
@@ -125155,7 +125151,7 @@ var ts;
125155
125151
  });
125156
125152
  // Sort by paths closest to importing file Name directory
125157
125153
  var sortedPaths = [];
125158
- var _loop_36 = function (directory) {
125154
+ var _loop_35 = function (directory) {
125159
125155
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
125160
125156
  var pathsInDirectory;
125161
125157
  allFileNames.forEach(function (_a, fileName) {
@@ -125179,9 +125175,9 @@ var ts;
125179
125175
  };
125180
125176
  var out_directory_1;
125181
125177
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125182
- var state_12 = _loop_36(directory);
125178
+ var state_11 = _loop_35(directory);
125183
125179
  directory = out_directory_1;
125184
- if (state_12 === "break")
125180
+ if (state_11 === "break")
125185
125181
  break;
125186
125182
  }
125187
125183
  if (allFileNames.size) {
@@ -125250,7 +125246,7 @@ var ts;
125250
125246
  }
125251
125247
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125252
125248
  for (var key in paths) {
125253
- var _loop_37 = function (patternText_1) {
125249
+ var _loop_36 = function (patternText_1) {
125254
125250
  var pattern = ts.normalizePath(patternText_1);
125255
125251
  var indexOfStar = pattern.indexOf("*");
125256
125252
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125317,9 +125313,9 @@ var ts;
125317
125313
  };
125318
125314
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125319
125315
  var patternText_1 = _a[_i];
125320
- var state_13 = _loop_37(patternText_1);
125321
- if (typeof state_13 === "object")
125322
- return state_13.value;
125316
+ var state_12 = _loop_36(patternText_1);
125317
+ if (typeof state_12 === "object")
125318
+ return state_12.value;
125323
125319
  }
125324
125320
  }
125325
125321
  function validateEnding(_a) {
@@ -132430,6 +132426,10 @@ var ts;
132430
132426
  return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */;
132431
132427
  }
132432
132428
  ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport;
132429
+ function isSourceFileFromLibrary(program, node) {
132430
+ return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
132431
+ }
132432
+ ts.isSourceFileFromLibrary = isSourceFileFromLibrary;
132433
132433
  // #endregion
132434
132434
  })(ts || (ts = {}));
132435
132435
  /*@internal*/
@@ -157537,6 +157537,143 @@ var ts;
157537
157537
  })(ts || (ts = {}));
157538
157538
  /* @internal */
157539
157539
  var ts;
157540
+ (function (ts) {
157541
+ var codefix;
157542
+ (function (codefix) {
157543
+ var fixId = "fixImportNonExportedMember";
157544
+ var errorCodes = [
157545
+ ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code,
157546
+ ];
157547
+ codefix.registerCodeFix({
157548
+ errorCodes: errorCodes,
157549
+ fixIds: [fixId],
157550
+ getCodeActions: function (context) {
157551
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
157552
+ var info = getInfo(sourceFile, span.start, program);
157553
+ if (info === undefined)
157554
+ return undefined;
157555
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); });
157556
+ 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)];
157557
+ },
157558
+ getAllCodeActions: function (context) {
157559
+ var program = context.program;
157560
+ return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
157561
+ var exports = new ts.Map();
157562
+ codefix.eachDiagnostic(context, errorCodes, function (diag) {
157563
+ var info = getInfo(diag.file, diag.start, program);
157564
+ if (info === undefined)
157565
+ return undefined;
157566
+ var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile;
157567
+ if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) {
157568
+ changes.insertExportModifier(moduleSourceFile, node);
157569
+ }
157570
+ else {
157571
+ var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] };
157572
+ if (exportName.isTypeOnly) {
157573
+ moduleExports.typeOnlyExports.push(exportName);
157574
+ }
157575
+ else {
157576
+ moduleExports.exports.push(exportName);
157577
+ }
157578
+ exports.set(moduleSourceFile, moduleExports);
157579
+ }
157580
+ });
157581
+ exports.forEach(function (moduleExports, moduleSourceFile) {
157582
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true);
157583
+ if (exportDeclaration && exportDeclaration.isTypeOnly) {
157584
+ doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration);
157585
+ doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false));
157586
+ }
157587
+ else {
157588
+ doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration);
157589
+ }
157590
+ });
157591
+ }));
157592
+ }
157593
+ });
157594
+ function getInfo(sourceFile, pos, program) {
157595
+ var _a;
157596
+ var token = ts.getTokenAtPosition(sourceFile, pos);
157597
+ if (ts.isIdentifier(token)) {
157598
+ var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration);
157599
+ if (importDeclaration === undefined)
157600
+ return undefined;
157601
+ var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined;
157602
+ if (moduleSpecifier === undefined)
157603
+ return undefined;
157604
+ var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined);
157605
+ if (resolvedModule === undefined)
157606
+ return undefined;
157607
+ var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
157608
+ if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile))
157609
+ return undefined;
157610
+ var moduleSymbol = moduleSourceFile.symbol;
157611
+ var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals;
157612
+ if (locals === undefined)
157613
+ return undefined;
157614
+ var localSymbol = locals.get(token.escapedText);
157615
+ if (localSymbol === undefined)
157616
+ return undefined;
157617
+ var node = getNodeOfSymbol(localSymbol);
157618
+ if (node === undefined)
157619
+ return undefined;
157620
+ var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) };
157621
+ return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier };
157622
+ }
157623
+ return undefined;
157624
+ }
157625
+ function doChange(changes, program, _a) {
157626
+ var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile;
157627
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
157628
+ if (exportDeclaration) {
157629
+ updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
157630
+ }
157631
+ else if (ts.canHaveExportModifier(node)) {
157632
+ changes.insertExportModifier(moduleSourceFile, node);
157633
+ }
157634
+ else {
157635
+ createExport(changes, program, moduleSourceFile, [exportName]);
157636
+ }
157637
+ }
157638
+ function doChanges(changes, program, sourceFile, moduleExports, node) {
157639
+ if (ts.length(moduleExports)) {
157640
+ if (node) {
157641
+ updateExport(changes, program, sourceFile, node, moduleExports);
157642
+ }
157643
+ else {
157644
+ createExport(changes, program, sourceFile, moduleExports);
157645
+ }
157646
+ }
157647
+ }
157648
+ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
157649
+ var predicate = function (node) {
157650
+ return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly);
157651
+ };
157652
+ return ts.findLast(sourceFile.statements, predicate);
157653
+ }
157654
+ function updateExport(changes, program, sourceFile, node, names) {
157655
+ var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]);
157656
+ var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; }));
157657
+ 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));
157658
+ }
157659
+ function createExport(changes, program, sourceFile, names) {
157660
+ changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined));
157661
+ }
157662
+ function createExportSpecifiers(names, allowTypeModifier) {
157663
+ return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); }));
157664
+ }
157665
+ function getNodeOfSymbol(symbol) {
157666
+ if (symbol.valueDeclaration === undefined) {
157667
+ return ts.firstOrUndefined(symbol.declarations);
157668
+ }
157669
+ var declaration = symbol.valueDeclaration;
157670
+ var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined;
157671
+ return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
157672
+ }
157673
+ })(codefix = ts.codefix || (ts.codefix = {}));
157674
+ })(ts || (ts = {}));
157675
+ /* @internal */
157676
+ var ts;
157540
157677
  (function (ts) {
157541
157678
  var codefix;
157542
157679
  (function (codefix) {
@@ -158067,7 +158204,7 @@ var ts;
158067
158204
  var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; });
158068
158205
  if (argIndex < 0)
158069
158206
  return undefined;
158070
- var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */));
158207
+ var signature = checker.getResolvedSignature(parent.parent);
158071
158208
  if (!(signature && signature.declaration && signature.parameters[argIndex]))
158072
158209
  return undefined;
158073
158210
  var param = signature.parameters[argIndex].valueDeclaration;
@@ -158114,13 +158251,13 @@ var ts;
158114
158251
  if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) {
158115
158252
  var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
158116
158253
  var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
158117
- if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158254
+ if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158118
158255
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration };
158119
158256
  }
158120
158257
  var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
158121
158258
  if (sourceFile.commonJsModuleIndicator)
158122
158259
  return undefined;
158123
- if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
158260
+ if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) {
158124
158261
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile };
158125
158262
  }
158126
158263
  }
@@ -158130,7 +158267,7 @@ var ts;
158130
158267
  return undefined;
158131
158268
  // Prefer to change the class instead of the interface if they are merged
158132
158269
  var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); });
158133
- if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158270
+ if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158134
158271
  var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
158135
158272
  if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration)))
158136
158273
  return undefined;
@@ -158142,14 +158279,11 @@ var ts;
158142
158279
  return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
158143
158280
  }
158144
158281
  var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
158145
- if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158282
+ if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158146
158283
  return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
158147
158284
  }
158148
158285
  return undefined;
158149
158286
  }
158150
- function isSourceFileFromLibrary(program, node) {
158151
- return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
158152
- }
158153
158287
  function getActionsForMissingMemberDeclaration(context, info) {
158154
158288
  return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) :
158155
158289
  createActionsForAddMissingMemberInTypeScriptFile(context, info);
@@ -163575,8 +163709,8 @@ var ts;
163575
163709
  var i = 0;
163576
163710
  for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) {
163577
163711
  var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction;
163578
- var description = functionExtraction.description;
163579
163712
  if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
163713
+ var description = functionExtraction.description;
163580
163714
  if (functionExtraction.errors.length === 0) {
163581
163715
  // Don't issue refactorings with duplicated names.
163582
163716
  // Scopes come back in "innermost first" order, so extractions will
@@ -163600,15 +163734,15 @@ var ts;
163600
163734
  }
163601
163735
  }
163602
163736
  if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
163737
+ var description = constantExtraction.description;
163603
163738
  if (constantExtraction.errors.length === 0) {
163604
163739
  // Don't issue refactorings with duplicated names.
163605
163740
  // Scopes come back in "innermost first" order, so extractions will
163606
163741
  // preferentially go into nearer scopes
163607
- var description_1 = constantExtraction.description;
163608
- if (!usedConstantNames.has(description_1)) {
163609
- usedConstantNames.set(description_1, true);
163742
+ if (!usedConstantNames.has(description)) {
163743
+ usedConstantNames.set(description, true);
163610
163744
  constantActions.push({
163611
- description: description_1,
163745
+ description: description,
163612
163746
  name: "constant_scope_".concat(i),
163613
163747
  kind: extractConstantAction.kind
163614
163748
  });