@typescript-deploys/pr-build 5.5.0-pr-57989-9 → 5.5.0-pr-57996-3

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.
Files changed (3) hide show
  1. package/lib/tsc.js +182 -175
  2. package/lib/typescript.js +223 -213
  3. package/package.json +2 -2
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240328`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240329`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -49851,7 +49851,7 @@ function createTypeChecker(host) {
49851
49851
  return initial;
49852
49852
  }
49853
49853
  function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
49854
- return symbol.declarations && find(symbol.declarations, (s) => !!getEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
49854
+ return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
49855
49855
  }
49856
49856
  function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
49857
49857
  return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
@@ -49867,7 +49867,7 @@ function createTypeChecker(host) {
49867
49867
  if (!isErrorType(type) && enclosingDeclaration) {
49868
49868
  const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
49869
49869
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
49870
- const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
49870
+ const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
49871
49871
  const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
49872
49872
  if (result2) {
49873
49873
  return result2;
@@ -49912,7 +49912,7 @@ function createTypeChecker(host) {
49912
49912
  const typePredicate = getTypePredicateOfSignature(signature);
49913
49913
  const type = getReturnTypeOfSignature(signature);
49914
49914
  if (!isErrorType(type) && context.enclosingDeclaration) {
49915
- const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
49915
+ const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
49916
49916
  const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
49917
49917
  if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
49918
49918
  const annotated = getTypeFromTypeNode(annotation);
@@ -60965,7 +60965,6 @@ function createTypeChecker(host) {
60965
60965
  const result = isRelatedTo(
60966
60966
  source,
60967
60967
  target,
60968
- 0 /* None */,
60969
60968
  3 /* Both */,
60970
60969
  /*reportErrors*/
60971
60970
  !!errorNode,
@@ -61249,7 +61248,10 @@ function createTypeChecker(host) {
61249
61248
  }
61250
61249
  return true;
61251
61250
  }
61252
- function isRelatedTo(originalSource, originalTarget, intersectionState, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2) {
61251
+ function isRelatedToWorker(source2, target2, reportErrors2) {
61252
+ return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
61253
+ }
61254
+ function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
61253
61255
  if (originalSource === originalTarget)
61254
61256
  return -1 /* True */;
61255
61257
  if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 402784252 /* Primitive */) {
@@ -61309,7 +61311,7 @@ function createTypeChecker(host) {
61309
61311
  if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
61310
61312
  const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
61311
61313
  if (isPerformingExcessPropertyChecks) {
61312
- if (hasExcessProperties(source2, target2, reportErrors2, intersectionState)) {
61314
+ if (hasExcessProperties(source2, target2, reportErrors2)) {
61313
61315
  if (reportErrors2) {
61314
61316
  reportRelationError(headMessage2, source2, originalTarget.aliasSymbol ? originalTarget : target2);
61315
61317
  }
@@ -61327,14 +61329,12 @@ function createTypeChecker(host) {
61327
61329
  if (calls.length > 0 && isRelatedTo(
61328
61330
  getReturnTypeOfSignature(calls[0]),
61329
61331
  target2,
61330
- intersectionState,
61331
61332
  1 /* Source */,
61332
61333
  /*reportErrors*/
61333
61334
  false
61334
61335
  ) || constructs.length > 0 && isRelatedTo(
61335
61336
  getReturnTypeOfSignature(constructs[0]),
61336
61337
  target2,
61337
- intersectionState,
61338
61338
  1 /* Source */,
61339
61339
  /*reportErrors*/
61340
61340
  false
@@ -61447,7 +61447,7 @@ function createTypeChecker(host) {
61447
61447
  void 0
61448
61448
  ) || emptyArray);
61449
61449
  }
61450
- function hasExcessProperties(source2, target2, reportErrors2, intersectionState) {
61450
+ function hasExcessProperties(source2, target2, reportErrors2) {
61451
61451
  var _a2;
61452
61452
  if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) {
61453
61453
  return false;
@@ -61459,11 +61459,7 @@ function createTypeChecker(host) {
61459
61459
  let reducedTarget = target2;
61460
61460
  let checkTypes;
61461
61461
  if (target2.flags & 1048576 /* Union */) {
61462
- let isRelatedToWorker2 = function(source3, target3) {
61463
- return isRelatedTo(source3, target3, intersectionState);
61464
- };
61465
- var isRelatedToWorker = isRelatedToWorker2;
61466
- reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedToWorker2) || filterPrimitivesIfContainsNonPrimitive(target2);
61462
+ reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target2);
61467
61463
  checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
61468
61464
  }
61469
61465
  for (const prop of getPropertiesOfType(source2)) {
@@ -61506,7 +61502,7 @@ function createTypeChecker(host) {
61506
61502
  }
61507
61503
  return true;
61508
61504
  }
61509
- if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), intersectionState, 3 /* Both */, reportErrors2)) {
61505
+ if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), 3 /* Both */, reportErrors2)) {
61510
61506
  if (reportErrors2) {
61511
61507
  reportIncompatibleError(Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop));
61512
61508
  }
@@ -61550,14 +61546,12 @@ function createTypeChecker(host) {
61550
61546
  return isRelatedTo(
61551
61547
  source2,
61552
61548
  target2,
61553
- intersectionState,
61554
61549
  1 /* Source */,
61555
61550
  /*reportErrors*/
61556
61551
  false
61557
61552
  ) || isRelatedTo(
61558
61553
  target2,
61559
61554
  source2,
61560
- intersectionState,
61561
61555
  1 /* Source */,
61562
61556
  /*reportErrors*/
61563
61557
  false
@@ -61573,7 +61567,7 @@ function createTypeChecker(host) {
61573
61567
  1 /* Source */
61574
61568
  );
61575
61569
  }
61576
- function eachTypeRelatedToSomeType(source2, target2, intersectionState) {
61570
+ function eachTypeRelatedToSomeType(source2, target2) {
61577
61571
  let result2 = -1 /* True */;
61578
61572
  const sourceTypes = source2.types;
61579
61573
  for (const sourceType of sourceTypes) {
@@ -61582,7 +61576,7 @@ function createTypeChecker(host) {
61582
61576
  target2,
61583
61577
  /*reportErrors*/
61584
61578
  false,
61585
- intersectionState
61579
+ 0 /* None */
61586
61580
  );
61587
61581
  if (!related) {
61588
61582
  return 0 /* False */;
@@ -61607,12 +61601,12 @@ function createTypeChecker(host) {
61607
61601
  const related = isRelatedTo(
61608
61602
  source2,
61609
61603
  match,
61610
- intersectionState,
61611
61604
  2 /* Target */,
61612
61605
  /*reportErrors*/
61613
61606
  false,
61614
61607
  /*headMessage*/
61615
- void 0
61608
+ void 0,
61609
+ intersectionState
61616
61610
  );
61617
61611
  if (related) {
61618
61612
  return related;
@@ -61623,31 +61617,29 @@ function createTypeChecker(host) {
61623
61617
  const related = isRelatedTo(
61624
61618
  source2,
61625
61619
  type,
61626
- intersectionState,
61627
61620
  2 /* Target */,
61628
61621
  /*reportErrors*/
61629
61622
  false,
61630
61623
  /*headMessage*/
61631
- void 0
61624
+ void 0,
61625
+ intersectionState
61632
61626
  );
61633
61627
  if (related) {
61634
61628
  return related;
61635
61629
  }
61636
61630
  }
61637
61631
  if (reportErrors2) {
61638
- let isRelatedToWorker2 = function(source3, target3) {
61639
- return isRelatedTo(source3, target3, intersectionState);
61640
- };
61641
- var isRelatedToWorker = isRelatedToWorker2;
61642
- const bestMatchingType = getBestMatchingType(source2, target2, isRelatedToWorker2);
61632
+ const bestMatchingType = getBestMatchingType(source2, target2, isRelatedTo);
61643
61633
  if (bestMatchingType) {
61644
61634
  isRelatedTo(
61645
61635
  source2,
61646
61636
  bestMatchingType,
61647
- intersectionState,
61648
61637
  2 /* Target */,
61649
61638
  /*reportErrors*/
61650
- true
61639
+ true,
61640
+ /*headMessage*/
61641
+ void 0,
61642
+ intersectionState
61651
61643
  );
61652
61644
  }
61653
61645
  }
@@ -61660,11 +61652,11 @@ function createTypeChecker(host) {
61660
61652
  const related = isRelatedTo(
61661
61653
  source2,
61662
61654
  targetType,
61663
- intersectionState,
61664
61655
  2 /* Target */,
61665
61656
  reportErrors2,
61666
61657
  /*headMessage*/
61667
- void 0
61658
+ void 0,
61659
+ intersectionState
61668
61660
  );
61669
61661
  if (!related) {
61670
61662
  return 0 /* False */;
@@ -61683,11 +61675,11 @@ function createTypeChecker(host) {
61683
61675
  const related = isRelatedTo(
61684
61676
  sourceTypes[i],
61685
61677
  target2,
61686
- intersectionState,
61687
61678
  1 /* Source */,
61688
61679
  reportErrors2 && i === len - 1,
61689
61680
  /*headMessage*/
61690
- void 0
61681
+ void 0,
61682
+ intersectionState
61691
61683
  );
61692
61684
  if (related) {
61693
61685
  return related;
@@ -61711,12 +61703,12 @@ function createTypeChecker(host) {
61711
61703
  const related2 = isRelatedTo(
61712
61704
  sourceType,
61713
61705
  undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length],
61714
- intersectionState,
61715
61706
  3 /* Both */,
61716
61707
  /*reportErrors*/
61717
61708
  false,
61718
61709
  /*headMessage*/
61719
- void 0
61710
+ void 0,
61711
+ intersectionState
61720
61712
  );
61721
61713
  if (related2) {
61722
61714
  result2 &= related2;
@@ -61726,11 +61718,11 @@ function createTypeChecker(host) {
61726
61718
  const related = isRelatedTo(
61727
61719
  sourceType,
61728
61720
  target2,
61729
- intersectionState,
61730
61721
  1 /* Source */,
61731
61722
  reportErrors2,
61732
61723
  /*headMessage*/
61733
- void 0
61724
+ void 0,
61725
+ intersectionState
61734
61726
  );
61735
61727
  if (!related) {
61736
61728
  return 0 /* False */;
@@ -61756,7 +61748,6 @@ function createTypeChecker(host) {
61756
61748
  related = relation === identityRelation ? isRelatedTo(
61757
61749
  s,
61758
61750
  t,
61759
- intersectionState,
61760
61751
  3 /* Both */,
61761
61752
  /*reportErrors*/
61762
61753
  false
@@ -61765,27 +61756,26 @@ function createTypeChecker(host) {
61765
61756
  related = isRelatedTo(
61766
61757
  s,
61767
61758
  t,
61768
- intersectionState,
61769
61759
  3 /* Both */,
61770
61760
  reportErrors2,
61771
61761
  /*headMessage*/
61772
- void 0
61762
+ void 0,
61763
+ intersectionState
61773
61764
  );
61774
61765
  } else if (variance === 2 /* Contravariant */) {
61775
61766
  related = isRelatedTo(
61776
61767
  t,
61777
61768
  s,
61778
- intersectionState,
61779
61769
  3 /* Both */,
61780
61770
  reportErrors2,
61781
61771
  /*headMessage*/
61782
- void 0
61772
+ void 0,
61773
+ intersectionState
61783
61774
  );
61784
61775
  } else if (variance === 3 /* Bivariant */) {
61785
61776
  related = isRelatedTo(
61786
61777
  t,
61787
61778
  s,
61788
- intersectionState,
61789
61779
  3 /* Both */,
61790
61780
  /*reportErrors*/
61791
61781
  false
@@ -61794,32 +61784,32 @@ function createTypeChecker(host) {
61794
61784
  related = isRelatedTo(
61795
61785
  s,
61796
61786
  t,
61797
- intersectionState,
61798
61787
  3 /* Both */,
61799
61788
  reportErrors2,
61800
61789
  /*headMessage*/
61801
- void 0
61790
+ void 0,
61791
+ intersectionState
61802
61792
  );
61803
61793
  }
61804
61794
  } else {
61805
61795
  related = isRelatedTo(
61806
61796
  s,
61807
61797
  t,
61808
- intersectionState,
61809
61798
  3 /* Both */,
61810
61799
  reportErrors2,
61811
61800
  /*headMessage*/
61812
- void 0
61801
+ void 0,
61802
+ intersectionState
61813
61803
  );
61814
61804
  if (related) {
61815
61805
  related &= isRelatedTo(
61816
61806
  t,
61817
61807
  s,
61818
- intersectionState,
61819
61808
  3 /* Both */,
61820
61809
  reportErrors2,
61821
61810
  /*headMessage*/
61822
- void 0
61811
+ void 0,
61812
+ intersectionState
61823
61813
  );
61824
61814
  }
61825
61815
  }
@@ -61985,12 +61975,12 @@ function createTypeChecker(host) {
61985
61975
  result2 = isRelatedTo(
61986
61976
  constraint,
61987
61977
  target2,
61988
- intersectionState,
61989
61978
  1 /* Source */,
61990
61979
  /*reportErrors*/
61991
61980
  false,
61992
61981
  /*headMessage*/
61993
- void 0
61982
+ void 0,
61983
+ intersectionState
61994
61984
  );
61995
61985
  }
61996
61986
  }
@@ -62053,9 +62043,9 @@ function createTypeChecker(host) {
62053
62043
  const targetFlags = target2.flags;
62054
62044
  if (relation === identityRelation) {
62055
62045
  if (sourceFlags & 3145728 /* UnionOrIntersection */) {
62056
- let result3 = eachTypeRelatedToSomeType(source2, target2, intersectionState);
62046
+ let result3 = eachTypeRelatedToSomeType(source2, target2);
62057
62047
  if (result3) {
62058
- result3 &= eachTypeRelatedToSomeType(target2, source2, intersectionState);
62048
+ result3 &= eachTypeRelatedToSomeType(target2, source2);
62059
62049
  }
62060
62050
  return result3;
62061
62051
  }
@@ -62063,7 +62053,6 @@ function createTypeChecker(host) {
62063
62053
  return isRelatedTo(
62064
62054
  source2.type,
62065
62055
  target2.type,
62066
- intersectionState,
62067
62056
  3 /* Both */,
62068
62057
  /*reportErrors*/
62069
62058
  false
@@ -62073,7 +62062,6 @@ function createTypeChecker(host) {
62073
62062
  if (result2 = isRelatedTo(
62074
62063
  source2.objectType,
62075
62064
  target2.objectType,
62076
- intersectionState,
62077
62065
  3 /* Both */,
62078
62066
  /*reportErrors*/
62079
62067
  false
@@ -62081,7 +62069,6 @@ function createTypeChecker(host) {
62081
62069
  if (result2 &= isRelatedTo(
62082
62070
  source2.indexType,
62083
62071
  target2.indexType,
62084
- intersectionState,
62085
62072
  3 /* Both */,
62086
62073
  /*reportErrors*/
62087
62074
  false
@@ -62095,7 +62082,6 @@ function createTypeChecker(host) {
62095
62082
  if (result2 = isRelatedTo(
62096
62083
  source2.checkType,
62097
62084
  target2.checkType,
62098
- intersectionState,
62099
62085
  3 /* Both */,
62100
62086
  /*reportErrors*/
62101
62087
  false
@@ -62103,7 +62089,6 @@ function createTypeChecker(host) {
62103
62089
  if (result2 &= isRelatedTo(
62104
62090
  source2.extendsType,
62105
62091
  target2.extendsType,
62106
- intersectionState,
62107
62092
  3 /* Both */,
62108
62093
  /*reportErrors*/
62109
62094
  false
@@ -62111,7 +62096,6 @@ function createTypeChecker(host) {
62111
62096
  if (result2 &= isRelatedTo(
62112
62097
  getTrueTypeFromConditionalType(source2),
62113
62098
  getTrueTypeFromConditionalType(target2),
62114
- intersectionState,
62115
62099
  3 /* Both */,
62116
62100
  /*reportErrors*/
62117
62101
  false
@@ -62119,7 +62103,6 @@ function createTypeChecker(host) {
62119
62103
  if (result2 &= isRelatedTo(
62120
62104
  getFalseTypeFromConditionalType(source2),
62121
62105
  getFalseTypeFromConditionalType(target2),
62122
- intersectionState,
62123
62106
  3 /* Both */,
62124
62107
  /*reportErrors*/
62125
62108
  false
@@ -62135,7 +62118,6 @@ function createTypeChecker(host) {
62135
62118
  if (result2 = isRelatedTo(
62136
62119
  source2.baseType,
62137
62120
  target2.baseType,
62138
- intersectionState,
62139
62121
  3 /* Both */,
62140
62122
  /*reportErrors*/
62141
62123
  false
@@ -62143,7 +62125,6 @@ function createTypeChecker(host) {
62143
62125
  if (result2 &= isRelatedTo(
62144
62126
  source2.constraint,
62145
62127
  target2.constraint,
62146
- intersectionState,
62147
62128
  3 /* Both */,
62148
62129
  /*reportErrors*/
62149
62130
  false
@@ -62177,15 +62158,15 @@ function createTypeChecker(host) {
62177
62158
  return varianceResult;
62178
62159
  }
62179
62160
  }
62180
- if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2, intersectionState, 1 /* Source */)) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo(source2, getTypeArguments(target2)[0], intersectionState, 2 /* Target */))) {
62161
+ if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2, 1 /* Source */)) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo(source2, getTypeArguments(target2)[0], 2 /* Target */))) {
62181
62162
  return result2;
62182
62163
  }
62183
62164
  if (targetFlags & 262144 /* TypeParameter */) {
62184
- if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), intersectionState, 3 /* Both */)) {
62165
+ if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3 /* Both */)) {
62185
62166
  if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */)) {
62186
62167
  const templateType = getTemplateTypeFromMappedType(source2);
62187
62168
  const indexedAccessType = getIndexedAccessType(target2, getTypeParameterFromMappedType(source2));
62188
- if (result2 = isRelatedTo(templateType, indexedAccessType, intersectionState, 3 /* Both */, reportErrors2)) {
62169
+ if (result2 = isRelatedTo(templateType, indexedAccessType, 3 /* Both */, reportErrors2)) {
62189
62170
  return result2;
62190
62171
  }
62191
62172
  }
@@ -62197,7 +62178,6 @@ function createTypeChecker(host) {
62197
62178
  if (result2 = isRelatedTo(
62198
62179
  constraint,
62199
62180
  target2,
62200
- intersectionState,
62201
62181
  1 /* Source */,
62202
62182
  /*reportErrors*/
62203
62183
  false
@@ -62215,7 +62195,6 @@ function createTypeChecker(host) {
62215
62195
  if (result2 = isRelatedTo(
62216
62196
  targetType,
62217
62197
  source2.type,
62218
- intersectionState,
62219
62198
  3 /* Both */,
62220
62199
  /*reportErrors*/
62221
62200
  false
@@ -62224,13 +62203,13 @@ function createTypeChecker(host) {
62224
62203
  }
62225
62204
  }
62226
62205
  if (isTupleType(targetType)) {
62227
- if (result2 = isRelatedTo(source2, getKnownKeysOfTupleType(targetType), intersectionState, 2 /* Target */, reportErrors2)) {
62206
+ if (result2 = isRelatedTo(source2, getKnownKeysOfTupleType(targetType), 2 /* Target */, reportErrors2)) {
62228
62207
  return result2;
62229
62208
  }
62230
62209
  } else {
62231
62210
  const constraint = getSimplifiedTypeOrConstraint(targetType);
62232
62211
  if (constraint) {
62233
- if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), intersectionState, 2 /* Target */, reportErrors2) === -1 /* True */) {
62212
+ if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
62234
62213
  return -1 /* True */;
62235
62214
  }
62236
62215
  } else if (isGenericMappedType(targetType)) {
@@ -62243,15 +62222,15 @@ function createTypeChecker(host) {
62243
62222
  } else {
62244
62223
  targetKeys = nameType || constraintType;
62245
62224
  }
62246
- if (isRelatedTo(source2, targetKeys, intersectionState, 2 /* Target */, reportErrors2) === -1 /* True */) {
62225
+ if (isRelatedTo(source2, targetKeys, 2 /* Target */, reportErrors2) === -1 /* True */) {
62247
62226
  return -1 /* True */;
62248
62227
  }
62249
62228
  }
62250
62229
  }
62251
62230
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
62252
62231
  if (sourceFlags & 8388608 /* IndexedAccess */) {
62253
- if (result2 = isRelatedTo(source2.objectType, target2.objectType, intersectionState, 3 /* Both */, reportErrors2)) {
62254
- result2 &= isRelatedTo(source2.indexType, target2.indexType, intersectionState, 3 /* Both */, reportErrors2);
62232
+ if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
62233
+ result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
62255
62234
  }
62256
62235
  if (result2) {
62257
62236
  return result2;
@@ -62275,11 +62254,11 @@ function createTypeChecker(host) {
62275
62254
  if (result2 = isRelatedTo(
62276
62255
  source2,
62277
62256
  constraint,
62278
- intersectionState,
62279
62257
  2 /* Target */,
62280
62258
  reportErrors2,
62281
62259
  /*headMessage*/
62282
- void 0
62260
+ void 0,
62261
+ intersectionState
62283
62262
  )) {
62284
62263
  return result2;
62285
62264
  }
@@ -62305,18 +62284,18 @@ function createTypeChecker(host) {
62305
62284
  const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
62306
62285
  const includeOptional = modifiers & 4 /* IncludeOptional */;
62307
62286
  const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
62308
- if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, intersectionState, 3 /* Both */)) {
62287
+ if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
62309
62288
  const templateType2 = getTemplateTypeFromMappedType(target2);
62310
62289
  const typeParameter = getTypeParameterFromMappedType(target2);
62311
62290
  const nonNullComponent = extractTypesOfKind(templateType2, ~98304 /* Nullable */);
62312
62291
  if (!keysRemapped && nonNullComponent.flags & 8388608 /* IndexedAccess */ && nonNullComponent.indexType === typeParameter) {
62313
- if (result2 = isRelatedTo(source2, nonNullComponent.objectType, intersectionState, 2 /* Target */, reportErrors2)) {
62292
+ if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2 /* Target */, reportErrors2)) {
62314
62293
  return result2;
62315
62294
  }
62316
62295
  } else {
62317
62296
  const indexingType = keysRemapped ? filteredByApplicability || targetKeys : filteredByApplicability ? getIntersectionType([filteredByApplicability, typeParameter]) : typeParameter;
62318
62297
  const indexedAccessType = getIndexedAccessType(source2, indexingType);
62319
- if (result2 = isRelatedTo(indexedAccessType, templateType2, intersectionState, 3 /* Both */, reportErrors2)) {
62298
+ if (result2 = isRelatedTo(indexedAccessType, templateType2, 3 /* Both */, reportErrors2)) {
62320
62299
  return result2;
62321
62300
  }
62322
62301
  }
@@ -62336,22 +62315,22 @@ function createTypeChecker(host) {
62336
62315
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
62337
62316
  source2,
62338
62317
  getTrueTypeFromConditionalType(c),
62339
- intersectionState,
62340
62318
  2 /* Target */,
62341
62319
  /*reportErrors*/
62342
62320
  false,
62343
62321
  /*headMessage*/
62344
- void 0
62322
+ void 0,
62323
+ intersectionState
62345
62324
  )) {
62346
62325
  result2 &= skipFalse ? -1 /* True */ : isRelatedTo(
62347
62326
  source2,
62348
62327
  getFalseTypeFromConditionalType(c),
62349
- intersectionState,
62350
62328
  2 /* Target */,
62351
62329
  /*reportErrors*/
62352
62330
  false,
62353
62331
  /*headMessage*/
62354
- void 0
62332
+ void 0,
62333
+ intersectionState
62355
62334
  );
62356
62335
  if (result2) {
62357
62336
  return result2;
@@ -62381,29 +62360,29 @@ function createTypeChecker(host) {
62381
62360
  if (result2 = isRelatedTo(
62382
62361
  constraint,
62383
62362
  target2,
62384
- intersectionState,
62385
62363
  1 /* Source */,
62386
62364
  /*reportErrors*/
62387
62365
  false,
62388
62366
  /*headMessage*/
62389
- void 0
62367
+ void 0,
62368
+ intersectionState
62390
62369
  )) {
62391
62370
  return result2;
62392
62371
  } else if (result2 = isRelatedTo(
62393
62372
  getTypeWithThisArgument(constraint, source2),
62394
62373
  target2,
62395
- intersectionState,
62396
62374
  1 /* Source */,
62397
62375
  reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */),
62398
62376
  /*headMessage*/
62399
- void 0
62377
+ void 0,
62378
+ intersectionState
62400
62379
  )) {
62401
62380
  return result2;
62402
62381
  }
62403
62382
  if (isMappedTypeGenericIndexedAccess(source2)) {
62404
62383
  const indexConstraint = getConstraintOfType(source2.indexType);
62405
62384
  if (indexConstraint) {
62406
- if (result2 = isRelatedTo(getIndexedAccessType(source2.objectType, indexConstraint), target2, intersectionState, 1 /* Source */, reportErrors2)) {
62385
+ if (result2 = isRelatedTo(getIndexedAccessType(source2.objectType, indexConstraint), target2, 1 /* Source */, reportErrors2)) {
62407
62386
  return result2;
62408
62387
  }
62409
62388
  }
@@ -62411,21 +62390,21 @@ function createTypeChecker(host) {
62411
62390
  }
62412
62391
  } else if (sourceFlags & 4194304 /* Index */) {
62413
62392
  const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */;
62414
- if (result2 = isRelatedTo(stringNumberSymbolType, target2, intersectionState, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
62393
+ if (result2 = isRelatedTo(stringNumberSymbolType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
62415
62394
  return result2;
62416
62395
  }
62417
62396
  if (isDeferredMappedIndex) {
62418
62397
  const mappedType = source2.type;
62419
62398
  const nameType = getNameTypeFromMappedType(mappedType);
62420
62399
  const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
62421
- if (result2 = isRelatedTo(sourceMappedKeys, target2, intersectionState, 1 /* Source */, reportErrors2)) {
62400
+ if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
62422
62401
  return result2;
62423
62402
  }
62424
62403
  }
62425
62404
  } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
62426
62405
  if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
62427
62406
  const constraint = getBaseConstraintOfType(source2);
62428
- if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, intersectionState, 1 /* Source */, reportErrors2))) {
62407
+ if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
62429
62408
  return result2;
62430
62409
  }
62431
62410
  }
@@ -62434,12 +62413,12 @@ function createTypeChecker(host) {
62434
62413
  if (source2.symbol !== target2.symbol) {
62435
62414
  return 0 /* False */;
62436
62415
  }
62437
- if (result2 = isRelatedTo(source2.type, target2.type, intersectionState, 3 /* Both */, reportErrors2)) {
62416
+ if (result2 = isRelatedTo(source2.type, target2.type, 3 /* Both */, reportErrors2)) {
62438
62417
  return result2;
62439
62418
  }
62440
62419
  } else {
62441
62420
  const constraint = getBaseConstraintOfType(source2);
62442
- if (constraint && (result2 = isRelatedTo(constraint, target2, intersectionState, 1 /* Source */, reportErrors2))) {
62421
+ if (constraint && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) {
62443
62422
  return result2;
62444
62423
  }
62445
62424
  }
@@ -62452,24 +62431,20 @@ function createTypeChecker(host) {
62452
62431
  let sourceExtends = source2.extendsType;
62453
62432
  let mapper;
62454
62433
  if (sourceParams) {
62455
- let isRelatedToWorker2 = function(source3, target3, reportErrors3) {
62456
- return isRelatedTo(source3, target3, 0 /* None */, 3 /* Both */, reportErrors3);
62457
- };
62458
- var isRelatedToWorker = isRelatedToWorker2;
62459
62434
  const ctx = createInferenceContext(
62460
62435
  sourceParams,
62461
62436
  /*signature*/
62462
62437
  void 0,
62463
62438
  0 /* None */,
62464
- isRelatedToWorker2
62439
+ isRelatedToWorker
62465
62440
  );
62466
62441
  inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
62467
62442
  sourceExtends = instantiateType(sourceExtends, ctx.mapper);
62468
62443
  mapper = ctx.mapper;
62469
62444
  }
62470
- if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType, intersectionState, 3 /* Both */) || isRelatedTo(target2.checkType, source2.checkType, intersectionState, 3 /* Both */))) {
62471
- if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), intersectionState, 3 /* Both */, reportErrors2)) {
62472
- result2 &= isRelatedTo(getFalseTypeFromConditionalType(source2), getFalseTypeFromConditionalType(target2), intersectionState, 3 /* Both */, reportErrors2);
62445
+ if (isTypeIdenticalTo(sourceExtends, target2.extendsType) && (isRelatedTo(source2.checkType, target2.checkType, 3 /* Both */) || isRelatedTo(target2.checkType, source2.checkType, 3 /* Both */))) {
62446
+ if (result2 = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source2), mapper), getTrueTypeFromConditionalType(target2), 3 /* Both */, reportErrors2)) {
62447
+ result2 &= isRelatedTo(getFalseTypeFromConditionalType(source2), getFalseTypeFromConditionalType(target2), 3 /* Both */, reportErrors2);
62473
62448
  }
62474
62449
  if (result2) {
62475
62450
  return result2;
@@ -62478,14 +62453,14 @@ function createTypeChecker(host) {
62478
62453
  }
62479
62454
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
62480
62455
  if (defaultConstraint) {
62481
- if (result2 = isRelatedTo(defaultConstraint, target2, intersectionState, 1 /* Source */, reportErrors2)) {
62456
+ if (result2 = isRelatedTo(defaultConstraint, target2, 1 /* Source */, reportErrors2)) {
62482
62457
  return result2;
62483
62458
  }
62484
62459
  }
62485
62460
  const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
62486
62461
  if (distributiveConstraint) {
62487
62462
  resetErrorInfo(saveErrorInfo);
62488
- if (result2 = isRelatedTo(distributiveConstraint, target2, intersectionState, 1 /* Source */, reportErrors2)) {
62463
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
62489
62464
  return result2;
62490
62465
  }
62491
62466
  }
@@ -62495,7 +62470,7 @@ function createTypeChecker(host) {
62495
62470
  }
62496
62471
  if (isGenericMappedType(target2)) {
62497
62472
  if (isGenericMappedType(source2)) {
62498
- if (result2 = mappedTypeRelatedTo(source2, target2, reportErrors2, intersectionState)) {
62473
+ if (result2 = mappedTypeRelatedTo(source2, target2, reportErrors2)) {
62499
62474
  return result2;
62500
62475
  }
62501
62476
  }
@@ -62522,14 +62497,14 @@ function createTypeChecker(host) {
62522
62497
  }
62523
62498
  } else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) {
62524
62499
  if (relation !== identityRelation) {
62525
- return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, intersectionState, 3 /* Both */, reportErrors2);
62500
+ return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2);
62526
62501
  } else {
62527
62502
  return 0 /* False */;
62528
62503
  }
62529
62504
  } else if (isGenericTupleType(source2) && isTupleType(target2) && !isGenericTupleType(target2)) {
62530
62505
  const constraint = getBaseConstraintOrType(source2);
62531
62506
  if (constraint !== source2) {
62532
- return isRelatedTo(constraint, target2, intersectionState, 1 /* Source */, reportErrors2);
62507
+ return isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2);
62533
62508
  }
62534
62509
  } else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && getObjectFlags(target2) & 8192 /* FreshLiteral */ && !isEmptyObjectType(source2)) {
62535
62510
  return 0 /* False */;
@@ -62597,16 +62572,16 @@ function createTypeChecker(host) {
62597
62572
  }
62598
62573
  }
62599
62574
  }
62600
- function mappedTypeRelatedTo(source2, target2, reportErrors2, intersectionState) {
62575
+ function mappedTypeRelatedTo(source2, target2, reportErrors2) {
62601
62576
  const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getCombinedMappedTypeOptionality(source2) <= getCombinedMappedTypeOptionality(target2));
62602
62577
  if (modifiersRelated) {
62603
62578
  let result2;
62604
62579
  const targetConstraint = getConstraintTypeFromMappedType(target2);
62605
62580
  const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getCombinedMappedTypeOptionality(source2) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
62606
- if (result2 = isRelatedTo(targetConstraint, sourceConstraint, intersectionState, 3 /* Both */, reportErrors2)) {
62581
+ if (result2 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors2)) {
62607
62582
  const mapper = createTypeMapper([getTypeParameterFromMappedType(source2)], [getTypeParameterFromMappedType(target2)]);
62608
62583
  if (instantiateType(getNameTypeFromMappedType(source2), mapper) === instantiateType(getNameTypeFromMappedType(target2), mapper)) {
62609
- return result2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source2), mapper), getTemplateTypeFromMappedType(target2), intersectionState, 3 /* Both */, reportErrors2);
62584
+ return result2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source2), mapper), getTemplateTypeFromMappedType(target2), 3 /* Both */, reportErrors2);
62610
62585
  }
62611
62586
  }
62612
62587
  }
@@ -62746,11 +62721,11 @@ function createTypeChecker(host) {
62746
62721
  return isRelatedTo(
62747
62722
  effectiveSource,
62748
62723
  effectiveTarget,
62749
- intersectionState,
62750
62724
  3 /* Both */,
62751
62725
  reportErrors2,
62752
62726
  /*headMessage*/
62753
- void 0
62727
+ void 0,
62728
+ intersectionState
62754
62729
  );
62755
62730
  }
62756
62731
  function propertyRelatedTo(source2, target2, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState, skipOptional) {
@@ -62858,7 +62833,7 @@ function createTypeChecker(host) {
62858
62833
  }
62859
62834
  function propertiesRelatedTo(source2, target2, reportErrors2, excludedProperties, optionalsOnly, intersectionState) {
62860
62835
  if (relation === identityRelation) {
62861
- return propertiesIdenticalTo(source2, target2, excludedProperties, intersectionState);
62836
+ return propertiesIdenticalTo(source2, target2, excludedProperties);
62862
62837
  }
62863
62838
  let result2 = -1 /* True */;
62864
62839
  if (isTupleType(target2)) {
@@ -62937,11 +62912,11 @@ function createTypeChecker(host) {
62937
62912
  const related = isRelatedTo(
62938
62913
  sourceType,
62939
62914
  targetCheckType,
62940
- intersectionState,
62941
62915
  3 /* Both */,
62942
62916
  reportErrors2,
62943
62917
  /*headMessage*/
62944
- void 0
62918
+ void 0,
62919
+ intersectionState
62945
62920
  );
62946
62921
  if (!related) {
62947
62922
  if (reportErrors2 && (targetArity > 1 || sourceArity > 1)) {
@@ -63005,7 +62980,7 @@ function createTypeChecker(host) {
63005
62980
  }
63006
62981
  return result2;
63007
62982
  }
63008
- function propertiesIdenticalTo(source2, target2, excludedProperties, intersectionState) {
62983
+ function propertiesIdenticalTo(source2, target2, excludedProperties) {
63009
62984
  if (!(source2.flags & 524288 /* Object */ && target2.flags & 524288 /* Object */)) {
63010
62985
  return 0 /* False */;
63011
62986
  }
@@ -63020,21 +62995,18 @@ function createTypeChecker(host) {
63020
62995
  if (!targetProp) {
63021
62996
  return 0 /* False */;
63022
62997
  }
63023
- const related = compareProperties(sourceProp, targetProp, isRelatedToWorker);
62998
+ const related = compareProperties(sourceProp, targetProp, isRelatedTo);
63024
62999
  if (!related) {
63025
63000
  return 0 /* False */;
63026
63001
  }
63027
63002
  result2 &= related;
63028
63003
  }
63029
63004
  return result2;
63030
- function isRelatedToWorker(source3, target3) {
63031
- return isRelatedTo(source3, target3, intersectionState);
63032
- }
63033
63005
  }
63034
63006
  function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) {
63035
63007
  var _a2, _b;
63036
63008
  if (relation === identityRelation) {
63037
- return signaturesIdenticalTo(source2, target2, kind, intersectionState);
63009
+ return signaturesIdenticalTo(source2, target2, kind);
63038
63010
  }
63039
63011
  if (target2 === anyFunctionType || source2 === anyFunctionType) {
63040
63012
  return -1 /* True */;
@@ -63163,20 +63135,20 @@ function createTypeChecker(host) {
63163
63135
  }
63164
63136
  function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
63165
63137
  const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
63166
- return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
63167
- function isRelatedToWorker(source3, target3, reportErrors3) {
63138
+ return compareSignaturesRelated(erase ? getErasedSignature(source2) : source2, erase ? getErasedSignature(target2) : target2, checkMode, reportErrors2, reportError, incompatibleReporter, isRelatedToWorker2, reportUnreliableMapper);
63139
+ function isRelatedToWorker2(source3, target3, reportErrors3) {
63168
63140
  return isRelatedTo(
63169
63141
  source3,
63170
63142
  target3,
63171
- intersectionState,
63172
63143
  3 /* Both */,
63173
63144
  reportErrors3,
63174
63145
  /*headMessage*/
63175
- void 0
63146
+ void 0,
63147
+ intersectionState
63176
63148
  );
63177
63149
  }
63178
63150
  }
63179
- function signaturesIdenticalTo(source2, target2, kind, intersectionState) {
63151
+ function signaturesIdenticalTo(source2, target2, kind) {
63180
63152
  const sourceSignatures = getSignaturesOfType(source2, kind);
63181
63153
  const targetSignatures = getSignaturesOfType(target2, kind);
63182
63154
  if (sourceSignatures.length !== targetSignatures.length) {
@@ -63193,7 +63165,7 @@ function createTypeChecker(host) {
63193
63165
  false,
63194
63166
  /*ignoreReturnTypes*/
63195
63167
  false,
63196
- isRelatedToWorker
63168
+ isRelatedTo
63197
63169
  );
63198
63170
  if (!related) {
63199
63171
  return 0 /* False */;
@@ -63201,9 +63173,6 @@ function createTypeChecker(host) {
63201
63173
  result2 &= related;
63202
63174
  }
63203
63175
  return result2;
63204
- function isRelatedToWorker(source3, target3) {
63205
- return isRelatedTo(source3, target3, intersectionState);
63206
- }
63207
63176
  }
63208
63177
  function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) {
63209
63178
  let result2 = -1 /* True */;
@@ -63219,11 +63188,11 @@ function createTypeChecker(host) {
63219
63188
  const related = isRelatedTo(
63220
63189
  type,
63221
63190
  targetInfo.type,
63222
- intersectionState,
63223
63191
  3 /* Both */,
63224
63192
  reportErrors2,
63225
63193
  /*headMessage*/
63226
- void 0
63194
+ void 0,
63195
+ intersectionState
63227
63196
  );
63228
63197
  if (!related) {
63229
63198
  if (reportErrors2) {
@@ -63249,11 +63218,11 @@ function createTypeChecker(host) {
63249
63218
  const related = isRelatedTo(
63250
63219
  sourceInfo.type,
63251
63220
  targetInfo.type,
63252
- intersectionState,
63253
63221
  3 /* Both */,
63254
63222
  reportErrors2,
63255
63223
  /*headMessage*/
63256
- void 0
63224
+ void 0,
63225
+ intersectionState
63257
63226
  );
63258
63227
  if (!related && reportErrors2) {
63259
63228
  if (sourceInfo.keyType === targetInfo.keyType) {
@@ -63266,13 +63235,13 @@ function createTypeChecker(host) {
63266
63235
  }
63267
63236
  function indexSignaturesRelatedTo(source2, target2, sourceIsPrimitive, reportErrors2, intersectionState) {
63268
63237
  if (relation === identityRelation) {
63269
- return indexSignaturesIdenticalTo(source2, target2, intersectionState);
63238
+ return indexSignaturesIdenticalTo(source2, target2);
63270
63239
  }
63271
63240
  const indexInfos = getIndexInfosOfType(target2);
63272
63241
  const targetHasStringIndex = some(indexInfos, (info) => info.keyType === stringType);
63273
63242
  let result2 = -1 /* True */;
63274
63243
  for (const targetInfo of indexInfos) {
63275
- const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, intersectionState, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
63244
+ const related = relation !== strictSubtypeRelation && !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 /* Any */ ? -1 /* True */ : isGenericMappedType(source2) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source2), targetInfo.type, 3 /* Both */, reportErrors2) : typeRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
63276
63245
  if (!related) {
63277
63246
  return 0 /* False */;
63278
63247
  }
@@ -63293,7 +63262,7 @@ function createTypeChecker(host) {
63293
63262
  }
63294
63263
  return 0 /* False */;
63295
63264
  }
63296
- function indexSignaturesIdenticalTo(source2, target2, intersectionState) {
63265
+ function indexSignaturesIdenticalTo(source2, target2) {
63297
63266
  const sourceInfos = getIndexInfosOfType(source2);
63298
63267
  const targetInfos = getIndexInfosOfType(target2);
63299
63268
  if (sourceInfos.length !== targetInfos.length) {
@@ -63301,7 +63270,7 @@ function createTypeChecker(host) {
63301
63270
  }
63302
63271
  for (const targetInfo of targetInfos) {
63303
63272
  const sourceInfo = getIndexInfoOfType(source2, targetInfo.keyType);
63304
- if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type, intersectionState, 3 /* Both */) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
63273
+ if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type, 3 /* Both */) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
63305
63274
  return 0 /* False */;
63306
63275
  }
63307
63276
  }
@@ -71247,7 +71216,7 @@ function createTypeChecker(host) {
71247
71216
  if (isErrorType(objectType) || objectType === silentNeverType) {
71248
71217
  return objectType;
71249
71218
  }
71250
- if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
71219
+ if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression) && !isPreservedConstEnumUse(node, objectType)) {
71251
71220
  error(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
71252
71221
  return errorType;
71253
71222
  }
@@ -76291,17 +76260,28 @@ function createTypeChecker(host) {
76291
76260
  }
76292
76261
  function checkConstEnumAccess(node, type) {
76293
76262
  const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */;
76294
- if (!ok) {
76295
- error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
76263
+ if (!ok || getIsolatedModules(compilerOptions)) {
76264
+ if (!isPreservedConstEnumUse(node, type)) {
76265
+ if (!ok) {
76266
+ error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
76267
+ } else if (type.symbol.valueDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
76268
+ error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76269
+ }
76270
+ }
76296
76271
  }
76297
- if (getIsolatedModules(compilerOptions)) {
76298
- Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
76299
- const constEnumDeclaration = type.symbol.valueDeclaration;
76300
- const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
76301
- if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node) && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
76302
- error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
76272
+ }
76273
+ function isPreservedConstEnumUse(use, enumType) {
76274
+ Debug.assert(!!(enumType.symbol.flags & 128 /* ConstEnum */));
76275
+ const constEnumDeclaration = enumType.symbol.valueDeclaration;
76276
+ const otherFile = getSourceFileOfNode(constEnumDeclaration);
76277
+ if (!otherFile.isDeclarationFile) {
76278
+ if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(use)) {
76279
+ return false;
76303
76280
  }
76281
+ return shouldPreserveConstEnums(compilerOptions);
76304
76282
  }
76283
+ const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(otherFile.resolvedPath);
76284
+ return redirect && shouldPreserveConstEnums(redirect.commandLine.options);
76305
76285
  }
76306
76286
  function checkParenthesizedExpression(node, checkMode) {
76307
76287
  if (hasJSDocNodes(node)) {
@@ -83211,9 +83191,23 @@ function createTypeChecker(host) {
83211
83191
  function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
83212
83192
  return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
83213
83193
  }
83194
+ function getAllAccessorDeclarationsForDeclaration(accessor) {
83195
+ accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
83196
+ const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
83197
+ const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
83198
+ const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
83199
+ const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
83200
+ const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
83201
+ const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
83202
+ return {
83203
+ firstAccessor,
83204
+ secondAccessor,
83205
+ setAccessor,
83206
+ getAccessor
83207
+ };
83208
+ }
83214
83209
  function getPossibleTypeNodeReuseExpression(declaration) {
83215
- var _a;
83216
- return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
83210
+ return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarationsForDeclaration(declaration.parent).getAccessor) : void 0;
83217
83211
  }
83218
83212
  function getSingleReturnExpression(declaration) {
83219
83213
  let candidateExpr;
@@ -83398,6 +83392,35 @@ function createTypeChecker(host) {
83398
83392
  return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
83399
83393
  }
83400
83394
  }
83395
+ function getNonlocalEffectiveTypeAnnotationNode(node) {
83396
+ const direct = getEffectiveTypeAnnotationNode(node);
83397
+ if (direct) {
83398
+ return direct;
83399
+ }
83400
+ if (node.kind === 169 /* Parameter */ && node.parent.kind === 178 /* SetAccessor */) {
83401
+ const other = getAllAccessorDeclarationsForDeclaration(node.parent).getAccessor;
83402
+ if (other) {
83403
+ return getEffectiveReturnTypeNode(other);
83404
+ }
83405
+ }
83406
+ return void 0;
83407
+ }
83408
+ function getNonlocalEffectiveReturnTypeAnnotationNode(node) {
83409
+ const direct = getEffectiveReturnTypeNode(node);
83410
+ if (direct) {
83411
+ return direct;
83412
+ }
83413
+ if (node.kind === 177 /* GetAccessor */) {
83414
+ const other = getAllAccessorDeclarationsForDeclaration(node).setAccessor;
83415
+ if (other) {
83416
+ const param = getSetAccessorValueParameter(other);
83417
+ if (param) {
83418
+ return getEffectiveTypeAnnotationNode(param);
83419
+ }
83420
+ }
83421
+ }
83422
+ return void 0;
83423
+ }
83401
83424
  function createResolver() {
83402
83425
  return {
83403
83426
  getReferencedExportContainer,
@@ -83451,21 +83474,6 @@ function createTypeChecker(host) {
83451
83474
  },
83452
83475
  getJsxFactoryEntity,
83453
83476
  getJsxFragmentFactoryEntity,
83454
- getAllAccessorDeclarations(accessor) {
83455
- accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
83456
- const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
83457
- const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
83458
- const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
83459
- const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
83460
- const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
83461
- const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
83462
- return {
83463
- firstAccessor,
83464
- secondAccessor,
83465
- setAccessor,
83466
- getAccessor
83467
- };
83468
- },
83469
83477
  isBindingCapturedByNode: (node, decl) => {
83470
83478
  const parseNode = getParseTreeNode(node);
83471
83479
  const parseDecl = getParseTreeNode(decl);
@@ -83820,7 +83828,7 @@ function createTypeChecker(host) {
83820
83828
  return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
83821
83829
  }
83822
83830
  } else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
83823
- const accessors = getAllAccessorDeclarations(node.parent.members, node);
83831
+ const accessors = getAllAccessorDeclarationsForDeclaration(node);
83824
83832
  if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
83825
83833
  return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
83826
83834
  }
@@ -89011,7 +89019,7 @@ function transformTypeScript(context) {
89011
89019
  if (typeSerializer) {
89012
89020
  let decorators;
89013
89021
  if (shouldAddTypeMetadata(node)) {
89014
- const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node));
89022
+ const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container));
89015
89023
  decorators = append(decorators, factory2.createDecorator(typeMetadata));
89016
89024
  }
89017
89025
  if (shouldAddParamTypesMetadata(node)) {
@@ -89038,7 +89046,7 @@ function transformTypeScript(context) {
89038
89046
  /*type*/
89039
89047
  void 0,
89040
89048
  factory2.createToken(39 /* EqualsGreaterThanToken */),
89041
- typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
89049
+ typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
89042
89050
  ));
89043
89051
  properties = append(properties, typeProperty);
89044
89052
  }
@@ -92475,7 +92483,7 @@ function createRuntimeTypeSerializer(context) {
92475
92483
  let currentNameScope;
92476
92484
  return {
92477
92485
  serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
92478
- serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
92486
+ serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
92479
92487
  serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
92480
92488
  serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
92481
92489
  };
@@ -92489,18 +92497,18 @@ function createRuntimeTypeSerializer(context) {
92489
92497
  currentNameScope = savedCurrentNameScope;
92490
92498
  return result;
92491
92499
  }
92492
- function getAccessorTypeNode(node) {
92493
- const accessors = resolver.getAllAccessorDeclarations(node);
92500
+ function getAccessorTypeNode(node, container) {
92501
+ const accessors = getAllAccessorDeclarations(container.members, node);
92494
92502
  return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
92495
92503
  }
92496
- function serializeTypeOfNode(node) {
92504
+ function serializeTypeOfNode(node, container) {
92497
92505
  switch (node.kind) {
92498
92506
  case 172 /* PropertyDeclaration */:
92499
92507
  case 169 /* Parameter */:
92500
92508
  return serializeTypeNode(node.type);
92501
92509
  case 178 /* SetAccessor */:
92502
92510
  case 177 /* GetAccessor */:
92503
- return serializeTypeNode(getAccessorTypeNode(node));
92511
+ return serializeTypeNode(getAccessorTypeNode(node, container));
92504
92512
  case 263 /* ClassDeclaration */:
92505
92513
  case 231 /* ClassExpression */:
92506
92514
  case 174 /* MethodDeclaration */:
@@ -92523,7 +92531,7 @@ function createRuntimeTypeSerializer(context) {
92523
92531
  if (parameter.dotDotDotToken) {
92524
92532
  expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
92525
92533
  } else {
92526
- expressions.push(serializeTypeOfNode(parameter));
92534
+ expressions.push(serializeTypeOfNode(parameter, container));
92527
92535
  }
92528
92536
  }
92529
92537
  }
@@ -108913,7 +108921,7 @@ function transformDeclarations(context) {
108913
108921
  if (!isPrivate) {
108914
108922
  const valueParameter = getSetAccessorValueParameter(input);
108915
108923
  if (valueParameter) {
108916
- const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
108924
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
108917
108925
  newValueParameter = ensureParameter(
108918
108926
  valueParameter,
108919
108927
  /*modifierMask*/
@@ -109199,7 +109207,7 @@ function transformDeclarations(context) {
109199
109207
  void 0
109200
109208
  );
109201
109209
  }
109202
- const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input));
109210
+ const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
109203
109211
  return cleanup(factory2.updateGetAccessorDeclaration(
109204
109212
  input,
109205
109213
  ensureModifiers(input),
@@ -111047,7 +111055,6 @@ var notImplementedResolver = {
111047
111055
  isLiteralConstDeclaration: notImplemented,
111048
111056
  getJsxFactoryEntity: notImplemented,
111049
111057
  getJsxFragmentFactoryEntity: notImplemented,
111050
- getAllAccessorDeclarations: notImplemented,
111051
111058
  isBindingCapturedByNode: notImplemented,
111052
111059
  getDeclarationStatementsForSourceFile: notImplemented,
111053
111060
  isImportRequiredByAugmentation: notImplemented