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.
@@ -108,7 +108,7 @@ var ts;
108
108
  // The following is baselined as a literal template type without intervention
109
109
  /** The version of the TypeScript compiler release */
110
110
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
111
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
111
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221014");
112
112
  /* @internal */
113
113
  var Comparison;
114
114
  (function (Comparison) {
@@ -9919,6 +9919,8 @@ var ts;
9919
9919
  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}\""),
9920
9920
  Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
9921
9921
  Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
9922
+ Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
9923
+ Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
9922
9924
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9923
9925
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9924
9926
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -21679,6 +21681,32 @@ var ts;
21679
21681
  return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21680
21682
  }
21681
21683
  ts.getParameterTypeNode = getParameterTypeNode;
21684
+ function isTypeDeclaration(node) {
21685
+ switch (node.kind) {
21686
+ case 165 /* SyntaxKind.TypeParameter */:
21687
+ case 260 /* SyntaxKind.ClassDeclaration */:
21688
+ case 261 /* SyntaxKind.InterfaceDeclaration */:
21689
+ case 262 /* SyntaxKind.TypeAliasDeclaration */:
21690
+ case 263 /* SyntaxKind.EnumDeclaration */:
21691
+ case 348 /* SyntaxKind.JSDocTypedefTag */:
21692
+ case 341 /* SyntaxKind.JSDocCallbackTag */:
21693
+ case 342 /* SyntaxKind.JSDocEnumTag */:
21694
+ return true;
21695
+ case 270 /* SyntaxKind.ImportClause */:
21696
+ return node.isTypeOnly;
21697
+ case 273 /* SyntaxKind.ImportSpecifier */:
21698
+ case 278 /* SyntaxKind.ExportSpecifier */:
21699
+ return node.parent.parent.isTypeOnly;
21700
+ default:
21701
+ return false;
21702
+ }
21703
+ }
21704
+ ts.isTypeDeclaration = isTypeDeclaration;
21705
+ function canHaveExportModifier(node) {
21706
+ return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
21707
+ || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
21708
+ }
21709
+ ts.canHaveExportModifier = canHaveExportModifier;
21682
21710
  })(ts || (ts = {}));
21683
21711
  /* @internal */
21684
21712
  var ts;
@@ -49081,8 +49109,6 @@ var ts;
49081
49109
  IntersectionState[IntersectionState["None"] = 0] = "None";
49082
49110
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49083
49111
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49084
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49085
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49086
49112
  })(IntersectionState || (IntersectionState = {}));
49087
49113
  var RecursionFlags;
49088
49114
  (function (RecursionFlags) {
@@ -55424,7 +55450,7 @@ var ts;
55424
55450
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55425
55451
  var indices = ts.indicesOf(statements);
55426
55452
  var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
55427
- if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
55453
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55428
55454
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55429
55455
  var index_1 = associatedIndices_1[_i];
55430
55456
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55458,15 +55484,6 @@ var ts;
55458
55484
  }
55459
55485
  return statements;
55460
55486
  }
55461
- function canHaveExportModifier(node) {
55462
- return ts.isEnumDeclaration(node) ||
55463
- ts.isVariableStatement(node) ||
55464
- ts.isFunctionDeclaration(node) ||
55465
- ts.isClassDeclaration(node) ||
55466
- (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
55467
- ts.isInterfaceDeclaration(node) ||
55468
- isTypeDeclaration(node);
55469
- }
55470
55487
  function addExportModifier(node) {
55471
55488
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55472
55489
  return ts.factory.updateModifiers(node, flags);
@@ -55713,7 +55730,7 @@ var ts;
55713
55730
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55714
55731
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55715
55732
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55716
- canHaveExportModifier(node)) {
55733
+ ts.canHaveExportModifier(node)) {
55717
55734
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55718
55735
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55719
55736
  }
@@ -63840,18 +63857,23 @@ var ts;
63840
63857
  var result;
63841
63858
  var extraTypes;
63842
63859
  var tailCount = 0;
63843
- var _loop_20 = function () {
63860
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63861
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63862
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63863
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63864
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63865
+ while (true) {
63844
63866
  if (tailCount === 1000) {
63845
63867
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63846
63868
  result = errorType;
63847
- return "break";
63869
+ break;
63848
63870
  }
63849
63871
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63850
63872
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63851
63873
  var checkTypeInstantiable = isGenericType(checkType);
63852
63874
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63853
63875
  if (checkType === wildcardType || extendsType === wildcardType) {
63854
- return { value: wildcardType };
63876
+ return wildcardType;
63855
63877
  }
63856
63878
  var combinedMapper = void 0;
63857
63879
  if (root.inferTypeParameters) {
@@ -63884,11 +63906,7 @@ var ts;
63884
63906
  }
63885
63907
  }
63886
63908
  }
63887
- // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
63888
- // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
63889
- // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
63890
- // so in those cases we refain from performing inference and retain the uninfered type parameter
63891
- if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
63909
+ if (!checkTypeInstantiable) {
63892
63910
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63893
63911
  // conditional type instead of deferring resolution. Also, we always want strict function
63894
63912
  // types rules (i.e. proper contravariance) for inferences.
@@ -63920,14 +63938,14 @@ var ts;
63920
63938
  var newRoot = falseType_1.root;
63921
63939
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63922
63940
  root = newRoot;
63923
- return "continue";
63941
+ continue;
63924
63942
  }
63925
63943
  if (canTailRecurse(falseType_1, mapper)) {
63926
- return "continue";
63944
+ continue;
63927
63945
  }
63928
63946
  }
63929
63947
  result = instantiateType(falseType_1, mapper);
63930
- return "break";
63948
+ break;
63931
63949
  }
63932
63950
  // Return trueType for a definitely true extends check. We check instantiations of the two
63933
63951
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63938,10 +63956,10 @@ var ts;
63938
63956
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63939
63957
  var trueMapper = combinedMapper || mapper;
63940
63958
  if (canTailRecurse(trueType_1, trueMapper)) {
63941
- return "continue";
63959
+ continue;
63942
63960
  }
63943
63961
  result = instantiateType(trueType_1, trueMapper);
63944
- return "break";
63962
+ break;
63945
63963
  }
63946
63964
  }
63947
63965
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63953,19 +63971,7 @@ var ts;
63953
63971
  result.combinedMapper = combinedMapper;
63954
63972
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63955
63973
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
63956
- return "break";
63957
- };
63958
- // We loop here for an immediately nested conditional type in the false position, effectively treating
63959
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63960
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63961
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63962
- // cases we increment the tail recursion counter and stop after 1000 iterations.
63963
- while (true) {
63964
- var state_6 = _loop_20();
63965
- if (typeof state_6 === "object")
63966
- return state_6.value;
63967
- if (state_6 === "break")
63968
- break;
63974
+ break;
63969
63975
  }
63970
63976
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63971
63977
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66419,7 +66425,7 @@ var ts;
66419
66425
  return 0 /* Ternary.False */;
66420
66426
  }
66421
66427
  }
66422
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66428
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66423
66429
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66424
66430
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66425
66431
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66447,27 +66453,6 @@ var ts;
66447
66453
  var result_7 = skipCaching ?
66448
66454
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66449
66455
  recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
66450
- // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66451
- // an extra property check where the intersection is viewed as a single object. The following are motivating
66452
- // examples that all should be errors, but aren't without this extra property check:
66453
- //
66454
- // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66455
- //
66456
- // declare let wrong: { a: { y: string } };
66457
- // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66458
- //
66459
- // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66460
- // x = y; // Mismatched property in source intersection
66461
- // }
66462
- //
66463
- // We suppress recursive intersection property checks because they can generate lots of work when relating
66464
- // recursive intersections that are structurally similar but not exactly identical. See #37854.
66465
- if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
66466
- 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 */); }))) {
66467
- inPropertyCheck = true;
66468
- result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
66469
- inPropertyCheck = false;
66470
- }
66471
66456
  if (result_7) {
66472
66457
  return result_7;
66473
66458
  }
@@ -66579,7 +66564,7 @@ var ts;
66579
66564
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66580
66565
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66581
66566
  }
66582
- var _loop_21 = function (prop) {
66567
+ var _loop_20 = function (prop) {
66583
66568
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66584
66569
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66585
66570
  if (reportErrors) {
@@ -66642,9 +66627,9 @@ var ts;
66642
66627
  };
66643
66628
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66644
66629
  var prop = _b[_i];
66645
- var state_7 = _loop_21(prop);
66646
- if (typeof state_7 === "object")
66647
- return state_7.value;
66630
+ var state_6 = _loop_20(prop);
66631
+ if (typeof state_6 === "object")
66632
+ return state_6.value;
66648
66633
  }
66649
66634
  return false;
66650
66635
  }
@@ -66865,8 +66850,7 @@ var ts;
66865
66850
  if (overflow) {
66866
66851
  return 0 /* Ternary.False */;
66867
66852
  }
66868
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66869
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66853
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66870
66854
  var entry = relation.get(id);
66871
66855
  if (entry !== undefined) {
66872
66856
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66896,7 +66880,7 @@ var ts;
66896
66880
  // A key that starts with "*" is an indication that we have type references that reference constrained
66897
66881
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66898
66882
  // were unconstrained.
66899
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66883
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66900
66884
  for (var i = 0; i < maybeCount; i++) {
66901
66885
  // If source and target are already being compared, consider them related with assumptions
66902
66886
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66983,7 +66967,7 @@ var ts;
66983
66967
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66984
66968
  var saveErrorInfo = captureErrorCalculationState();
66985
66969
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66986
- if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66970
+ if (relation !== identityRelation) {
66987
66971
  // The combined constraint of an intersection type is the intersection of the constraints of
66988
66972
  // the constituents. When an intersection type contains instantiable types with union type
66989
66973
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66997,10 +66981,33 @@ var ts;
66997
66981
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66998
66982
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66999
66983
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
67000
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
67001
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
67002
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
67003
- result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66984
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66985
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66986
+ if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66987
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66988
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66989
+ }
66990
+ }
66991
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66992
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
66993
+ // examples that all should be errors, but aren't without this extra property check:
66994
+ //
66995
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66996
+ //
66997
+ // declare let wrong: { a: { y: string } };
66998
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66999
+ //
67000
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
67001
+ // x = y; // Mismatched property in source intersection
67002
+ // }
67003
+ //
67004
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
67005
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
67006
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
67007
+ 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 */); }))) {
67008
+ inPropertyCheck = true;
67009
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67010
+ inPropertyCheck = false;
67004
67011
  }
67005
67012
  }
67006
67013
  if (result) {
@@ -67009,9 +67016,6 @@ var ts;
67009
67016
  return result;
67010
67017
  }
67011
67018
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
67012
- if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
67013
- return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
67014
- }
67015
67019
  var result;
67016
67020
  var originalErrorInfo;
67017
67021
  var varianceCheckFailed = false;
@@ -67635,11 +67639,11 @@ var ts;
67635
67639
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67636
67640
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67637
67641
  var matchingTypes = [];
67638
- var _loop_22 = function (combination) {
67642
+ var _loop_21 = function (combination) {
67639
67643
  var hasMatch = false;
67640
67644
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67641
67645
  var type = _d[_c];
67642
- var _loop_23 = function (i) {
67646
+ var _loop_22 = function (i) {
67643
67647
  var sourceProperty = sourcePropertiesFiltered[i];
67644
67648
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67645
67649
  if (!targetProperty)
@@ -67655,8 +67659,8 @@ var ts;
67655
67659
  }
67656
67660
  };
67657
67661
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67658
- var state_9 = _loop_23(i);
67659
- switch (state_9) {
67662
+ var state_8 = _loop_22(i);
67663
+ switch (state_8) {
67660
67664
  case "continue-outer": continue outer;
67661
67665
  }
67662
67666
  }
@@ -67669,9 +67673,9 @@ var ts;
67669
67673
  };
67670
67674
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67671
67675
  var combination = discriminantCombinations_1[_a];
67672
- var state_8 = _loop_22(combination);
67673
- if (typeof state_8 === "object")
67674
- return state_8.value;
67676
+ var state_7 = _loop_21(combination);
67677
+ if (typeof state_7 === "object")
67678
+ return state_7.value;
67675
67679
  }
67676
67680
  // Compare the remaining non-discriminant properties of each match.
67677
67681
  var result = -1 /* Ternary.True */;
@@ -68376,7 +68380,7 @@ var ts;
68376
68380
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68377
68381
  links.variances = ts.emptyArray;
68378
68382
  var variances = [];
68379
- var _loop_24 = function (tp) {
68383
+ var _loop_23 = function (tp) {
68380
68384
  var modifiers = getVarianceModifiers(tp);
68381
68385
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68382
68386
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68414,7 +68418,7 @@ var ts;
68414
68418
  };
68415
68419
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68416
68420
  var tp = typeParameters_2[_i];
68417
- _loop_24(tp);
68421
+ _loop_23(tp);
68418
68422
  }
68419
68423
  links.variances = variances;
68420
68424
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -70372,7 +70376,7 @@ var ts;
70372
70376
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70373
70377
  // succeed. That would be a pointless and confusing outcome.
70374
70378
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70375
- var _loop_25 = function (i) {
70379
+ var _loop_24 = function (i) {
70376
70380
  var source_1 = matches ? matches[i] : neverType;
70377
70381
  var target_3 = types[i];
70378
70382
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70422,7 +70426,7 @@ var ts;
70422
70426
  inferFromTypes(source_1, target_3);
70423
70427
  };
70424
70428
  for (var i = 0; i < types.length; i++) {
70425
- _loop_25(i);
70429
+ _loop_24(i);
70426
70430
  }
70427
70431
  }
70428
70432
  }
@@ -70951,7 +70955,7 @@ var ts;
70951
70955
  function mapTypesByKeyProperty(types, name) {
70952
70956
  var map = new ts.Map();
70953
70957
  var count = 0;
70954
- var _loop_26 = function (type) {
70958
+ var _loop_25 = function (type) {
70955
70959
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70956
70960
  var discriminant = getTypeOfPropertyOfType(type, name);
70957
70961
  if (discriminant) {
@@ -70977,9 +70981,9 @@ var ts;
70977
70981
  };
70978
70982
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70979
70983
  var type = types_15[_i];
70980
- var state_10 = _loop_26(type);
70981
- if (typeof state_10 === "object")
70982
- return state_10.value;
70984
+ var state_9 = _loop_25(type);
70985
+ if (typeof state_9 === "object")
70986
+ return state_9.value;
70983
70987
  }
70984
70988
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70985
70989
  }
@@ -77435,7 +77439,7 @@ var ts;
77435
77439
  if (spreadIndex >= 0) {
77436
77440
  // Create synthetic arguments from spreads of tuple types.
77437
77441
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77438
- var _loop_27 = function (i) {
77442
+ var _loop_26 = function (i) {
77439
77443
  var arg = args[i];
77440
77444
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77441
77445
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77452,7 +77456,7 @@ var ts;
77452
77456
  }
77453
77457
  };
77454
77458
  for (var i = spreadIndex; i < args.length; i++) {
77455
- _loop_27(i);
77459
+ _loop_26(i);
77456
77460
  }
77457
77461
  return effectiveArgs_1;
77458
77462
  }
@@ -77781,7 +77785,7 @@ var ts;
77781
77785
  var min_3 = Number.MAX_VALUE;
77782
77786
  var minIndex = 0;
77783
77787
  var i_1 = 0;
77784
- var _loop_28 = function (c) {
77788
+ var _loop_27 = function (c) {
77785
77789
  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)); };
77786
77790
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77787
77791
  if (diags_2) {
@@ -77799,7 +77803,7 @@ var ts;
77799
77803
  };
77800
77804
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77801
77805
  var c = candidatesForArgumentError_1[_a];
77802
- _loop_28(c);
77806
+ _loop_27(c);
77803
77807
  }
77804
77808
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77805
77809
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77957,7 +77961,7 @@ var ts;
77957
77961
  }
77958
77962
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77959
77963
  var parameters = [];
77960
- var _loop_29 = function (i) {
77964
+ var _loop_28 = function (i) {
77961
77965
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77962
77966
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77963
77967
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77965,7 +77969,7 @@ var ts;
77965
77969
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77966
77970
  };
77967
77971
  for (var i = 0; i < maxNonRestParam; i++) {
77968
- _loop_29(i);
77972
+ _loop_28(i);
77969
77973
  }
77970
77974
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77971
77975
  var flags = 0 /* SignatureFlags.None */;
@@ -79597,7 +79601,17 @@ var ts;
79597
79601
  }
79598
79602
  function isExhaustiveSwitchStatement(node) {
79599
79603
  var links = getNodeLinks(node);
79600
- return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
79604
+ if (links.isExhaustive === undefined) {
79605
+ links.isExhaustive = 0; // Indicate resolution is in process
79606
+ var exhaustive = computeExhaustiveSwitchStatement(node);
79607
+ if (links.isExhaustive === 0) {
79608
+ links.isExhaustive = exhaustive;
79609
+ }
79610
+ }
79611
+ else if (links.isExhaustive === 0) {
79612
+ links.isExhaustive = false; // Resolve circularity to false
79613
+ }
79614
+ return links.isExhaustive;
79601
79615
  }
79602
79616
  function computeExhaustiveSwitchStatement(node) {
79603
79617
  if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) {
@@ -79605,7 +79619,7 @@ var ts;
79605
79619
  if (!witnesses) {
79606
79620
  return false;
79607
79621
  }
79608
- var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
79622
+ var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
79609
79623
  // Get the not-equal flags for all handled cases.
79610
79624
  var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
79611
79625
  if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) {
@@ -79615,7 +79629,7 @@ var ts;
79615
79629
  // A missing not-equal flag indicates that the type wasn't handled by some case.
79616
79630
  return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
79617
79631
  }
79618
- var type = getTypeOfExpression(node.expression);
79632
+ var type = checkExpressionCached(node.expression);
79619
79633
  if (!isLiteralType(type)) {
79620
79634
  return false;
79621
79635
  }
@@ -82013,7 +82027,7 @@ var ts;
82013
82027
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
82014
82028
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
82015
82029
  var indexSignatureMap_1 = new ts.Map();
82016
- var _loop_30 = function (declaration) {
82030
+ var _loop_29 = function (declaration) {
82017
82031
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
82018
82032
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
82019
82033
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -82028,7 +82042,7 @@ var ts;
82028
82042
  };
82029
82043
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
82030
82044
  var declaration = _a[_i];
82031
- _loop_30(declaration);
82045
+ _loop_29(declaration);
82032
82046
  }
82033
82047
  indexSignatureMap_1.forEach(function (entry) {
82034
82048
  if (entry.declarations.length > 1) {
@@ -82305,7 +82319,7 @@ var ts;
82305
82319
  }
82306
82320
  var symbol = getNodeLinks(node).resolvedSymbol;
82307
82321
  if (symbol) {
82308
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82322
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82309
82323
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82310
82324
  }
82311
82325
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -83683,7 +83697,7 @@ var ts;
83683
83697
  }
83684
83698
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83685
83699
  var node = ts.getNameOfDeclaration(declaration) || declaration;
83686
- var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83700
+ var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83687
83701
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83688
83702
  }
83689
83703
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -85637,7 +85651,7 @@ var ts;
85637
85651
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85638
85652
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85639
85653
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85640
- var _loop_31 = function (info) {
85654
+ var _loop_30 = function (info) {
85641
85655
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85642
85656
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85643
85657
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85654,7 +85668,7 @@ var ts;
85654
85668
  };
85655
85669
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85656
85670
  var info = indexInfos_9[_i];
85657
- _loop_31(info);
85671
+ _loop_30(info);
85658
85672
  }
85659
85673
  }
85660
85674
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85662,7 +85676,7 @@ var ts;
85662
85676
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85663
85677
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85664
85678
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85665
- var _loop_32 = function (info) {
85679
+ var _loop_31 = function (info) {
85666
85680
  if (info === checkInfo)
85667
85681
  return "continue";
85668
85682
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85677,7 +85691,7 @@ var ts;
85677
85691
  };
85678
85692
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85679
85693
  var info = indexInfos_10[_i];
85680
- _loop_32(info);
85694
+ _loop_31(info);
85681
85695
  }
85682
85696
  }
85683
85697
  function checkTypeNameIsReserved(name, message) {
@@ -85732,7 +85746,7 @@ var ts;
85732
85746
  }
85733
85747
  else {
85734
85748
  ts.forEach(jsdocParameters, function (_a, index) {
85735
- var name = _a.name;
85749
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85736
85750
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85737
85751
  return;
85738
85752
  }
@@ -85742,7 +85756,9 @@ var ts;
85742
85756
  }
85743
85757
  }
85744
85758
  else {
85745
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85759
+ if (!isNameFirst) {
85760
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85761
+ }
85746
85762
  }
85747
85763
  });
85748
85764
  }
@@ -85997,7 +86013,7 @@ var ts;
85997
86013
  var baseTypes = baseTypeNode && getBaseTypes(type);
85998
86014
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85999
86015
  var baseStaticType = getBaseConstructorTypeOfClass(type);
86000
- var _loop_33 = function (member) {
86016
+ var _loop_32 = function (member) {
86001
86017
  if (ts.hasAmbientModifier(member)) {
86002
86018
  return "continue";
86003
86019
  }
@@ -86014,7 +86030,7 @@ var ts;
86014
86030
  };
86015
86031
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86016
86032
  var member = _a[_i];
86017
- _loop_33(member);
86033
+ _loop_32(member);
86018
86034
  }
86019
86035
  }
86020
86036
  /**
@@ -86102,7 +86118,7 @@ var ts;
86102
86118
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
86103
86119
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
86104
86120
  var issuedMemberError = false;
86105
- var _loop_34 = function (member) {
86121
+ var _loop_33 = function (member) {
86106
86122
  if (ts.isStatic(member)) {
86107
86123
  return "continue";
86108
86124
  }
@@ -86121,7 +86137,7 @@ var ts;
86121
86137
  };
86122
86138
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86123
86139
  var member = _a[_i];
86124
- _loop_34(member);
86140
+ _loop_33(member);
86125
86141
  }
86126
86142
  if (!issuedMemberError) {
86127
86143
  // check again with diagnostics to generate a less-specific error
@@ -86192,7 +86208,7 @@ var ts;
86192
86208
  var _a, _b, _c, _d;
86193
86209
  // NOTE: assignability is checked in checkClassDeclaration
86194
86210
  var baseProperties = getPropertiesOfType(baseType);
86195
- var _loop_35 = function (baseProperty) {
86211
+ var _loop_34 = function (baseProperty) {
86196
86212
  var base = getTargetSymbol(baseProperty);
86197
86213
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86198
86214
  return "continue";
@@ -86302,8 +86318,8 @@ var ts;
86302
86318
  };
86303
86319
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86304
86320
  var baseProperty = baseProperties_1[_i];
86305
- var state_11 = _loop_35(baseProperty);
86306
- switch (state_11) {
86321
+ var state_10 = _loop_34(baseProperty);
86322
+ switch (state_10) {
86307
86323
  case "continue-basePropertyCheck": continue basePropertyCheck;
86308
86324
  }
86309
86325
  }
@@ -88013,29 +88029,9 @@ var ts;
88013
88029
  }
88014
88030
  function isTypeDeclarationName(name) {
88015
88031
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
88016
- isTypeDeclaration(name.parent) &&
88032
+ ts.isTypeDeclaration(name.parent) &&
88017
88033
  ts.getNameOfDeclaration(name.parent) === name;
88018
88034
  }
88019
- function isTypeDeclaration(node) {
88020
- switch (node.kind) {
88021
- case 165 /* SyntaxKind.TypeParameter */:
88022
- case 260 /* SyntaxKind.ClassDeclaration */:
88023
- case 261 /* SyntaxKind.InterfaceDeclaration */:
88024
- case 262 /* SyntaxKind.TypeAliasDeclaration */:
88025
- case 263 /* SyntaxKind.EnumDeclaration */:
88026
- case 348 /* SyntaxKind.JSDocTypedefTag */:
88027
- case 341 /* SyntaxKind.JSDocCallbackTag */:
88028
- case 342 /* SyntaxKind.JSDocEnumTag */:
88029
- return true;
88030
- case 270 /* SyntaxKind.ImportClause */:
88031
- return node.isTypeOnly;
88032
- case 273 /* SyntaxKind.ImportSpecifier */:
88033
- case 278 /* SyntaxKind.ExportSpecifier */:
88034
- return node.parent.parent.isTypeOnly;
88035
- default:
88036
- return false;
88037
- }
88038
- }
88039
88035
  // True if the given identifier is part of a type reference
88040
88036
  function isTypeReferenceIdentifier(node) {
88041
88037
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88468,7 +88464,7 @@ var ts;
88468
88464
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88469
88465
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88470
88466
  }
88471
- if (isTypeDeclaration(node)) {
88467
+ if (ts.isTypeDeclaration(node)) {
88472
88468
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88473
88469
  var symbol = getSymbolOfNode(node);
88474
88470
  return getDeclaredTypeOfSymbol(symbol);
@@ -125154,7 +125150,7 @@ var ts;
125154
125150
  });
125155
125151
  // Sort by paths closest to importing file Name directory
125156
125152
  var sortedPaths = [];
125157
- var _loop_36 = function (directory) {
125153
+ var _loop_35 = function (directory) {
125158
125154
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
125159
125155
  var pathsInDirectory;
125160
125156
  allFileNames.forEach(function (_a, fileName) {
@@ -125178,9 +125174,9 @@ var ts;
125178
125174
  };
125179
125175
  var out_directory_1;
125180
125176
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125181
- var state_12 = _loop_36(directory);
125177
+ var state_11 = _loop_35(directory);
125182
125178
  directory = out_directory_1;
125183
- if (state_12 === "break")
125179
+ if (state_11 === "break")
125184
125180
  break;
125185
125181
  }
125186
125182
  if (allFileNames.size) {
@@ -125249,7 +125245,7 @@ var ts;
125249
125245
  }
125250
125246
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125251
125247
  for (var key in paths) {
125252
- var _loop_37 = function (patternText_1) {
125248
+ var _loop_36 = function (patternText_1) {
125253
125249
  var pattern = ts.normalizePath(patternText_1);
125254
125250
  var indexOfStar = pattern.indexOf("*");
125255
125251
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125316,9 +125312,9 @@ var ts;
125316
125312
  };
125317
125313
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125318
125314
  var patternText_1 = _a[_i];
125319
- var state_13 = _loop_37(patternText_1);
125320
- if (typeof state_13 === "object")
125321
- return state_13.value;
125315
+ var state_12 = _loop_36(patternText_1);
125316
+ if (typeof state_12 === "object")
125317
+ return state_12.value;
125322
125318
  }
125323
125319
  }
125324
125320
  function validateEnding(_a) {
@@ -132848,6 +132844,10 @@ var ts;
132848
132844
  return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */;
132849
132845
  }
132850
132846
  ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport;
132847
+ function isSourceFileFromLibrary(program, node) {
132848
+ return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
132849
+ }
132850
+ ts.isSourceFileFromLibrary = isSourceFileFromLibrary;
132851
132851
  // #endregion
132852
132852
  })(ts || (ts = {}));
132853
132853
  /*@internal*/
@@ -157955,6 +157955,143 @@ var ts;
157955
157955
  })(ts || (ts = {}));
157956
157956
  /* @internal */
157957
157957
  var ts;
157958
+ (function (ts) {
157959
+ var codefix;
157960
+ (function (codefix) {
157961
+ var fixId = "fixImportNonExportedMember";
157962
+ var errorCodes = [
157963
+ ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code,
157964
+ ];
157965
+ codefix.registerCodeFix({
157966
+ errorCodes: errorCodes,
157967
+ fixIds: [fixId],
157968
+ getCodeActions: function (context) {
157969
+ var sourceFile = context.sourceFile, span = context.span, program = context.program;
157970
+ var info = getInfo(sourceFile, span.start, program);
157971
+ if (info === undefined)
157972
+ return undefined;
157973
+ var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); });
157974
+ 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)];
157975
+ },
157976
+ getAllCodeActions: function (context) {
157977
+ var program = context.program;
157978
+ return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
157979
+ var exports = new ts.Map();
157980
+ codefix.eachDiagnostic(context, errorCodes, function (diag) {
157981
+ var info = getInfo(diag.file, diag.start, program);
157982
+ if (info === undefined)
157983
+ return undefined;
157984
+ var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile;
157985
+ if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) {
157986
+ changes.insertExportModifier(moduleSourceFile, node);
157987
+ }
157988
+ else {
157989
+ var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] };
157990
+ if (exportName.isTypeOnly) {
157991
+ moduleExports.typeOnlyExports.push(exportName);
157992
+ }
157993
+ else {
157994
+ moduleExports.exports.push(exportName);
157995
+ }
157996
+ exports.set(moduleSourceFile, moduleExports);
157997
+ }
157998
+ });
157999
+ exports.forEach(function (moduleExports, moduleSourceFile) {
158000
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true);
158001
+ if (exportDeclaration && exportDeclaration.isTypeOnly) {
158002
+ doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration);
158003
+ doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false));
158004
+ }
158005
+ else {
158006
+ doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration);
158007
+ }
158008
+ });
158009
+ }));
158010
+ }
158011
+ });
158012
+ function getInfo(sourceFile, pos, program) {
158013
+ var _a;
158014
+ var token = ts.getTokenAtPosition(sourceFile, pos);
158015
+ if (ts.isIdentifier(token)) {
158016
+ var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration);
158017
+ if (importDeclaration === undefined)
158018
+ return undefined;
158019
+ var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined;
158020
+ if (moduleSpecifier === undefined)
158021
+ return undefined;
158022
+ var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined);
158023
+ if (resolvedModule === undefined)
158024
+ return undefined;
158025
+ var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
158026
+ if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile))
158027
+ return undefined;
158028
+ var moduleSymbol = moduleSourceFile.symbol;
158029
+ var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals;
158030
+ if (locals === undefined)
158031
+ return undefined;
158032
+ var localSymbol = locals.get(token.escapedText);
158033
+ if (localSymbol === undefined)
158034
+ return undefined;
158035
+ var node = getNodeOfSymbol(localSymbol);
158036
+ if (node === undefined)
158037
+ return undefined;
158038
+ var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) };
158039
+ return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier };
158040
+ }
158041
+ return undefined;
158042
+ }
158043
+ function doChange(changes, program, _a) {
158044
+ var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile;
158045
+ var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
158046
+ if (exportDeclaration) {
158047
+ updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
158048
+ }
158049
+ else if (ts.canHaveExportModifier(node)) {
158050
+ changes.insertExportModifier(moduleSourceFile, node);
158051
+ }
158052
+ else {
158053
+ createExport(changes, program, moduleSourceFile, [exportName]);
158054
+ }
158055
+ }
158056
+ function doChanges(changes, program, sourceFile, moduleExports, node) {
158057
+ if (ts.length(moduleExports)) {
158058
+ if (node) {
158059
+ updateExport(changes, program, sourceFile, node, moduleExports);
158060
+ }
158061
+ else {
158062
+ createExport(changes, program, sourceFile, moduleExports);
158063
+ }
158064
+ }
158065
+ }
158066
+ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
158067
+ var predicate = function (node) {
158068
+ return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly);
158069
+ };
158070
+ return ts.findLast(sourceFile.statements, predicate);
158071
+ }
158072
+ function updateExport(changes, program, sourceFile, node, names) {
158073
+ var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]);
158074
+ var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; }));
158075
+ 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));
158076
+ }
158077
+ function createExport(changes, program, sourceFile, names) {
158078
+ changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined));
158079
+ }
158080
+ function createExportSpecifiers(names, allowTypeModifier) {
158081
+ return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); }));
158082
+ }
158083
+ function getNodeOfSymbol(symbol) {
158084
+ if (symbol.valueDeclaration === undefined) {
158085
+ return ts.firstOrUndefined(symbol.declarations);
158086
+ }
158087
+ var declaration = symbol.valueDeclaration;
158088
+ var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined;
158089
+ return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
158090
+ }
158091
+ })(codefix = ts.codefix || (ts.codefix = {}));
158092
+ })(ts || (ts = {}));
158093
+ /* @internal */
158094
+ var ts;
157958
158095
  (function (ts) {
157959
158096
  var codefix;
157960
158097
  (function (codefix) {
@@ -158485,7 +158622,7 @@ var ts;
158485
158622
  var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; });
158486
158623
  if (argIndex < 0)
158487
158624
  return undefined;
158488
- var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */));
158625
+ var signature = checker.getResolvedSignature(parent.parent);
158489
158626
  if (!(signature && signature.declaration && signature.parameters[argIndex]))
158490
158627
  return undefined;
158491
158628
  var param = signature.parameters[argIndex].valueDeclaration;
@@ -158532,13 +158669,13 @@ var ts;
158532
158669
  if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) {
158533
158670
  var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration);
158534
158671
  var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile();
158535
- if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158672
+ if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) {
158536
158673
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration };
158537
158674
  }
158538
158675
  var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile);
158539
158676
  if (sourceFile.commonJsModuleIndicator)
158540
158677
  return undefined;
158541
- if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) {
158678
+ if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) {
158542
158679
  return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile };
158543
158680
  }
158544
158681
  }
@@ -158548,7 +158685,7 @@ var ts;
158548
158685
  return undefined;
158549
158686
  // Prefer to change the class instead of the interface if they are merged
158550
158687
  var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); });
158551
- if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158688
+ if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) {
158552
158689
  var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
158553
158690
  if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration)))
158554
158691
  return undefined;
@@ -158560,14 +158697,11 @@ var ts;
158560
158697
  return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile };
158561
158698
  }
158562
158699
  var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
158563
- if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158700
+ if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
158564
158701
  return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration };
158565
158702
  }
158566
158703
  return undefined;
158567
158704
  }
158568
- function isSourceFileFromLibrary(program, node) {
158569
- return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node);
158570
- }
158571
158705
  function getActionsForMissingMemberDeclaration(context, info) {
158572
158706
  return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) :
158573
158707
  createActionsForAddMissingMemberInTypeScriptFile(context, info);
@@ -163993,8 +164127,8 @@ var ts;
163993
164127
  var i = 0;
163994
164128
  for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) {
163995
164129
  var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction;
163996
- var description = functionExtraction.description;
163997
164130
  if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
164131
+ var description = functionExtraction.description;
163998
164132
  if (functionExtraction.errors.length === 0) {
163999
164133
  // Don't issue refactorings with duplicated names.
164000
164134
  // Scopes come back in "innermost first" order, so extractions will
@@ -164018,15 +164152,15 @@ var ts;
164018
164152
  }
164019
164153
  }
164020
164154
  if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
164155
+ var description = constantExtraction.description;
164021
164156
  if (constantExtraction.errors.length === 0) {
164022
164157
  // Don't issue refactorings with duplicated names.
164023
164158
  // Scopes come back in "innermost first" order, so extractions will
164024
164159
  // preferentially go into nearer scopes
164025
- var description_1 = constantExtraction.description;
164026
- if (!usedConstantNames.has(description_1)) {
164027
- usedConstantNames.set(description_1, true);
164160
+ if (!usedConstantNames.has(description)) {
164161
+ usedConstantNames.set(description, true);
164028
164162
  constantActions.push({
164029
- description: description_1,
164163
+ description: description,
164030
164164
  name: "constant_scope_".concat(i),
164031
164165
  kind: extractConstantAction.kind
164032
164166
  });