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.
@@ -89,7 +89,7 @@ var ts;
89
89
  // The following is baselined as a literal template type without intervention
90
90
  /** The version of the TypeScript compiler release */
91
91
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
92
- ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221012");
92
+ ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221014");
93
93
  /* @internal */
94
94
  var Comparison;
95
95
  (function (Comparison) {
@@ -9900,6 +9900,8 @@ var ts;
9900
9900
  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}\""),
9901
9901
  Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
9902
9902
  Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
9903
+ Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
9904
+ Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
9903
9905
  Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
9904
9906
  Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
9905
9907
  Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
@@ -21660,6 +21662,32 @@ var ts;
21660
21662
  return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
21661
21663
  }
21662
21664
  ts.getParameterTypeNode = getParameterTypeNode;
21665
+ function isTypeDeclaration(node) {
21666
+ switch (node.kind) {
21667
+ case 165 /* SyntaxKind.TypeParameter */:
21668
+ case 260 /* SyntaxKind.ClassDeclaration */:
21669
+ case 261 /* SyntaxKind.InterfaceDeclaration */:
21670
+ case 262 /* SyntaxKind.TypeAliasDeclaration */:
21671
+ case 263 /* SyntaxKind.EnumDeclaration */:
21672
+ case 348 /* SyntaxKind.JSDocTypedefTag */:
21673
+ case 341 /* SyntaxKind.JSDocCallbackTag */:
21674
+ case 342 /* SyntaxKind.JSDocEnumTag */:
21675
+ return true;
21676
+ case 270 /* SyntaxKind.ImportClause */:
21677
+ return node.isTypeOnly;
21678
+ case 273 /* SyntaxKind.ImportSpecifier */:
21679
+ case 278 /* SyntaxKind.ExportSpecifier */:
21680
+ return node.parent.parent.isTypeOnly;
21681
+ default:
21682
+ return false;
21683
+ }
21684
+ }
21685
+ ts.isTypeDeclaration = isTypeDeclaration;
21686
+ function canHaveExportModifier(node) {
21687
+ return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
21688
+ || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
21689
+ }
21690
+ ts.canHaveExportModifier = canHaveExportModifier;
21663
21691
  })(ts || (ts = {}));
21664
21692
  /* @internal */
21665
21693
  var ts;
@@ -49062,8 +49090,6 @@ var ts;
49062
49090
  IntersectionState[IntersectionState["None"] = 0] = "None";
49063
49091
  IntersectionState[IntersectionState["Source"] = 1] = "Source";
49064
49092
  IntersectionState[IntersectionState["Target"] = 2] = "Target";
49065
- IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
49066
- IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
49067
49093
  })(IntersectionState || (IntersectionState = {}));
49068
49094
  var RecursionFlags;
49069
49095
  (function (RecursionFlags) {
@@ -55405,7 +55431,7 @@ var ts;
55405
55431
  // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
55406
55432
  var indices = ts.indicesOf(statements);
55407
55433
  var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
55408
- if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
55434
+ if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
55409
55435
  for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
55410
55436
  var index_1 = associatedIndices_1[_i];
55411
55437
  statements[index_1] = addExportModifier(statements[index_1]);
@@ -55439,15 +55465,6 @@ var ts;
55439
55465
  }
55440
55466
  return statements;
55441
55467
  }
55442
- function canHaveExportModifier(node) {
55443
- return ts.isEnumDeclaration(node) ||
55444
- ts.isVariableStatement(node) ||
55445
- ts.isFunctionDeclaration(node) ||
55446
- ts.isClassDeclaration(node) ||
55447
- (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
55448
- ts.isInterfaceDeclaration(node) ||
55449
- isTypeDeclaration(node);
55450
- }
55451
55468
  function addExportModifier(node) {
55452
55469
  var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
55453
55470
  return ts.factory.updateModifiers(node, flags);
@@ -55694,7 +55711,7 @@ var ts;
55694
55711
  (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
55695
55712
  if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
55696
55713
  enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
55697
- canHaveExportModifier(node)) {
55714
+ ts.canHaveExportModifier(node)) {
55698
55715
  // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
55699
55716
  newModifierFlags |= 1 /* ModifierFlags.Export */;
55700
55717
  }
@@ -63821,18 +63838,23 @@ var ts;
63821
63838
  var result;
63822
63839
  var extraTypes;
63823
63840
  var tailCount = 0;
63824
- var _loop_20 = function () {
63841
+ // We loop here for an immediately nested conditional type in the false position, effectively treating
63842
+ // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63843
+ // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63844
+ // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63845
+ // cases we increment the tail recursion counter and stop after 1000 iterations.
63846
+ while (true) {
63825
63847
  if (tailCount === 1000) {
63826
63848
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63827
63849
  result = errorType;
63828
- return "break";
63850
+ break;
63829
63851
  }
63830
63852
  var isUnwrapped = isTypicalNondistributiveConditional(root);
63831
63853
  var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
63832
63854
  var checkTypeInstantiable = isGenericType(checkType);
63833
63855
  var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
63834
63856
  if (checkType === wildcardType || extendsType === wildcardType) {
63835
- return { value: wildcardType };
63857
+ return wildcardType;
63836
63858
  }
63837
63859
  var combinedMapper = void 0;
63838
63860
  if (root.inferTypeParameters) {
@@ -63865,11 +63887,7 @@ var ts;
63865
63887
  }
63866
63888
  }
63867
63889
  }
63868
- // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
63869
- // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
63870
- // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
63871
- // so in those cases we refain from performing inference and retain the uninfered type parameter
63872
- if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
63890
+ if (!checkTypeInstantiable) {
63873
63891
  // We don't want inferences from constraints as they may cause us to eagerly resolve the
63874
63892
  // conditional type instead of deferring resolution. Also, we always want strict function
63875
63893
  // types rules (i.e. proper contravariance) for inferences.
@@ -63901,14 +63919,14 @@ var ts;
63901
63919
  var newRoot = falseType_1.root;
63902
63920
  if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
63903
63921
  root = newRoot;
63904
- return "continue";
63922
+ continue;
63905
63923
  }
63906
63924
  if (canTailRecurse(falseType_1, mapper)) {
63907
- return "continue";
63925
+ continue;
63908
63926
  }
63909
63927
  }
63910
63928
  result = instantiateType(falseType_1, mapper);
63911
- return "break";
63929
+ break;
63912
63930
  }
63913
63931
  // Return trueType for a definitely true extends check. We check instantiations of the two
63914
63932
  // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -63919,10 +63937,10 @@ var ts;
63919
63937
  var trueType_1 = getTypeFromTypeNode(root.node.trueType);
63920
63938
  var trueMapper = combinedMapper || mapper;
63921
63939
  if (canTailRecurse(trueType_1, trueMapper)) {
63922
- return "continue";
63940
+ continue;
63923
63941
  }
63924
63942
  result = instantiateType(trueType_1, trueMapper);
63925
- return "break";
63943
+ break;
63926
63944
  }
63927
63945
  }
63928
63946
  // Return a deferred type for a check that is neither definitely true nor definitely false
@@ -63934,19 +63952,7 @@ var ts;
63934
63952
  result.combinedMapper = combinedMapper;
63935
63953
  result.aliasSymbol = aliasSymbol || root.aliasSymbol;
63936
63954
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
63937
- return "break";
63938
- };
63939
- // We loop here for an immediately nested conditional type in the false position, effectively treating
63940
- // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
63941
- // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
63942
- // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
63943
- // cases we increment the tail recursion counter and stop after 1000 iterations.
63944
- while (true) {
63945
- var state_6 = _loop_20();
63946
- if (typeof state_6 === "object")
63947
- return state_6.value;
63948
- if (state_6 === "break")
63949
- break;
63955
+ break;
63950
63956
  }
63951
63957
  return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
63952
63958
  // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
@@ -66400,7 +66406,7 @@ var ts;
66400
66406
  return 0 /* Ternary.False */;
66401
66407
  }
66402
66408
  }
66403
- var isPerformingCommonPropertyChecks = (relation !== comparableRelation || !(source.flags & 1048576 /* TypeFlags.Union */) && isLiteralType(source)) &&
66409
+ var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
66404
66410
  !(intersectionState & 2 /* IntersectionState.Target */) &&
66405
66411
  source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
66406
66412
  target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
@@ -66428,27 +66434,6 @@ var ts;
66428
66434
  var result_7 = skipCaching ?
66429
66435
  unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
66430
66436
  recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
66431
- // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66432
- // an extra property check where the intersection is viewed as a single object. The following are motivating
66433
- // examples that all should be errors, but aren't without this extra property check:
66434
- //
66435
- // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66436
- //
66437
- // declare let wrong: { a: { y: string } };
66438
- // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66439
- //
66440
- // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66441
- // x = y; // Mismatched property in source intersection
66442
- // }
66443
- //
66444
- // We suppress recursive intersection property checks because they can generate lots of work when relating
66445
- // recursive intersections that are structurally similar but not exactly identical. See #37854.
66446
- if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
66447
- 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 */); }))) {
66448
- inPropertyCheck = true;
66449
- result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
66450
- inPropertyCheck = false;
66451
- }
66452
66437
  if (result_7) {
66453
66438
  return result_7;
66454
66439
  }
@@ -66560,7 +66545,7 @@ var ts;
66560
66545
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
66561
66546
  checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
66562
66547
  }
66563
- var _loop_21 = function (prop) {
66548
+ var _loop_20 = function (prop) {
66564
66549
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
66565
66550
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
66566
66551
  if (reportErrors) {
@@ -66623,9 +66608,9 @@ var ts;
66623
66608
  };
66624
66609
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
66625
66610
  var prop = _b[_i];
66626
- var state_7 = _loop_21(prop);
66627
- if (typeof state_7 === "object")
66628
- return state_7.value;
66611
+ var state_6 = _loop_20(prop);
66612
+ if (typeof state_6 === "object")
66613
+ return state_6.value;
66629
66614
  }
66630
66615
  return false;
66631
66616
  }
@@ -66846,8 +66831,7 @@ var ts;
66846
66831
  if (overflow) {
66847
66832
  return 0 /* Ternary.False */;
66848
66833
  }
66849
- var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0);
66850
- var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
66834
+ var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
66851
66835
  var entry = relation.get(id);
66852
66836
  if (entry !== undefined) {
66853
66837
  if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
@@ -66877,7 +66861,7 @@ var ts;
66877
66861
  // A key that starts with "*" is an indication that we have type references that reference constrained
66878
66862
  // type parameters. For such keys we also check against the key we would have gotten if all type parameters
66879
66863
  // were unconstrained.
66880
- var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66864
+ var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
66881
66865
  for (var i = 0; i < maybeCount; i++) {
66882
66866
  // If source and target are already being compared, consider them related with assumptions
66883
66867
  if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
@@ -66964,7 +66948,7 @@ var ts;
66964
66948
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
66965
66949
  var saveErrorInfo = captureErrorCalculationState();
66966
66950
  var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
66967
- if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66951
+ if (relation !== identityRelation) {
66968
66952
  // The combined constraint of an intersection type is the intersection of the constraints of
66969
66953
  // the constituents. When an intersection type contains instantiable types with union type
66970
66954
  // constraints, there are situations where we need to examine the combined constraint. One is
@@ -66978,10 +66962,33 @@ var ts;
66978
66962
  // needs to have its constraint hoisted into an intersection with said type parameter, this way
66979
66963
  // the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
66980
66964
  // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
66981
- var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66982
- if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66983
- // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66984
- result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66965
+ if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
66966
+ var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
66967
+ if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
66968
+ // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
66969
+ result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
66970
+ }
66971
+ }
66972
+ // For certain combinations involving intersections and optional, excess, or mismatched properties we need
66973
+ // an extra property check where the intersection is viewed as a single object. The following are motivating
66974
+ // examples that all should be errors, but aren't without this extra property check:
66975
+ //
66976
+ // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
66977
+ //
66978
+ // declare let wrong: { a: { y: string } };
66979
+ // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
66980
+ //
66981
+ // function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
66982
+ // x = y; // Mismatched property in source intersection
66983
+ // }
66984
+ //
66985
+ // We suppress recursive intersection property checks because they can generate lots of work when relating
66986
+ // recursive intersections that are structurally similar but not exactly identical. See #37854.
66987
+ if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
66988
+ 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 */); }))) {
66989
+ inPropertyCheck = true;
66990
+ result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
66991
+ inPropertyCheck = false;
66985
66992
  }
66986
66993
  }
66987
66994
  if (result) {
@@ -66990,9 +66997,6 @@ var ts;
66990
66997
  return result;
66991
66998
  }
66992
66999
  function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
66993
- if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
66994
- return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
66995
- }
66996
67000
  var result;
66997
67001
  var originalErrorInfo;
66998
67002
  var varianceCheckFailed = false;
@@ -67616,11 +67620,11 @@ var ts;
67616
67620
  // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
67617
67621
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
67618
67622
  var matchingTypes = [];
67619
- var _loop_22 = function (combination) {
67623
+ var _loop_21 = function (combination) {
67620
67624
  var hasMatch = false;
67621
67625
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
67622
67626
  var type = _d[_c];
67623
- var _loop_23 = function (i) {
67627
+ var _loop_22 = function (i) {
67624
67628
  var sourceProperty = sourcePropertiesFiltered[i];
67625
67629
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
67626
67630
  if (!targetProperty)
@@ -67636,8 +67640,8 @@ var ts;
67636
67640
  }
67637
67641
  };
67638
67642
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
67639
- var state_9 = _loop_23(i);
67640
- switch (state_9) {
67643
+ var state_8 = _loop_22(i);
67644
+ switch (state_8) {
67641
67645
  case "continue-outer": continue outer;
67642
67646
  }
67643
67647
  }
@@ -67650,9 +67654,9 @@ var ts;
67650
67654
  };
67651
67655
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
67652
67656
  var combination = discriminantCombinations_1[_a];
67653
- var state_8 = _loop_22(combination);
67654
- if (typeof state_8 === "object")
67655
- return state_8.value;
67657
+ var state_7 = _loop_21(combination);
67658
+ if (typeof state_7 === "object")
67659
+ return state_7.value;
67656
67660
  }
67657
67661
  // Compare the remaining non-discriminant properties of each match.
67658
67662
  var result = -1 /* Ternary.True */;
@@ -68357,7 +68361,7 @@ var ts;
68357
68361
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
68358
68362
  links.variances = ts.emptyArray;
68359
68363
  var variances = [];
68360
- var _loop_24 = function (tp) {
68364
+ var _loop_23 = function (tp) {
68361
68365
  var modifiers = getVarianceModifiers(tp);
68362
68366
  var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
68363
68367
  modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
@@ -68395,7 +68399,7 @@ var ts;
68395
68399
  };
68396
68400
  for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
68397
68401
  var tp = typeParameters_2[_i];
68398
- _loop_24(tp);
68402
+ _loop_23(tp);
68399
68403
  }
68400
68404
  links.variances = variances;
68401
68405
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
@@ -70353,7 +70357,7 @@ var ts;
70353
70357
  // upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
70354
70358
  // succeed. That would be a pointless and confusing outcome.
70355
70359
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
70356
- var _loop_25 = function (i) {
70360
+ var _loop_24 = function (i) {
70357
70361
  var source_1 = matches ? matches[i] : neverType;
70358
70362
  var target_3 = types[i];
70359
70363
  // If we are inferring from a string literal type to a type variable whose constraint includes one of the
@@ -70403,7 +70407,7 @@ var ts;
70403
70407
  inferFromTypes(source_1, target_3);
70404
70408
  };
70405
70409
  for (var i = 0; i < types.length; i++) {
70406
- _loop_25(i);
70410
+ _loop_24(i);
70407
70411
  }
70408
70412
  }
70409
70413
  }
@@ -70932,7 +70936,7 @@ var ts;
70932
70936
  function mapTypesByKeyProperty(types, name) {
70933
70937
  var map = new ts.Map();
70934
70938
  var count = 0;
70935
- var _loop_26 = function (type) {
70939
+ var _loop_25 = function (type) {
70936
70940
  if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
70937
70941
  var discriminant = getTypeOfPropertyOfType(type, name);
70938
70942
  if (discriminant) {
@@ -70958,9 +70962,9 @@ var ts;
70958
70962
  };
70959
70963
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
70960
70964
  var type = types_15[_i];
70961
- var state_10 = _loop_26(type);
70962
- if (typeof state_10 === "object")
70963
- return state_10.value;
70965
+ var state_9 = _loop_25(type);
70966
+ if (typeof state_9 === "object")
70967
+ return state_9.value;
70964
70968
  }
70965
70969
  return count >= 10 && count * 2 >= types.length ? map : undefined;
70966
70970
  }
@@ -77416,7 +77420,7 @@ var ts;
77416
77420
  if (spreadIndex >= 0) {
77417
77421
  // Create synthetic arguments from spreads of tuple types.
77418
77422
  var effectiveArgs_1 = args.slice(0, spreadIndex);
77419
- var _loop_27 = function (i) {
77423
+ var _loop_26 = function (i) {
77420
77424
  var arg = args[i];
77421
77425
  // We can call checkExpressionCached because spread expressions never have a contextual type.
77422
77426
  var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
@@ -77433,7 +77437,7 @@ var ts;
77433
77437
  }
77434
77438
  };
77435
77439
  for (var i = spreadIndex; i < args.length; i++) {
77436
- _loop_27(i);
77440
+ _loop_26(i);
77437
77441
  }
77438
77442
  return effectiveArgs_1;
77439
77443
  }
@@ -77762,7 +77766,7 @@ var ts;
77762
77766
  var min_3 = Number.MAX_VALUE;
77763
77767
  var minIndex = 0;
77764
77768
  var i_1 = 0;
77765
- var _loop_28 = function (c) {
77769
+ var _loop_27 = function (c) {
77766
77770
  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)); };
77767
77771
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
77768
77772
  if (diags_2) {
@@ -77780,7 +77784,7 @@ var ts;
77780
77784
  };
77781
77785
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
77782
77786
  var c = candidatesForArgumentError_1[_a];
77783
- _loop_28(c);
77787
+ _loop_27(c);
77784
77788
  }
77785
77789
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
77786
77790
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -77938,7 +77942,7 @@ var ts;
77938
77942
  }
77939
77943
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
77940
77944
  var parameters = [];
77941
- var _loop_29 = function (i) {
77945
+ var _loop_28 = function (i) {
77942
77946
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
77943
77947
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
77944
77948
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -77946,7 +77950,7 @@ var ts;
77946
77950
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
77947
77951
  };
77948
77952
  for (var i = 0; i < maxNonRestParam; i++) {
77949
- _loop_29(i);
77953
+ _loop_28(i);
77950
77954
  }
77951
77955
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
77952
77956
  var flags = 0 /* SignatureFlags.None */;
@@ -79578,7 +79582,17 @@ var ts;
79578
79582
  }
79579
79583
  function isExhaustiveSwitchStatement(node) {
79580
79584
  var links = getNodeLinks(node);
79581
- return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node));
79585
+ if (links.isExhaustive === undefined) {
79586
+ links.isExhaustive = 0; // Indicate resolution is in process
79587
+ var exhaustive = computeExhaustiveSwitchStatement(node);
79588
+ if (links.isExhaustive === 0) {
79589
+ links.isExhaustive = exhaustive;
79590
+ }
79591
+ }
79592
+ else if (links.isExhaustive === 0) {
79593
+ links.isExhaustive = false; // Resolve circularity to false
79594
+ }
79595
+ return links.isExhaustive;
79582
79596
  }
79583
79597
  function computeExhaustiveSwitchStatement(node) {
79584
79598
  if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) {
@@ -79586,7 +79600,7 @@ var ts;
79586
79600
  if (!witnesses) {
79587
79601
  return false;
79588
79602
  }
79589
- var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression));
79603
+ var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
79590
79604
  // Get the not-equal flags for all handled cases.
79591
79605
  var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
79592
79606
  if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) {
@@ -79596,7 +79610,7 @@ var ts;
79596
79610
  // A missing not-equal flag indicates that the type wasn't handled by some case.
79597
79611
  return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; });
79598
79612
  }
79599
- var type = getTypeOfExpression(node.expression);
79613
+ var type = checkExpressionCached(node.expression);
79600
79614
  if (!isLiteralType(type)) {
79601
79615
  return false;
79602
79616
  }
@@ -81994,7 +82008,7 @@ var ts;
81994
82008
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
81995
82009
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
81996
82010
  var indexSignatureMap_1 = new ts.Map();
81997
- var _loop_30 = function (declaration) {
82011
+ var _loop_29 = function (declaration) {
81998
82012
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
81999
82013
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
82000
82014
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -82009,7 +82023,7 @@ var ts;
82009
82023
  };
82010
82024
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
82011
82025
  var declaration = _a[_i];
82012
- _loop_30(declaration);
82026
+ _loop_29(declaration);
82013
82027
  }
82014
82028
  indexSignatureMap_1.forEach(function (entry) {
82015
82029
  if (entry.declarations.length > 1) {
@@ -82286,7 +82300,7 @@ var ts;
82286
82300
  }
82287
82301
  var symbol = getNodeLinks(node).resolvedSymbol;
82288
82302
  if (symbol) {
82289
- if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82303
+ if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
82290
82304
  addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
82291
82305
  }
82292
82306
  if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
@@ -83664,7 +83678,7 @@ var ts;
83664
83678
  }
83665
83679
  function errorUnusedLocal(declaration, name, addDiagnostic) {
83666
83680
  var node = ts.getNameOfDeclaration(declaration) || declaration;
83667
- var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83681
+ var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
83668
83682
  addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
83669
83683
  }
83670
83684
  function isIdentifierThatStartsWithUnderscore(node) {
@@ -85618,7 +85632,7 @@ var ts;
85618
85632
  var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
85619
85633
  name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
85620
85634
  var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
85621
- var _loop_31 = function (info) {
85635
+ var _loop_30 = function (info) {
85622
85636
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
85623
85637
  // We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
85624
85638
  // in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
@@ -85635,7 +85649,7 @@ var ts;
85635
85649
  };
85636
85650
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
85637
85651
  var info = indexInfos_9[_i];
85638
- _loop_31(info);
85652
+ _loop_30(info);
85639
85653
  }
85640
85654
  }
85641
85655
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -85643,7 +85657,7 @@ var ts;
85643
85657
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
85644
85658
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
85645
85659
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
85646
- var _loop_32 = function (info) {
85660
+ var _loop_31 = function (info) {
85647
85661
  if (info === checkInfo)
85648
85662
  return "continue";
85649
85663
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -85658,7 +85672,7 @@ var ts;
85658
85672
  };
85659
85673
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
85660
85674
  var info = indexInfos_10[_i];
85661
- _loop_32(info);
85675
+ _loop_31(info);
85662
85676
  }
85663
85677
  }
85664
85678
  function checkTypeNameIsReserved(name, message) {
@@ -85713,7 +85727,7 @@ var ts;
85713
85727
  }
85714
85728
  else {
85715
85729
  ts.forEach(jsdocParameters, function (_a, index) {
85716
- var name = _a.name;
85730
+ var name = _a.name, isNameFirst = _a.isNameFirst;
85717
85731
  if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
85718
85732
  return;
85719
85733
  }
@@ -85723,7 +85737,9 @@ var ts;
85723
85737
  }
85724
85738
  }
85725
85739
  else {
85726
- errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85740
+ if (!isNameFirst) {
85741
+ errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
85742
+ }
85727
85743
  }
85728
85744
  });
85729
85745
  }
@@ -85978,7 +85994,7 @@ var ts;
85978
85994
  var baseTypes = baseTypeNode && getBaseTypes(type);
85979
85995
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
85980
85996
  var baseStaticType = getBaseConstructorTypeOfClass(type);
85981
- var _loop_33 = function (member) {
85997
+ var _loop_32 = function (member) {
85982
85998
  if (ts.hasAmbientModifier(member)) {
85983
85999
  return "continue";
85984
86000
  }
@@ -85995,7 +86011,7 @@ var ts;
85995
86011
  };
85996
86012
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
85997
86013
  var member = _a[_i];
85998
- _loop_33(member);
86014
+ _loop_32(member);
85999
86015
  }
86000
86016
  }
86001
86017
  /**
@@ -86083,7 +86099,7 @@ var ts;
86083
86099
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
86084
86100
  // iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
86085
86101
  var issuedMemberError = false;
86086
- var _loop_34 = function (member) {
86102
+ var _loop_33 = function (member) {
86087
86103
  if (ts.isStatic(member)) {
86088
86104
  return "continue";
86089
86105
  }
@@ -86102,7 +86118,7 @@ var ts;
86102
86118
  };
86103
86119
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
86104
86120
  var member = _a[_i];
86105
- _loop_34(member);
86121
+ _loop_33(member);
86106
86122
  }
86107
86123
  if (!issuedMemberError) {
86108
86124
  // check again with diagnostics to generate a less-specific error
@@ -86173,7 +86189,7 @@ var ts;
86173
86189
  var _a, _b, _c, _d;
86174
86190
  // NOTE: assignability is checked in checkClassDeclaration
86175
86191
  var baseProperties = getPropertiesOfType(baseType);
86176
- var _loop_35 = function (baseProperty) {
86192
+ var _loop_34 = function (baseProperty) {
86177
86193
  var base = getTargetSymbol(baseProperty);
86178
86194
  if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
86179
86195
  return "continue";
@@ -86283,8 +86299,8 @@ var ts;
86283
86299
  };
86284
86300
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
86285
86301
  var baseProperty = baseProperties_1[_i];
86286
- var state_11 = _loop_35(baseProperty);
86287
- switch (state_11) {
86302
+ var state_10 = _loop_34(baseProperty);
86303
+ switch (state_10) {
86288
86304
  case "continue-basePropertyCheck": continue basePropertyCheck;
86289
86305
  }
86290
86306
  }
@@ -87994,29 +88010,9 @@ var ts;
87994
88010
  }
87995
88011
  function isTypeDeclarationName(name) {
87996
88012
  return name.kind === 79 /* SyntaxKind.Identifier */ &&
87997
- isTypeDeclaration(name.parent) &&
88013
+ ts.isTypeDeclaration(name.parent) &&
87998
88014
  ts.getNameOfDeclaration(name.parent) === name;
87999
88015
  }
88000
- function isTypeDeclaration(node) {
88001
- switch (node.kind) {
88002
- case 165 /* SyntaxKind.TypeParameter */:
88003
- case 260 /* SyntaxKind.ClassDeclaration */:
88004
- case 261 /* SyntaxKind.InterfaceDeclaration */:
88005
- case 262 /* SyntaxKind.TypeAliasDeclaration */:
88006
- case 263 /* SyntaxKind.EnumDeclaration */:
88007
- case 348 /* SyntaxKind.JSDocTypedefTag */:
88008
- case 341 /* SyntaxKind.JSDocCallbackTag */:
88009
- case 342 /* SyntaxKind.JSDocEnumTag */:
88010
- return true;
88011
- case 270 /* SyntaxKind.ImportClause */:
88012
- return node.isTypeOnly;
88013
- case 273 /* SyntaxKind.ImportSpecifier */:
88014
- case 278 /* SyntaxKind.ExportSpecifier */:
88015
- return node.parent.parent.isTypeOnly;
88016
- default:
88017
- return false;
88018
- }
88019
- }
88020
88016
  // True if the given identifier is part of a type reference
88021
88017
  function isTypeReferenceIdentifier(node) {
88022
88018
  while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
@@ -88449,7 +88445,7 @@ var ts;
88449
88445
  var baseType = ts.firstOrUndefined(getBaseTypes(classType));
88450
88446
  return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
88451
88447
  }
88452
- if (isTypeDeclaration(node)) {
88448
+ if (ts.isTypeDeclaration(node)) {
88453
88449
  // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
88454
88450
  var symbol = getSymbolOfNode(node);
88455
88451
  return getDeclaredTypeOfSymbol(symbol);
@@ -125135,7 +125131,7 @@ var ts;
125135
125131
  });
125136
125132
  // Sort by paths closest to importing file Name directory
125137
125133
  var sortedPaths = [];
125138
- var _loop_36 = function (directory) {
125134
+ var _loop_35 = function (directory) {
125139
125135
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
125140
125136
  var pathsInDirectory;
125141
125137
  allFileNames.forEach(function (_a, fileName) {
@@ -125159,9 +125155,9 @@ var ts;
125159
125155
  };
125160
125156
  var out_directory_1;
125161
125157
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
125162
- var state_12 = _loop_36(directory);
125158
+ var state_11 = _loop_35(directory);
125163
125159
  directory = out_directory_1;
125164
- if (state_12 === "break")
125160
+ if (state_11 === "break")
125165
125161
  break;
125166
125162
  }
125167
125163
  if (allFileNames.size) {
@@ -125230,7 +125226,7 @@ var ts;
125230
125226
  }
125231
125227
  function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
125232
125228
  for (var key in paths) {
125233
- var _loop_37 = function (patternText_1) {
125229
+ var _loop_36 = function (patternText_1) {
125234
125230
  var pattern = ts.normalizePath(patternText_1);
125235
125231
  var indexOfStar = pattern.indexOf("*");
125236
125232
  // In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
@@ -125297,9 +125293,9 @@ var ts;
125297
125293
  };
125298
125294
  for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
125299
125295
  var patternText_1 = _a[_i];
125300
- var state_13 = _loop_37(patternText_1);
125301
- if (typeof state_13 === "object")
125302
- return state_13.value;
125296
+ var state_12 = _loop_36(patternText_1);
125297
+ if (typeof state_12 === "object")
125298
+ return state_12.value;
125303
125299
  }
125304
125300
  }
125305
125301
  function validateEnding(_a) {