@typescript-deploys/pr-build 5.4.0-pr-56476-3 → 5.4.0-pr-56488-8

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/typescript.js CHANGED
@@ -4437,7 +4437,7 @@ ${lanes.join("\n")}
4437
4437
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
4438
4438
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
4439
4439
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
4440
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
4440
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
4441
4441
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
4442
4442
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
4443
4443
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -17359,7 +17359,7 @@ ${lanes.join("\n")}
17359
17359
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
17360
17360
  }
17361
17361
  function getObjectFlags(type) {
17362
- return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
17362
+ return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
17363
17363
  }
17364
17364
  function forSomeAncestorDirectory(directory, callback) {
17365
17365
  return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
@@ -56735,12 +56735,7 @@ ${lanes.join("\n")}
56735
56735
  const checkType = type.checkType;
56736
56736
  const constraint = getLowerBoundOfKeyType(checkType);
56737
56737
  if (constraint !== checkType) {
56738
- return getConditionalTypeInstantiation(
56739
- type,
56740
- prependTypeMapping(type.root.checkType, constraint, type.mapper),
56741
- /*forConstraint*/
56742
- false
56743
- );
56738
+ return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
56744
56739
  }
56745
56740
  }
56746
56741
  return type;
@@ -57092,12 +57087,7 @@ ${lanes.join("\n")}
57092
57087
  );
57093
57088
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
57094
57089
  if (constraint && constraint !== type.checkType) {
57095
- const instantiated = getConditionalTypeInstantiation(
57096
- type,
57097
- prependTypeMapping(type.root.checkType, constraint, type.mapper),
57098
- /*forConstraint*/
57099
- true
57100
- );
57090
+ const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
57101
57091
  if (!(instantiated.flags & 131072 /* Never */)) {
57102
57092
  type.resolvedConstraintOfDistributive = instantiated;
57103
57093
  return instantiated;
@@ -59531,7 +59521,7 @@ ${lanes.join("\n")}
59531
59521
  }
59532
59522
  }
59533
59523
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
59534
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
59524
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
59535
59525
  if (templates.length) {
59536
59526
  let i = types.length;
59537
59527
  while (i > 0) {
@@ -59931,14 +59921,19 @@ ${lanes.join("\n")}
59931
59921
  function getConstituentCountOfTypes(types) {
59932
59922
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
59933
59923
  }
59924
+ function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
59925
+ if (types.length !== 2) {
59926
+ return false;
59927
+ }
59928
+ const [t1, t2] = types;
59929
+ return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
59930
+ }
59934
59931
  function getTypeFromIntersectionTypeNode(node) {
59935
59932
  const links = getNodeLinks(node);
59936
59933
  if (!links.resolvedType) {
59937
59934
  const aliasSymbol = getAliasSymbolForTypeNode(node);
59938
59935
  const types = map(node.types, getTypeFromTypeNode);
59939
- const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
59940
- const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
59941
- const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
59936
+ const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
59942
59937
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59943
59938
  }
59944
59939
  return links.resolvedType;
@@ -59965,17 +59960,19 @@ ${lanes.join("\n")}
59965
59960
  return constraintType;
59966
59961
  }
59967
59962
  const keyTypes = [];
59968
- if (isGenericIndexType(constraintType)) {
59969
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
59963
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
59964
+ if (!isGenericIndexType(constraintType)) {
59965
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
59966
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
59967
+ } else {
59970
59968
  return getIndexTypeForGenericType(type, indexFlags);
59971
59969
  }
59972
- forEachType(constraintType, addMemberForKeyType);
59973
- } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
59974
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
59975
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
59976
59970
  } else {
59977
59971
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
59978
59972
  }
59973
+ if (isGenericIndexType(constraintType)) {
59974
+ forEachType(constraintType, addMemberForKeyType);
59975
+ }
59979
59976
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
59980
59977
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
59981
59978
  return constraintType;
@@ -60148,6 +60145,11 @@ ${lanes.join("\n")}
60148
60145
  }
60149
60146
  function createTemplateLiteralType(texts, types) {
60150
60147
  const type = createType(134217728 /* TemplateLiteral */);
60148
+ type.objectFlags = getPropagatingFlagsOfTypes(
60149
+ types,
60150
+ /*excludeKinds*/
60151
+ 98304 /* Nullable */
60152
+ );
60151
60153
  type.texts = texts;
60152
60154
  type.types = types;
60153
60155
  return type;
@@ -60442,15 +60444,7 @@ ${lanes.join("\n")}
60442
60444
  }
60443
60445
  function isPatternLiteralPlaceholderType(type) {
60444
60446
  if (type.flags & 2097152 /* Intersection */) {
60445
- let seenPlaceholder = false;
60446
- for (const t of type.types) {
60447
- if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
60448
- seenPlaceholder = true;
60449
- } else if (!(t.flags & 524288 /* Object */)) {
60450
- return false;
60451
- }
60452
- }
60453
- return seenPlaceholder;
60447
+ return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
60454
60448
  }
60455
60449
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
60456
60450
  }
@@ -60467,7 +60461,7 @@ ${lanes.join("\n")}
60467
60461
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
60468
60462
  }
60469
60463
  function getGenericObjectFlags(type) {
60470
- if (type.flags & 3145728 /* UnionOrIntersection */) {
60464
+ if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
60471
60465
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
60472
60466
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
60473
60467
  }
@@ -60479,7 +60473,7 @@ ${lanes.join("\n")}
60479
60473
  }
60480
60474
  return type.objectFlags & 12582912 /* IsGenericType */;
60481
60475
  }
60482
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
60476
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
60483
60477
  }
60484
60478
  function getSimplifiedType(type, writing) {
60485
60479
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -60660,7 +60654,7 @@ ${lanes.join("\n")}
60660
60654
  function isDeferredType(type, checkTuples) {
60661
60655
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
60662
60656
  }
60663
- function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
60657
+ function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
60664
60658
  let result;
60665
60659
  let extraTypes;
60666
60660
  let tailCount = 0;
@@ -60706,7 +60700,7 @@ ${lanes.join("\n")}
60706
60700
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
60707
60701
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
60708
60702
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
60709
- if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
60703
+ if (checkType.flags & 1 /* Any */) {
60710
60704
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
60711
60705
  }
60712
60706
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -60816,9 +60810,7 @@ ${lanes.join("\n")}
60816
60810
  links.resolvedType = getConditionalType(
60817
60811
  root,
60818
60812
  /*mapper*/
60819
- void 0,
60820
- /*forConstraint*/
60821
- false
60813
+ void 0
60822
60814
  );
60823
60815
  if (outerTypeParameters) {
60824
60816
  root.instantiations = /* @__PURE__ */ new Map();
@@ -61507,7 +61499,7 @@ ${lanes.join("\n")}
61507
61499
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
61508
61500
  target.instantiations.set(id, result);
61509
61501
  const resultObjectFlags = getObjectFlags(result);
61510
- if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
61502
+ if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
61511
61503
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
61512
61504
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
61513
61505
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -61673,17 +61665,17 @@ ${lanes.join("\n")}
61673
61665
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
61674
61666
  return result;
61675
61667
  }
61676
- function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
61668
+ function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
61677
61669
  const root = type.root;
61678
61670
  if (root.outerTypeParameters) {
61679
61671
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
61680
- const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
61672
+ const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
61681
61673
  let result = root.instantiations.get(id);
61682
61674
  if (!result) {
61683
61675
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
61684
61676
  const checkType = root.checkType;
61685
61677
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
61686
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
61678
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
61687
61679
  root.instantiations.set(id, result);
61688
61680
  }
61689
61681
  return result;
@@ -61771,14 +61763,7 @@ ${lanes.join("\n")}
61771
61763
  );
61772
61764
  }
61773
61765
  if (flags & 16777216 /* Conditional */) {
61774
- return getConditionalTypeInstantiation(
61775
- type,
61776
- combineTypeMappers(type.mapper, mapper),
61777
- /*forConstraint*/
61778
- false,
61779
- aliasSymbol,
61780
- aliasTypeArguments
61781
- );
61766
+ return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
61782
61767
  }
61783
61768
  if (flags & 33554432 /* Substitution */) {
61784
61769
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -63422,7 +63407,7 @@ ${lanes.join("\n")}
63422
63407
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
63423
63408
  }
63424
63409
  if (target2.flags & 1048576 /* Union */) {
63425
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
63410
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
63426
63411
  }
63427
63412
  if (target2.flags & 2097152 /* Intersection */) {
63428
63413
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -63467,8 +63452,7 @@ ${lanes.join("\n")}
63467
63452
  sourceType,
63468
63453
  target2,
63469
63454
  /*reportErrors*/
63470
- false,
63471
- 0 /* None */
63455
+ false
63472
63456
  );
63473
63457
  if (!related) {
63474
63458
  return 0 /* False */;
@@ -63477,7 +63461,7 @@ ${lanes.join("\n")}
63477
63461
  }
63478
63462
  return result2;
63479
63463
  }
63480
- function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
63464
+ function typeRelatedToSomeType(source2, target2, reportErrors2) {
63481
63465
  const targetTypes = target2.types;
63482
63466
  if (target2.flags & 1048576 /* Union */) {
63483
63467
  if (containsType(targetTypes, source2)) {
@@ -63495,10 +63479,7 @@ ${lanes.join("\n")}
63495
63479
  match,
63496
63480
  2 /* Target */,
63497
63481
  /*reportErrors*/
63498
- false,
63499
- /*headMessage*/
63500
- void 0,
63501
- intersectionState
63482
+ false
63502
63483
  );
63503
63484
  if (related) {
63504
63485
  return related;
@@ -63511,10 +63492,7 @@ ${lanes.join("\n")}
63511
63492
  type,
63512
63493
  2 /* Target */,
63513
63494
  /*reportErrors*/
63514
- false,
63515
- /*headMessage*/
63516
- void 0,
63517
- intersectionState
63495
+ false
63518
63496
  );
63519
63497
  if (related) {
63520
63498
  return related;
@@ -63528,10 +63506,7 @@ ${lanes.join("\n")}
63528
63506
  bestMatchingType,
63529
63507
  2 /* Target */,
63530
63508
  /*reportErrors*/
63531
- true,
63532
- /*headMessage*/
63533
- void 0,
63534
- intersectionState
63509
+ true
63535
63510
  );
63536
63511
  }
63537
63512
  }
@@ -64329,6 +64304,13 @@ ${lanes.join("\n")}
64329
64304
  return result2;
64330
64305
  }
64331
64306
  }
64307
+ } else {
64308
+ const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
64309
+ if (distributiveConstraint) {
64310
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
64311
+ return result2;
64312
+ }
64313
+ }
64332
64314
  }
64333
64315
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
64334
64316
  if (defaultConstraint) {
@@ -64336,13 +64318,6 @@ ${lanes.join("\n")}
64336
64318
  return result2;
64337
64319
  }
64338
64320
  }
64339
- const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
64340
- if (distributiveConstraint) {
64341
- resetErrorInfo(saveErrorInfo);
64342
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
64343
- return result2;
64344
- }
64345
- }
64346
64321
  } else {
64347
64322
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
64348
64323
  return -1 /* True */;
@@ -66240,8 +66215,8 @@ ${lanes.join("\n")}
66240
66215
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
66241
66216
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
66242
66217
  }
66243
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
66244
- if (type.flags & 3899393 /* ObjectFlagsType */) {
66218
+ const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
66219
+ if (type.flags & 138117121 /* ObjectFlagsType */) {
66245
66220
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
66246
66221
  }
66247
66222
  return result;
@@ -174902,6 +174877,7 @@ ${options.prefix}` : "\n" : options.prefix
174902
174877
  return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
174903
174878
  }
174904
174879
  close() {
174880
+ var _a;
174905
174881
  this.projectService.typingsCache.onProjectClosed(this);
174906
174882
  this.closeWatchingTypingLocations();
174907
174883
  this.cleanupProgram();
@@ -174918,6 +174894,11 @@ ${options.prefix}` : "\n" : options.prefix
174918
174894
  this.resolutionCache.clear();
174919
174895
  this.resolutionCache = void 0;
174920
174896
  this.cachedUnresolvedImportsPerFile = void 0;
174897
+ (_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
174898
+ watcher.projects.delete(this);
174899
+ watcher.close();
174900
+ });
174901
+ this.packageJsonWatches = void 0;
174921
174902
  this.moduleSpecifierCache.clear();
174922
174903
  this.moduleSpecifierCache = void 0;
174923
174904
  this.directoryStructureHost = void 0;
@@ -175113,13 +175094,10 @@ ${options.prefix}` : "\n" : options.prefix
175113
175094
  }
175114
175095
  }
175115
175096
  /** @internal */
175116
- onPackageJsonChange(packageJsonPath) {
175117
- var _a;
175118
- if ((_a = this.packageJsonsForAutoImport) == null ? void 0 : _a.has(packageJsonPath)) {
175119
- this.moduleSpecifierCache.clear();
175120
- if (this.autoImportProviderHost) {
175121
- this.autoImportProviderHost.markAsDirty();
175122
- }
175097
+ onPackageJsonChange() {
175098
+ this.moduleSpecifierCache.clear();
175099
+ if (this.autoImportProviderHost) {
175100
+ this.autoImportProviderHost.markAsDirty();
175123
175101
  }
175124
175102
  }
175125
175103
  /** @internal */
@@ -175793,7 +175771,7 @@ ${options.prefix}` : "\n" : options.prefix
175793
175771
  getPackageJsonsVisibleToFile(fileName, rootDir) {
175794
175772
  if (this.projectService.serverMode !== 0 /* Semantic */)
175795
175773
  return emptyArray2;
175796
- return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
175774
+ return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
175797
175775
  }
175798
175776
  /** @internal */
175799
175777
  getNearestAncestorDirectoryWithPackageJson(fileName) {
@@ -175801,9 +175779,7 @@ ${options.prefix}` : "\n" : options.prefix
175801
175779
  }
175802
175780
  /** @internal */
175803
175781
  getPackageJsonsForAutoImport(rootDir) {
175804
- const packageJsons = this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
175805
- this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => this.projectService.toPath(p.fileName)));
175806
- return packageJsons;
175782
+ return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
175807
175783
  }
175808
175784
  /** @internal */
175809
175785
  getPackageJsonCache() {
@@ -177464,14 +177440,16 @@ ${options.prefix}` : "\n" : options.prefix
177464
177440
  * @internal
177465
177441
  */
177466
177442
  watchWildcardDirectory(directory, flags, configFileName, config) {
177467
- return this.watchFactory.watchDirectory(
177443
+ let watcher = this.watchFactory.watchDirectory(
177468
177444
  directory,
177469
177445
  (fileOrDirectory) => {
177470
177446
  const fileOrDirectoryPath = this.toPath(fileOrDirectory);
177471
177447
  const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
177472
177448
  if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
177473
- this.logger.info(`Config: ${configFileName} Detected new package.json: ${fileOrDirectory}`);
177474
- this.onAddPackageJson(this.getNormalizedAbsolutePath(fileOrDirectory), fileOrDirectoryPath);
177449
+ const file = this.getNormalizedAbsolutePath(fileOrDirectory);
177450
+ this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
177451
+ this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
177452
+ this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
177475
177453
  }
177476
177454
  const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
177477
177455
  if (isIgnoredFileFromWildCardWatching({
@@ -177520,6 +177498,22 @@ ${options.prefix}` : "\n" : options.prefix
177520
177498
  WatchType.WildcardDirectory,
177521
177499
  configFileName
177522
177500
  );
177501
+ const result = {
177502
+ packageJsonWatches: void 0,
177503
+ close() {
177504
+ var _a;
177505
+ if (watcher) {
177506
+ watcher.close();
177507
+ watcher = void 0;
177508
+ (_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
177509
+ watcher2.projects.delete(result);
177510
+ watcher2.close();
177511
+ });
177512
+ result.packageJsonWatches = void 0;
177513
+ }
177514
+ }
177515
+ };
177516
+ return result;
177523
177517
  }
177524
177518
  /** @internal */
177525
177519
  delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
@@ -178603,9 +178597,9 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
178603
178597
  return;
178604
178598
  const basename = getBaseFileName(fileOrDirectoryPath);
178605
178599
  if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
178606
- result.affectedModuleSpecifierCacheProjects.forEach((projectName) => {
178607
- var _a2, _b;
178608
- (_b = (_a2 = this.findProject(projectName)) == null ? void 0 : _a2.getModuleSpecifierCache()) == null ? void 0 : _b.clear();
178600
+ result.affectedModuleSpecifierCacheProjects.forEach((project) => {
178601
+ var _a2;
178602
+ (_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
178609
178603
  });
178610
178604
  }
178611
178605
  if (result.refreshScriptInfoRefCount) {
@@ -178647,12 +178641,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
178647
178641
  var _a;
178648
178642
  const dirPath = this.toPath(dir);
178649
178643
  const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
178650
- Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project.getProjectName())));
178651
- (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project.getProjectName());
178644
+ Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
178645
+ (watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
178652
178646
  return {
178653
178647
  close: () => {
178654
178648
  var _a2;
178655
- (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project.getProjectName());
178649
+ (_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
178656
178650
  watcher.close();
178657
178651
  }
178658
178652
  };
@@ -178934,10 +178928,9 @@ Dynamic files must always be opened with service's current directory or service
178934
178928
  });
178935
178929
  }
178936
178930
  if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
178937
- this.invalidateProjectPackageJson(
178938
- /*packageJsonPath*/
178939
- void 0
178940
- );
178931
+ this.forEachProject((project) => {
178932
+ project.onAutoImportProviderSettingsChanged();
178933
+ });
178941
178934
  }
178942
178935
  }
178943
178936
  if (args.extraFileExtensions) {
@@ -179856,7 +179849,7 @@ Dynamic files must always be opened with service's current directory or service
179856
179849
  this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
179857
179850
  }
179858
179851
  /** @internal */
179859
- getPackageJsonsVisibleToFile(fileName, rootDir) {
179852
+ getPackageJsonsVisibleToFile(fileName, project, rootDir) {
179860
179853
  const packageJsonCache = this.packageJsonCache;
179861
179854
  const rootPath = rootDir && this.toPath(rootDir);
179862
179855
  const result = [];
@@ -179867,7 +179860,7 @@ Dynamic files must always be opened with service's current directory or service
179867
179860
  return processDirectory(directory);
179868
179861
  case -1 /* True */:
179869
179862
  const packageJsonFileName = combinePaths(directory, "package.json");
179870
- this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName));
179863
+ this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
179871
179864
  const info = packageJsonCache.getInDirectory(directory);
179872
179865
  if (info)
179873
179866
  result.push(info);
@@ -179893,40 +179886,54 @@ Dynamic files must always be opened with service's current directory or service
179893
179886
  });
179894
179887
  }
179895
179888
  /** @internal */
179896
- watchPackageJsonFile(file, path) {
179897
- const watchers = this.packageJsonFilesMap || (this.packageJsonFilesMap = /* @__PURE__ */ new Map());
179898
- if (!watchers.has(path)) {
179899
- this.invalidateProjectPackageJson(path);
179900
- watchers.set(
179901
- path,
179902
- this.watchFactory.watchFile(
179903
- file,
179904
- (fileName, eventKind) => {
179905
- switch (eventKind) {
179906
- case 0 /* Created */:
179907
- return Debug.fail();
179908
- case 1 /* Changed */:
179909
- this.packageJsonCache.addOrUpdate(fileName, path);
179910
- this.invalidateProjectPackageJson(path);
179911
- break;
179912
- case 2 /* Deleted */:
179913
- this.packageJsonCache.delete(path);
179914
- this.invalidateProjectPackageJson(path);
179915
- watchers.get(path).close();
179916
- watchers.delete(path);
179917
- }
179918
- },
179919
- 250 /* Low */,
179920
- this.hostConfiguration.watchOptions,
179921
- WatchType.PackageJson
179922
- )
179889
+ watchPackageJsonFile(file, path, project) {
179890
+ Debug.assert(project !== void 0);
179891
+ let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
179892
+ if (!result) {
179893
+ let watcher = this.watchFactory.watchFile(
179894
+ file,
179895
+ (fileName, eventKind) => {
179896
+ switch (eventKind) {
179897
+ case 0 /* Created */:
179898
+ return Debug.fail();
179899
+ case 1 /* Changed */:
179900
+ this.packageJsonCache.addOrUpdate(fileName, path);
179901
+ this.onPackageJsonChange(result);
179902
+ break;
179903
+ case 2 /* Deleted */:
179904
+ this.packageJsonCache.delete(path);
179905
+ this.onPackageJsonChange(result);
179906
+ result.projects.clear();
179907
+ result.close();
179908
+ }
179909
+ },
179910
+ 250 /* Low */,
179911
+ this.hostConfiguration.watchOptions,
179912
+ WatchType.PackageJson
179923
179913
  );
179914
+ result = {
179915
+ projects: /* @__PURE__ */ new Set(),
179916
+ close: () => {
179917
+ var _a;
179918
+ if (result.projects.size || !watcher)
179919
+ return;
179920
+ watcher.close();
179921
+ watcher = void 0;
179922
+ (_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
179923
+ this.packageJsonCache.invalidate(path);
179924
+ }
179925
+ };
179926
+ this.packageJsonFilesMap.set(path, result);
179924
179927
  }
179928
+ result.projects.add(project);
179929
+ (project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
179925
179930
  }
179926
179931
  /** @internal */
179927
- onAddPackageJson(file, path) {
179928
- this.packageJsonCache.addOrUpdate(file, path);
179929
- this.watchPackageJsonFile(file, path);
179932
+ onPackageJsonChange(result) {
179933
+ result.projects.forEach((project) => {
179934
+ var _a;
179935
+ return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
179936
+ });
179930
179937
  }
179931
179938
  /** @internal */
179932
179939
  includePackageJsonAutoImports() {
@@ -179940,16 +179947,6 @@ Dynamic files must always be opened with service's current directory or service
179940
179947
  }
179941
179948
  }
179942
179949
  /** @internal */
179943
- invalidateProjectPackageJson(packageJsonPath) {
179944
- this.forEachProject((project) => {
179945
- if (packageJsonPath) {
179946
- project.onPackageJsonChange(packageJsonPath);
179947
- } else {
179948
- project.onAutoImportProviderSettingsChanged();
179949
- }
179950
- });
179951
- }
179952
- /** @internal */
179953
179950
  getIncompleteCompletionsCache() {
179954
179951
  return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
179955
179952
  }
@@ -180065,6 +180062,7 @@ Dynamic files must always be opened with service's current directory or service
180065
180062
  const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
180066
180063
  return {
180067
180064
  addOrUpdate,
180065
+ invalidate,
180068
180066
  delete: (fileName) => {
180069
180067
  packageJsons.delete(fileName);
180070
180068
  directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
@@ -180093,6 +180091,10 @@ Dynamic files must always be opened with service's current directory or service
180093
180091
  packageJsons.set(path, packageJsonInfo);
180094
180092
  directoriesWithoutPackageJson.delete(getDirectoryPath(path));
180095
180093
  }
180094
+ function invalidate(path) {
180095
+ packageJsons.delete(path);
180096
+ directoriesWithoutPackageJson.delete(getDirectoryPath(path));
180097
+ }
180096
180098
  function directoryHasPackageJson(directory) {
180097
180099
  const path = host.toPath(directory);
180098
180100
  return packageJsons.has(combinePaths(path, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(path) ? 0 /* False */ : 3 /* Maybe */;
@@ -3095,7 +3095,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3095
3095
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3096
3096
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3097
3097
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3098
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3098
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3099
3099
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3100
3100
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3101
3101
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
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.4.0-pr-56476-3",
5
+ "version": "5.4.0-pr-56488-8",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "9d7321622ab60419f0e76651259c392102e4d45e"
118
+ "gitHead": "d0166969f3ff4eae4688c49b4f28c9601921f378"
119
119
  }