@typescript-deploys/pr-build 5.9.0-pr-61535-10 → 5.9.0-pr-61589-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/_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.9";
21
- var version = `${versionMajorMinor}.0-insiders.20250416`;
21
+ var version = `${versionMajorMinor}.0-insiders.20250417`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -47203,9 +47203,6 @@ function createTypeChecker(host) {
47203
47203
  var inferenceContextNodes = [];
47204
47204
  var inferenceContexts = [];
47205
47205
  var inferenceContextCount = 0;
47206
- var activeTypeMappers = [];
47207
- var activeTypeMappersCaches = [];
47208
- var activeTypeMappersCount = 0;
47209
47206
  var emptyStringType = getStringLiteralType("");
47210
47207
  var zeroType = getNumberLiteralType(0);
47211
47208
  var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
@@ -62267,7 +62264,7 @@ function createTypeChecker(host) {
62267
62264
  context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
62268
62265
  }
62269
62266
  if (!checkTypeDeferred) {
62270
- inferTypes(context, context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
62267
+ inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
62271
62268
  }
62272
62269
  combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
62273
62270
  }
@@ -63285,25 +63282,10 @@ function createTypeChecker(host) {
63285
63282
  error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
63286
63283
  return errorType;
63287
63284
  }
63288
- const index = findActiveMapper(mapper);
63289
- if (index === -1) {
63290
- pushActiveMapper(mapper);
63291
- }
63292
- const key = type.id + getAliasId(aliasSymbol, aliasTypeArguments);
63293
- const mapperCache = activeTypeMappersCaches[index !== -1 ? index : activeTypeMappersCount - 1];
63294
- const cached = mapperCache.get(key);
63295
- if (cached) {
63296
- return cached;
63297
- }
63298
63285
  totalInstantiationCount++;
63299
63286
  instantiationCount++;
63300
63287
  instantiationDepth++;
63301
63288
  const result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
63302
- if (index === -1) {
63303
- popActiveMapper();
63304
- } else {
63305
- mapperCache.set(key, result);
63306
- }
63307
63289
  instantiationDepth--;
63308
63290
  return result;
63309
63291
  }
@@ -65926,7 +65908,7 @@ function createTypeChecker(host) {
65926
65908
  0 /* None */,
65927
65909
  isRelatedToWorker
65928
65910
  );
65929
- inferTypes(ctx, ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
65911
+ inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
65930
65912
  sourceExtends = instantiateType(sourceExtends, ctx.mapper);
65931
65913
  mapper = ctx.mapper;
65932
65914
  }
@@ -67806,7 +67788,7 @@ function createTypeChecker(host) {
67806
67788
  map(context.inferences, (inference, i) => () => {
67807
67789
  if (!inference.isFixed) {
67808
67790
  inferFromIntraExpressionSites(context);
67809
- clearCachedInferences(context, context.inferences);
67791
+ clearCachedInferences(context.inferences);
67810
67792
  inference.isFixed = true;
67811
67793
  }
67812
67794
  return getInferredType(context, i);
@@ -67821,10 +67803,7 @@ function createTypeChecker(host) {
67821
67803
  })
67822
67804
  );
67823
67805
  }
67824
- function clearCachedInferences(context, inferences) {
67825
- if (context) {
67826
- clearActiveMapperCache(context.nonFixingMapper);
67827
- }
67806
+ function clearCachedInferences(inferences) {
67828
67807
  for (const inference of inferences) {
67829
67808
  if (!inference.isFixed) {
67830
67809
  inference.inferredType = void 0;
@@ -67839,7 +67818,7 @@ function createTypeChecker(host) {
67839
67818
  for (const { node, type } of context.intraExpressionInferenceSites) {
67840
67819
  const contextualType = node.kind === 174 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType(node, 2 /* NoConstraints */);
67841
67820
  if (contextualType) {
67842
- inferTypes(context, context.inferences, type, contextualType);
67821
+ inferTypes(context.inferences, type, contextualType);
67843
67822
  }
67844
67823
  }
67845
67824
  context.intraExpressionInferenceSites = void 0;
@@ -67983,13 +67962,7 @@ function createTypeChecker(host) {
67983
67962
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
67984
67963
  const templateType = getTemplateTypeFromMappedType(target);
67985
67964
  const inference = createInferenceInfo(typeParameter);
67986
- inferTypes(
67987
- /*context*/
67988
- void 0,
67989
- [inference],
67990
- sourceType,
67991
- templateType
67992
- );
67965
+ inferTypes([inference], sourceType, templateType);
67993
67966
  return getTypeFromInference(inference) || unknownType;
67994
67967
  }
67995
67968
  function inferReverseMappedType(source, target, constraint) {
@@ -68191,7 +68164,7 @@ function createTypeChecker(host) {
68191
68164
  function isTupleOfSelf(typeParameter, type) {
68192
68165
  return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
68193
68166
  }
68194
- function inferTypes(context, inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
68167
+ function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
68195
68168
  let bivariant = false;
68196
68169
  let propagationType;
68197
68170
  let inferencePriority = 2048 /* MaxValue */;
@@ -68282,16 +68255,16 @@ function createTypeChecker(host) {
68282
68255
  if (contravariant && !bivariant) {
68283
68256
  if (!contains(inference.contraCandidates, candidate)) {
68284
68257
  inference.contraCandidates = append(inference.contraCandidates, candidate);
68285
- clearCachedInferences(context, inferences);
68258
+ clearCachedInferences(inferences);
68286
68259
  }
68287
68260
  } else if (!contains(inference.candidates, candidate)) {
68288
68261
  inference.candidates = append(inference.candidates, candidate);
68289
- clearCachedInferences(context, inferences);
68262
+ clearCachedInferences(inferences);
68290
68263
  }
68291
68264
  }
68292
68265
  if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
68293
68266
  inference.topLevel = false;
68294
- clearCachedInferences(context, inferences);
68267
+ clearCachedInferences(inferences);
68295
68268
  }
68296
68269
  }
68297
68270
  inferencePriority = Math.min(inferencePriority, priority);
@@ -68857,7 +68830,6 @@ function createTypeChecker(host) {
68857
68830
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
68858
68831
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68859
68832
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
68860
- clearActiveMapperCache(context.nonFixingMapper);
68861
68833
  }
68862
68834
  }
68863
68835
  }
@@ -70873,15 +70845,31 @@ function createTypeChecker(host) {
70873
70845
  }
70874
70846
  const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
70875
70847
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
70876
- const narrowedType = mapType(candidate, (c) => {
70877
- const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
70878
- const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
70879
- const directlyRelated = mapType(
70880
- matching || type,
70881
- checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
70882
- );
70883
- return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
70884
- });
70848
+ let matchedCandidates = [];
70849
+ let narrowedType = mapType(type, (t) => mapType(
70850
+ candidate,
70851
+ (c) => {
70852
+ if (keyPropertyName) {
70853
+ const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
70854
+ if (!discriminant || getConstituentTypeForKeyType(type, discriminant) !== t) {
70855
+ return neverType;
70856
+ }
70857
+ }
70858
+ const directlyRelated = checkDerived ? isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType;
70859
+ if (!(directlyRelated.flags & 131072 /* Never */)) {
70860
+ matchedCandidates = appendIfUnique(matchedCandidates, c);
70861
+ }
70862
+ return directlyRelated;
70863
+ }
70864
+ ));
70865
+ if (matchedCandidates.length !== countTypes(candidate)) {
70866
+ narrowedType = getUnionType([
70867
+ narrowedType,
70868
+ mapType(candidate, (c) => {
70869
+ return !containsType(matchedCandidates, c) ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : neverType;
70870
+ })
70871
+ ]);
70872
+ }
70885
70873
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
70886
70874
  }
70887
70875
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
@@ -73121,28 +73109,6 @@ function createTypeChecker(host) {
73121
73109
  }
73122
73110
  }
73123
73111
  }
73124
- function pushActiveMapper(mapper) {
73125
- activeTypeMappers[activeTypeMappersCount] = mapper;
73126
- activeTypeMappersCaches[activeTypeMappersCount] = /* @__PURE__ */ new Map();
73127
- activeTypeMappersCount++;
73128
- }
73129
- function popActiveMapper() {
73130
- activeTypeMappersCount--;
73131
- }
73132
- function findActiveMapper(mapper) {
73133
- for (let i = activeTypeMappersCount - 1; i >= 0; i--) {
73134
- if (mapper === activeTypeMappers[i]) {
73135
- return i;
73136
- }
73137
- }
73138
- return -1;
73139
- }
73140
- function clearActiveMapperCache(mapper) {
73141
- const index = findActiveMapper(mapper);
73142
- if (index !== -1) {
73143
- activeTypeMappersCaches[index] = /* @__PURE__ */ new Map();
73144
- }
73145
- }
73146
73112
  function getContextualImportAttributeType(node) {
73147
73113
  return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
73148
73114
  /*reportErrors*/
@@ -75454,11 +75420,11 @@ function createTypeChecker(host) {
75454
75420
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
75455
75421
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
75456
75422
  applyToParameterTypes(sourceSignature, signature, (source, target) => {
75457
- inferTypes(context, context.inferences, source, target);
75423
+ inferTypes(context.inferences, source, target);
75458
75424
  });
75459
75425
  if (!inferenceContext) {
75460
75426
  applyToReturnTypes(contextualSignature, signature, (source, target) => {
75461
- inferTypes(context, context.inferences, source, target, 128 /* ReturnType */);
75427
+ inferTypes(context.inferences, source, target, 128 /* ReturnType */);
75462
75428
  });
75463
75429
  }
75464
75430
  return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
@@ -75466,7 +75432,7 @@ function createTypeChecker(host) {
75466
75432
  function inferJsxTypeArguments(node, signature, checkMode, context) {
75467
75433
  const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
75468
75434
  const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
75469
- inferTypes(context, context.inferences, checkAttrType, paramType);
75435
+ inferTypes(context.inferences, checkAttrType, paramType);
75470
75436
  return getInferredTypes(context);
75471
75437
  }
75472
75438
  function getThisArgumentType(thisArgumentNode) {
@@ -75493,11 +75459,11 @@ function createTypeChecker(host) {
75493
75459
  const instantiatedType = instantiateType(contextualType, outerMapper);
75494
75460
  const contextualSignature = getSingleCallSignature(instantiatedType);
75495
75461
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
75496
- inferTypes(context, context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
75462
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
75497
75463
  }
75498
75464
  const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
75499
75465
  const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
75500
- inferTypes(returnContext, returnContext.inferences, returnSourceType, inferenceTargetType);
75466
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
75501
75467
  context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
75502
75468
  }
75503
75469
  }
@@ -75513,7 +75479,7 @@ function createTypeChecker(host) {
75513
75479
  const thisType = getThisTypeOfSignature(signature);
75514
75480
  if (thisType && couldContainTypeVariables(thisType)) {
75515
75481
  const thisArgumentNode = getThisArgumentOfCall(node);
75516
- inferTypes(context, context.inferences, getThisArgumentType(thisArgumentNode), thisType);
75482
+ inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
75517
75483
  }
75518
75484
  for (let i = 0; i < argCount; i++) {
75519
75485
  const arg = args[i];
@@ -75521,13 +75487,13 @@ function createTypeChecker(host) {
75521
75487
  const paramType = getTypeAtPosition(signature, i);
75522
75488
  if (couldContainTypeVariables(paramType)) {
75523
75489
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
75524
- inferTypes(context, context.inferences, argType, paramType);
75490
+ inferTypes(context.inferences, argType, paramType);
75525
75491
  }
75526
75492
  }
75527
75493
  }
75528
75494
  if (restType && couldContainTypeVariables(restType)) {
75529
75495
  const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
75530
- inferTypes(context, context.inferences, spreadType, restType);
75496
+ inferTypes(context.inferences, spreadType, restType);
75531
75497
  }
75532
75498
  return getInferredTypes(context);
75533
75499
  }
@@ -77900,14 +77866,14 @@ function createTypeChecker(host) {
77900
77866
  isOptionalDeclaration(declaration)
77901
77867
  );
77902
77868
  const target = getTypeAtPosition(context, i);
77903
- inferTypes(inferenceContext, inferenceContext.inferences, source, target);
77869
+ inferTypes(inferenceContext.inferences, source, target);
77904
77870
  }
77905
77871
  }
77906
77872
  const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
77907
77873
  if (typeNode) {
77908
77874
  const source = getTypeFromTypeNode(typeNode);
77909
77875
  const target = getReturnTypeOfSignature(context);
77910
- inferTypes(inferenceContext, inferenceContext.inferences, source, target);
77876
+ inferTypes(inferenceContext.inferences, source, target);
77911
77877
  }
77912
77878
  }
77913
77879
  function assignContextualParameterTypes(signature, context) {
@@ -80323,7 +80289,6 @@ function createTypeChecker(host) {
80323
80289
  const inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
80324
80290
  applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
80325
80291
  inferTypes(
80326
- context,
80327
80292
  inferences,
80328
80293
  source,
80329
80294
  target,
@@ -80335,7 +80300,7 @@ function createTypeChecker(host) {
80335
80300
  });
80336
80301
  if (some(inferences, hasInferenceCandidates)) {
80337
80302
  applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
80338
- inferTypes(context, inferences, source, target);
80303
+ inferTypes(inferences, source, target);
80339
80304
  });
80340
80305
  if (!hasOverlappingInferences(context.inferences, inferences)) {
80341
80306
  mergeInferences(context.inferences, inferences);
package/lib/typescript.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.9";
2288
- var version = `${versionMajorMinor}.0-insiders.20250416`;
2288
+ var version = `${versionMajorMinor}.0-insiders.20250417`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -51813,9 +51813,6 @@ function createTypeChecker(host) {
51813
51813
  var inferenceContextNodes = [];
51814
51814
  var inferenceContexts = [];
51815
51815
  var inferenceContextCount = 0;
51816
- var activeTypeMappers = [];
51817
- var activeTypeMappersCaches = [];
51818
- var activeTypeMappersCount = 0;
51819
51816
  var emptyStringType = getStringLiteralType("");
51820
51817
  var zeroType = getNumberLiteralType(0);
51821
51818
  var zeroBigIntType = getBigIntLiteralType({ negative: false, base10Value: "0" });
@@ -66877,7 +66874,7 @@ function createTypeChecker(host) {
66877
66874
  context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
66878
66875
  }
66879
66876
  if (!checkTypeDeferred) {
66880
- inferTypes(context, context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
66877
+ inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
66881
66878
  }
66882
66879
  combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
66883
66880
  }
@@ -67895,25 +67892,10 @@ function createTypeChecker(host) {
67895
67892
  error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
67896
67893
  return errorType;
67897
67894
  }
67898
- const index = findActiveMapper(mapper);
67899
- if (index === -1) {
67900
- pushActiveMapper(mapper);
67901
- }
67902
- const key = type.id + getAliasId(aliasSymbol, aliasTypeArguments);
67903
- const mapperCache = activeTypeMappersCaches[index !== -1 ? index : activeTypeMappersCount - 1];
67904
- const cached = mapperCache.get(key);
67905
- if (cached) {
67906
- return cached;
67907
- }
67908
67895
  totalInstantiationCount++;
67909
67896
  instantiationCount++;
67910
67897
  instantiationDepth++;
67911
67898
  const result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
67912
- if (index === -1) {
67913
- popActiveMapper();
67914
- } else {
67915
- mapperCache.set(key, result);
67916
- }
67917
67899
  instantiationDepth--;
67918
67900
  return result;
67919
67901
  }
@@ -70536,7 +70518,7 @@ function createTypeChecker(host) {
70536
70518
  0 /* None */,
70537
70519
  isRelatedToWorker
70538
70520
  );
70539
- inferTypes(ctx, ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
70521
+ inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
70540
70522
  sourceExtends = instantiateType(sourceExtends, ctx.mapper);
70541
70523
  mapper = ctx.mapper;
70542
70524
  }
@@ -72416,7 +72398,7 @@ function createTypeChecker(host) {
72416
72398
  map(context.inferences, (inference, i) => () => {
72417
72399
  if (!inference.isFixed) {
72418
72400
  inferFromIntraExpressionSites(context);
72419
- clearCachedInferences(context, context.inferences);
72401
+ clearCachedInferences(context.inferences);
72420
72402
  inference.isFixed = true;
72421
72403
  }
72422
72404
  return getInferredType(context, i);
@@ -72431,10 +72413,7 @@ function createTypeChecker(host) {
72431
72413
  })
72432
72414
  );
72433
72415
  }
72434
- function clearCachedInferences(context, inferences) {
72435
- if (context) {
72436
- clearActiveMapperCache(context.nonFixingMapper);
72437
- }
72416
+ function clearCachedInferences(inferences) {
72438
72417
  for (const inference of inferences) {
72439
72418
  if (!inference.isFixed) {
72440
72419
  inference.inferredType = void 0;
@@ -72449,7 +72428,7 @@ function createTypeChecker(host) {
72449
72428
  for (const { node, type } of context.intraExpressionInferenceSites) {
72450
72429
  const contextualType = node.kind === 174 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */);
72451
72430
  if (contextualType) {
72452
- inferTypes(context, context.inferences, type, contextualType);
72431
+ inferTypes(context.inferences, type, contextualType);
72453
72432
  }
72454
72433
  }
72455
72434
  context.intraExpressionInferenceSites = void 0;
@@ -72593,13 +72572,7 @@ function createTypeChecker(host) {
72593
72572
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
72594
72573
  const templateType = getTemplateTypeFromMappedType(target);
72595
72574
  const inference = createInferenceInfo(typeParameter);
72596
- inferTypes(
72597
- /*context*/
72598
- void 0,
72599
- [inference],
72600
- sourceType,
72601
- templateType
72602
- );
72575
+ inferTypes([inference], sourceType, templateType);
72603
72576
  return getTypeFromInference(inference) || unknownType;
72604
72577
  }
72605
72578
  function inferReverseMappedType(source, target, constraint) {
@@ -72801,7 +72774,7 @@ function createTypeChecker(host) {
72801
72774
  function isTupleOfSelf(typeParameter, type) {
72802
72775
  return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
72803
72776
  }
72804
- function inferTypes(context, inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
72777
+ function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
72805
72778
  let bivariant = false;
72806
72779
  let propagationType;
72807
72780
  let inferencePriority = 2048 /* MaxValue */;
@@ -72892,16 +72865,16 @@ function createTypeChecker(host) {
72892
72865
  if (contravariant && !bivariant) {
72893
72866
  if (!contains(inference.contraCandidates, candidate)) {
72894
72867
  inference.contraCandidates = append(inference.contraCandidates, candidate);
72895
- clearCachedInferences(context, inferences);
72868
+ clearCachedInferences(inferences);
72896
72869
  }
72897
72870
  } else if (!contains(inference.candidates, candidate)) {
72898
72871
  inference.candidates = append(inference.candidates, candidate);
72899
- clearCachedInferences(context, inferences);
72872
+ clearCachedInferences(inferences);
72900
72873
  }
72901
72874
  }
72902
72875
  if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
72903
72876
  inference.topLevel = false;
72904
- clearCachedInferences(context, inferences);
72877
+ clearCachedInferences(inferences);
72905
72878
  }
72906
72879
  }
72907
72880
  inferencePriority = Math.min(inferencePriority, priority);
@@ -73467,7 +73440,6 @@ function createTypeChecker(host) {
73467
73440
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
73468
73441
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
73469
73442
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
73470
- clearActiveMapperCache(context.nonFixingMapper);
73471
73443
  }
73472
73444
  }
73473
73445
  }
@@ -75483,15 +75455,31 @@ function createTypeChecker(host) {
75483
75455
  }
75484
75456
  const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
75485
75457
  const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
75486
- const narrowedType = mapType(candidate, (c) => {
75487
- const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
75488
- const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
75489
- const directlyRelated = mapType(
75490
- matching || type,
75491
- checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
75492
- );
75493
- return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
75494
- });
75458
+ let matchedCandidates = [];
75459
+ let narrowedType = mapType(type, (t) => mapType(
75460
+ candidate,
75461
+ (c) => {
75462
+ if (keyPropertyName) {
75463
+ const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
75464
+ if (!discriminant || getConstituentTypeForKeyType(type, discriminant) !== t) {
75465
+ return neverType;
75466
+ }
75467
+ }
75468
+ const directlyRelated = checkDerived ? isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType;
75469
+ if (!(directlyRelated.flags & 131072 /* Never */)) {
75470
+ matchedCandidates = appendIfUnique(matchedCandidates, c);
75471
+ }
75472
+ return directlyRelated;
75473
+ }
75474
+ ));
75475
+ if (matchedCandidates.length !== countTypes(candidate)) {
75476
+ narrowedType = getUnionType([
75477
+ narrowedType,
75478
+ mapType(candidate, (c) => {
75479
+ return !containsType(matchedCandidates, c) ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : neverType;
75480
+ })
75481
+ ]);
75482
+ }
75495
75483
  return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
75496
75484
  }
75497
75485
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
@@ -77731,28 +77719,6 @@ function createTypeChecker(host) {
77731
77719
  }
77732
77720
  }
77733
77721
  }
77734
- function pushActiveMapper(mapper) {
77735
- activeTypeMappers[activeTypeMappersCount] = mapper;
77736
- activeTypeMappersCaches[activeTypeMappersCount] = /* @__PURE__ */ new Map();
77737
- activeTypeMappersCount++;
77738
- }
77739
- function popActiveMapper() {
77740
- activeTypeMappersCount--;
77741
- }
77742
- function findActiveMapper(mapper) {
77743
- for (let i = activeTypeMappersCount - 1; i >= 0; i--) {
77744
- if (mapper === activeTypeMappers[i]) {
77745
- return i;
77746
- }
77747
- }
77748
- return -1;
77749
- }
77750
- function clearActiveMapperCache(mapper) {
77751
- const index = findActiveMapper(mapper);
77752
- if (index !== -1) {
77753
- activeTypeMappersCaches[index] = /* @__PURE__ */ new Map();
77754
- }
77755
- }
77756
77722
  function getContextualImportAttributeType(node) {
77757
77723
  return getTypeOfPropertyOfContextualType(getGlobalImportAttributesType(
77758
77724
  /*reportErrors*/
@@ -80064,11 +80030,11 @@ function createTypeChecker(host) {
80064
80030
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
80065
80031
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
80066
80032
  applyToParameterTypes(sourceSignature, signature, (source, target) => {
80067
- inferTypes(context, context.inferences, source, target);
80033
+ inferTypes(context.inferences, source, target);
80068
80034
  });
80069
80035
  if (!inferenceContext) {
80070
80036
  applyToReturnTypes(contextualSignature, signature, (source, target) => {
80071
- inferTypes(context, context.inferences, source, target, 128 /* ReturnType */);
80037
+ inferTypes(context.inferences, source, target, 128 /* ReturnType */);
80072
80038
  });
80073
80039
  }
80074
80040
  return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
@@ -80076,7 +80042,7 @@ function createTypeChecker(host) {
80076
80042
  function inferJsxTypeArguments(node, signature, checkMode, context) {
80077
80043
  const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
80078
80044
  const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
80079
- inferTypes(context, context.inferences, checkAttrType, paramType);
80045
+ inferTypes(context.inferences, checkAttrType, paramType);
80080
80046
  return getInferredTypes(context);
80081
80047
  }
80082
80048
  function getThisArgumentType(thisArgumentNode) {
@@ -80103,11 +80069,11 @@ function createTypeChecker(host) {
80103
80069
  const instantiatedType = instantiateType(contextualType, outerMapper);
80104
80070
  const contextualSignature = getSingleCallSignature(instantiatedType);
80105
80071
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
80106
- inferTypes(context, context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
80072
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
80107
80073
  }
80108
80074
  const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
80109
80075
  const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
80110
- inferTypes(returnContext, returnContext.inferences, returnSourceType, inferenceTargetType);
80076
+ inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
80111
80077
  context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
80112
80078
  }
80113
80079
  }
@@ -80123,7 +80089,7 @@ function createTypeChecker(host) {
80123
80089
  const thisType = getThisTypeOfSignature(signature);
80124
80090
  if (thisType && couldContainTypeVariables(thisType)) {
80125
80091
  const thisArgumentNode = getThisArgumentOfCall(node);
80126
- inferTypes(context, context.inferences, getThisArgumentType(thisArgumentNode), thisType);
80092
+ inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
80127
80093
  }
80128
80094
  for (let i = 0; i < argCount; i++) {
80129
80095
  const arg = args[i];
@@ -80131,13 +80097,13 @@ function createTypeChecker(host) {
80131
80097
  const paramType = getTypeAtPosition(signature, i);
80132
80098
  if (couldContainTypeVariables(paramType)) {
80133
80099
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
80134
- inferTypes(context, context.inferences, argType, paramType);
80100
+ inferTypes(context.inferences, argType, paramType);
80135
80101
  }
80136
80102
  }
80137
80103
  }
80138
80104
  if (restType && couldContainTypeVariables(restType)) {
80139
80105
  const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
80140
- inferTypes(context, context.inferences, spreadType, restType);
80106
+ inferTypes(context.inferences, spreadType, restType);
80141
80107
  }
80142
80108
  return getInferredTypes(context);
80143
80109
  }
@@ -82510,14 +82476,14 @@ function createTypeChecker(host) {
82510
82476
  isOptionalDeclaration(declaration)
82511
82477
  );
82512
82478
  const target = getTypeAtPosition(context, i);
82513
- inferTypes(inferenceContext, inferenceContext.inferences, source, target);
82479
+ inferTypes(inferenceContext.inferences, source, target);
82514
82480
  }
82515
82481
  }
82516
82482
  const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
82517
82483
  if (typeNode) {
82518
82484
  const source = getTypeFromTypeNode(typeNode);
82519
82485
  const target = getReturnTypeOfSignature(context);
82520
- inferTypes(inferenceContext, inferenceContext.inferences, source, target);
82486
+ inferTypes(inferenceContext.inferences, source, target);
82521
82487
  }
82522
82488
  }
82523
82489
  function assignContextualParameterTypes(signature, context) {
@@ -84933,7 +84899,6 @@ function createTypeChecker(host) {
84933
84899
  const inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
84934
84900
  applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
84935
84901
  inferTypes(
84936
- context,
84937
84902
  inferences,
84938
84903
  source,
84939
84904
  target,
@@ -84945,7 +84910,7 @@ function createTypeChecker(host) {
84945
84910
  });
84946
84911
  if (some(inferences, hasInferenceCandidates)) {
84947
84912
  applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
84948
- inferTypes(context, inferences, source, target);
84913
+ inferTypes(inferences, source, target);
84949
84914
  });
84950
84915
  if (!hasOverlappingInferences(context.inferences, inferences)) {
84951
84916
  mergeInferences(context.inferences, inferences);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.9.0-pr-61535-10",
5
+ "version": "5.9.0-pr-61589-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [