@typescript-deploys/pr-build 6.0.0-pr-56300-12 → 6.0.0-pr-53017-28

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 = "6.0";
21
- var version = `${versionMajorMinor}.0-insiders.20251129`;
21
+ var version = `${versionMajorMinor}.0-insiders.20251201`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -47075,6 +47075,32 @@ function createTypeChecker(host) {
47075
47075
  emptyArray
47076
47076
  );
47077
47077
  var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
47078
+ var allKeysUnknownType = createAnonymousType(
47079
+ /*symbol*/
47080
+ void 0,
47081
+ emptySymbols,
47082
+ emptyArray,
47083
+ emptyArray,
47084
+ map(stringNumberSymbolType.types, (t) => createIndexInfo(
47085
+ t,
47086
+ unknownType,
47087
+ /*isReadonly*/
47088
+ false
47089
+ ))
47090
+ );
47091
+ var allKeysAllKeysUnknownType = createAnonymousType(
47092
+ /*symbol*/
47093
+ void 0,
47094
+ emptySymbols,
47095
+ emptyArray,
47096
+ emptyArray,
47097
+ map(stringNumberSymbolType.types, (t) => createIndexInfo(
47098
+ t,
47099
+ allKeysUnknownType,
47100
+ /*isReadonly*/
47101
+ false
47102
+ ))
47103
+ );
47078
47104
  var emptyGenericType = createAnonymousType(
47079
47105
  /*symbol*/
47080
47106
  void 0,
@@ -47293,6 +47319,7 @@ function createTypeChecker(host) {
47293
47319
  var deferredGlobalBigIntType;
47294
47320
  var deferredGlobalNaNSymbol;
47295
47321
  var deferredGlobalRecordSymbol;
47322
+ var deferredGlobalPartialInferenceSymbol;
47296
47323
  var deferredGlobalClassDecoratorContextType;
47297
47324
  var deferredGlobalClassMethodDecoratorContextType;
47298
47325
  var deferredGlobalClassGetterDecoratorContextType;
@@ -58284,7 +58311,7 @@ function createTypeChecker(host) {
58284
58311
  const modifiers = getMappedTypeModifiers(type.mappedType);
58285
58312
  const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
58286
58313
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
58287
- const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType, type.inferenceConstraintType && getIndexedAccessTypeOrUndefined(type.inferenceConstraintType, indexInfo.keyType)) ?? unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
58314
+ const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
58288
58315
  const members = createSymbolTable();
58289
58316
  const limitedConstraint = getLimitedConstraint(type);
58290
58317
  for (const prop of getPropertiesOfType(type.source)) {
@@ -58299,16 +58326,8 @@ function createTypeChecker(host) {
58299
58326
  inferredProp.declarations = prop.declarations;
58300
58327
  inferredProp.links.nameType = getSymbolLinks(prop).nameType;
58301
58328
  inferredProp.links.propertyType = getTypeOfSymbol(prop);
58302
- if (type.constraintType.type.flags & 8388608 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 262144 /* TypeParameter */ && type.constraintType.type.indexType.flags & 262144 /* TypeParameter */) {
58303
- const newTypeParam = type.constraintType.type.objectType;
58304
- const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam);
58305
- inferredProp.links.mappedType = newMappedType;
58306
- inferredProp.links.constraintType = getIndexType(newTypeParam);
58307
- } else {
58308
- inferredProp.links.mappedType = type.mappedType;
58309
- inferredProp.links.constraintType = type.constraintType;
58310
- }
58311
- inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
58329
+ inferredProp.links.mappedType = type.mappedType;
58330
+ inferredProp.links.constraintType = type.constraintType;
58312
58331
  members.set(prop.escapedName, inferredProp);
58313
58332
  }
58314
58333
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
@@ -60877,6 +60896,16 @@ function createTypeChecker(host) {
60877
60896
  ) || unknownSymbol);
60878
60897
  return deferredGlobalRecordSymbol === unknownSymbol ? void 0 : deferredGlobalRecordSymbol;
60879
60898
  }
60899
+ function getGlobalPartialInferenceSymbol() {
60900
+ deferredGlobalPartialInferenceSymbol || (deferredGlobalPartialInferenceSymbol = getGlobalTypeAliasSymbol(
60901
+ "PartialInference",
60902
+ /*arity*/
60903
+ 2,
60904
+ /*reportErrors*/
60905
+ false
60906
+ ) || unknownSymbol);
60907
+ return deferredGlobalPartialInferenceSymbol === unknownSymbol ? void 0 : deferredGlobalPartialInferenceSymbol;
60908
+ }
60880
60909
  function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
60881
60910
  return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
60882
60911
  }
@@ -68154,7 +68183,8 @@ function createTypeChecker(host) {
68154
68183
  priority: void 0,
68155
68184
  topLevel: true,
68156
68185
  isFixed: false,
68157
- impliedArity: void 0
68186
+ impliedArity: void 0,
68187
+ indexes: void 0
68158
68188
  };
68159
68189
  }
68160
68190
  function cloneInferenceInfo(inference) {
@@ -68166,7 +68196,8 @@ function createTypeChecker(host) {
68166
68196
  priority: inference.priority,
68167
68197
  topLevel: inference.topLevel,
68168
68198
  isFixed: inference.isFixed,
68169
- impliedArity: inference.impliedArity
68199
+ impliedArity: inference.impliedArity,
68200
+ indexes: inference.indexes && inference.indexes.slice()
68170
68201
  };
68171
68202
  }
68172
68203
  function cloneInferredPartOfContext(context) {
@@ -68232,6 +68263,11 @@ function createTypeChecker(host) {
68232
68263
  );
68233
68264
  }
68234
68265
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
68266
+ if (constraint.type.flags & 8388608 /* IndexedAccess */) {
68267
+ const newTypeParam = constraint.type.objectType;
68268
+ target = replaceIndexedAccess(target, constraint.type, newTypeParam);
68269
+ constraint = getIndexType(newTypeParam);
68270
+ }
68235
68271
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
68236
68272
  if (reverseHomomorphicMappedCache.has(cacheKey)) {
68237
68273
  return reverseHomomorphicMappedCache.get(cacheKey);
@@ -68275,20 +68311,28 @@ function createTypeChecker(host) {
68275
68311
  function getTypeOfReverseMappedSymbol(symbol) {
68276
68312
  const links = getSymbolLinks(symbol);
68277
68313
  if (!links.type) {
68278
- const reverseConstraint = symbol.links.inferenceConstraintType && getIndexedAccessTypeOrUndefined(symbol.links.inferenceConstraintType, getStringLiteralType(unescapeLeadingUnderscores(symbol.escapedName)));
68279
- links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType, reverseConstraint) ?? unknownType;
68314
+ links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
68280
68315
  }
68281
68316
  return links.type;
68282
68317
  }
68283
- function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
68284
- const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
68318
+ function inferReverseMappedTypeWorker(sourceType, target, constraint) {
68319
+ const typeParameter = getTypeParameterFromMappedType(target);
68320
+ const inferenceTarget = getIndexedAccessType(constraint.type, typeParameter);
68285
68321
  const templateType = getTemplateTypeFromMappedType(target);
68286
- const inference = createInferenceInfo(typeParameter);
68322
+ const inference = createInferenceInfo(inferenceTarget);
68287
68323
  inferTypes([inference], sourceType, templateType);
68288
- return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
68324
+ const inferredType = getTypeFromInference(inference);
68325
+ if (inferredType) {
68326
+ return inferredType;
68327
+ }
68328
+ if (inference.indexes) {
68329
+ const eraseSelfMapper = makeArrayTypeMapper([constraint.type, typeParameter], [allKeysAllKeysUnknownType, stringNumberSymbolType]);
68330
+ return instantiateType(getIntersectionType(inference.indexes), eraseSelfMapper);
68331
+ }
68332
+ return unknownType;
68289
68333
  }
68290
- function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
68291
- const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
68334
+ function inferReverseMappedType(source, target, constraint) {
68335
+ const cacheKey = source.id + "," + target.id + "," + constraint.id;
68292
68336
  if (reverseMappedCache.has(cacheKey)) {
68293
68337
  return reverseMappedCache.get(cacheKey) || unknownType;
68294
68338
  }
@@ -68299,7 +68343,7 @@ function createTypeChecker(host) {
68299
68343
  if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
68300
68344
  let type;
68301
68345
  if (reverseExpandingFlags !== 3 /* Both */) {
68302
- type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
68346
+ type = inferReverseMappedTypeWorker(source, target, constraint);
68303
68347
  }
68304
68348
  reverseMappedSourceStack.pop();
68305
68349
  reverseMappedTargetStack.pop();
@@ -68626,6 +68670,29 @@ function createTypeChecker(host) {
68626
68670
  } else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
68627
68671
  inferFromTypes(source.objectType, target.objectType);
68628
68672
  inferFromTypes(source.indexType, target.indexType);
68673
+ } else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
68674
+ if (isFromInferenceBlockedSource(source)) {
68675
+ return;
68676
+ }
68677
+ const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
68678
+ if (inference) {
68679
+ if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
68680
+ return;
68681
+ }
68682
+ if (!inference.isFixed) {
68683
+ const partialInferenceTypeSymbol = getGlobalPartialInferenceSymbol();
68684
+ if (partialInferenceTypeSymbol) {
68685
+ if (target.indexType.flags & 465829888 /* Instantiable */) {
68686
+ const recordSymbol = getGlobalRecordSymbol();
68687
+ if (recordSymbol) {
68688
+ inference.indexes = append(inference.indexes, getTypeAliasInstantiation(recordSymbol, [target.indexType, source]));
68689
+ }
68690
+ } else {
68691
+ inference.indexes = append(inference.indexes, getTypeAliasInstantiation(partialInferenceTypeSymbol, [source, target.indexType]));
68692
+ }
68693
+ }
68694
+ }
68695
+ }
68629
68696
  } else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
68630
68697
  if (source.symbol === target.symbol) {
68631
68698
  inferFromTypes(source.type, target.type);
@@ -69129,6 +69196,52 @@ function createTypeChecker(host) {
69129
69196
  const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
69130
69197
  inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
69131
69198
  fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
69199
+ } else if (inference.indexes) {
69200
+ const eraseSelfMapper = makeUnaryTypeMapper(inference.typeParameter, allKeysUnknownType);
69201
+ let aggregateInference = instantiateType(getIntersectionType(inference.indexes), mergeTypeMappers(eraseSelfMapper, context.nonFixingMapper));
69202
+ const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
69203
+ if (constraint2) {
69204
+ const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
69205
+ if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
69206
+ const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
69207
+ if (discriminantProps) {
69208
+ let match;
69209
+ findDiscriminant:
69210
+ for (const p of discriminantProps) {
69211
+ const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
69212
+ for (const type of instantiatedConstraint.types) {
69213
+ const propType = getTypeOfPropertyOfType(type, p.escapedName);
69214
+ if (propType && candidatePropType && checkTypeAssignableTo(
69215
+ candidatePropType,
69216
+ propType,
69217
+ /*errorNode*/
69218
+ void 0
69219
+ )) {
69220
+ if (match && match !== type) {
69221
+ match = void 0;
69222
+ break findDiscriminant;
69223
+ } else {
69224
+ match = type;
69225
+ }
69226
+ }
69227
+ }
69228
+ }
69229
+ if (match) {
69230
+ aggregateInference = getSpreadType(
69231
+ match,
69232
+ aggregateInference,
69233
+ /*symbol*/
69234
+ void 0,
69235
+ /*propegatedFlags*/
69236
+ 0,
69237
+ /*readonly*/
69238
+ false
69239
+ );
69240
+ }
69241
+ }
69242
+ }
69243
+ }
69244
+ inferredType = aggregateInference;
69132
69245
  } else if (context.flags & 1 /* NoDefault */) {
69133
69246
  inferredType = silentNeverType;
69134
69247
  } else {
@@ -69144,39 +69257,13 @@ function createTypeChecker(host) {
69144
69257
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
69145
69258
  if (constraint) {
69146
69259
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
69147
- inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
69148
- if (inferredType) {
69149
- inference.inferredType = inferredType;
69150
- }
69151
69260
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
69152
- fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
69153
69261
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
69154
69262
  }
69155
69263
  }
69156
69264
  clearActiveMapperCaches();
69157
69265
  }
69158
69266
  return inference.inferredType;
69159
- function cloneWithInferenceConstraintIfNeeded(type, inferenceConstraintType) {
69160
- if (!type || !(type.flags & 524288 /* Object */) || !(type.objectFlags & 1024 /* ReverseMapped */)) {
69161
- return type;
69162
- }
69163
- const reversed = type;
69164
- const cacheKey = reversed.source.id + "," + reversed.mappedType.id + "," + reversed.constraintType.id + "," + inferenceConstraintType.id;
69165
- if (reverseHomomorphicMappedCache.has(cacheKey)) {
69166
- return reverseHomomorphicMappedCache.get(cacheKey);
69167
- }
69168
- const clone = createObjectType(
69169
- 1024 /* ReverseMapped */ | 16 /* Anonymous */,
69170
- /*symbol*/
69171
- void 0
69172
- );
69173
- clone.source = reversed.source;
69174
- clone.mappedType = reversed.mappedType;
69175
- clone.constraintType = reversed.constraintType;
69176
- clone.inferenceConstraintType = inferenceConstraintType;
69177
- reverseHomomorphicMappedCache.set(cacheKey, clone);
69178
- return clone;
69179
- }
69180
69267
  }
69181
69268
  function getDefaultTypeArgumentType(isInJavaScriptFile) {
69182
69269
  return isInJavaScriptFile ? anyType : unknownType;
package/lib/lib.es5.d.ts CHANGED
@@ -1682,6 +1682,15 @@ type NoInfer<T> = intrinsic;
1682
1682
  */
1683
1683
  interface ThisType<T> {}
1684
1684
 
1685
+ /**
1686
+ * Type instantiated to perform partial inferences from indexed accesses
1687
+ */
1688
+ type PartialInference<T, Keys extends PropertyKey> = ({
1689
+ [K in Keys]: {
1690
+ [K1 in K]: T;
1691
+ };
1692
+ })[Keys];
1693
+
1685
1694
  /**
1686
1695
  * Stores types to be used with WeakSet, WeakMap, WeakRef, and FinalizationRegistry
1687
1696
  */
package/lib/typescript.js CHANGED
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
2286
2286
 
2287
2287
  // src/compiler/corePublic.ts
2288
2288
  var versionMajorMinor = "6.0";
2289
- var version = `${versionMajorMinor}.0-insiders.20251129`;
2289
+ var version = `${versionMajorMinor}.0-insiders.20251201`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -51703,6 +51703,32 @@ function createTypeChecker(host) {
51703
51703
  emptyArray
51704
51704
  );
51705
51705
  var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType;
51706
+ var allKeysUnknownType = createAnonymousType(
51707
+ /*symbol*/
51708
+ void 0,
51709
+ emptySymbols,
51710
+ emptyArray,
51711
+ emptyArray,
51712
+ map(stringNumberSymbolType.types, (t) => createIndexInfo(
51713
+ t,
51714
+ unknownType,
51715
+ /*isReadonly*/
51716
+ false
51717
+ ))
51718
+ );
51719
+ var allKeysAllKeysUnknownType = createAnonymousType(
51720
+ /*symbol*/
51721
+ void 0,
51722
+ emptySymbols,
51723
+ emptyArray,
51724
+ emptyArray,
51725
+ map(stringNumberSymbolType.types, (t) => createIndexInfo(
51726
+ t,
51727
+ allKeysUnknownType,
51728
+ /*isReadonly*/
51729
+ false
51730
+ ))
51731
+ );
51706
51732
  var emptyGenericType = createAnonymousType(
51707
51733
  /*symbol*/
51708
51734
  void 0,
@@ -51921,6 +51947,7 @@ function createTypeChecker(host) {
51921
51947
  var deferredGlobalBigIntType;
51922
51948
  var deferredGlobalNaNSymbol;
51923
51949
  var deferredGlobalRecordSymbol;
51950
+ var deferredGlobalPartialInferenceSymbol;
51924
51951
  var deferredGlobalClassDecoratorContextType;
51925
51952
  var deferredGlobalClassMethodDecoratorContextType;
51926
51953
  var deferredGlobalClassGetterDecoratorContextType;
@@ -62912,7 +62939,7 @@ function createTypeChecker(host) {
62912
62939
  const modifiers = getMappedTypeModifiers(type.mappedType);
62913
62940
  const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
62914
62941
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
62915
- const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType, type.inferenceConstraintType && getIndexedAccessTypeOrUndefined(type.inferenceConstraintType, indexInfo.keyType)) ?? unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
62942
+ const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
62916
62943
  const members = createSymbolTable();
62917
62944
  const limitedConstraint = getLimitedConstraint(type);
62918
62945
  for (const prop of getPropertiesOfType(type.source)) {
@@ -62927,16 +62954,8 @@ function createTypeChecker(host) {
62927
62954
  inferredProp.declarations = prop.declarations;
62928
62955
  inferredProp.links.nameType = getSymbolLinks(prop).nameType;
62929
62956
  inferredProp.links.propertyType = getTypeOfSymbol(prop);
62930
- if (type.constraintType.type.flags & 8388608 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 262144 /* TypeParameter */ && type.constraintType.type.indexType.flags & 262144 /* TypeParameter */) {
62931
- const newTypeParam = type.constraintType.type.objectType;
62932
- const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam);
62933
- inferredProp.links.mappedType = newMappedType;
62934
- inferredProp.links.constraintType = getIndexType(newTypeParam);
62935
- } else {
62936
- inferredProp.links.mappedType = type.mappedType;
62937
- inferredProp.links.constraintType = type.constraintType;
62938
- }
62939
- inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
62957
+ inferredProp.links.mappedType = type.mappedType;
62958
+ inferredProp.links.constraintType = type.constraintType;
62940
62959
  members.set(prop.escapedName, inferredProp);
62941
62960
  }
62942
62961
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
@@ -65505,6 +65524,16 @@ function createTypeChecker(host) {
65505
65524
  ) || unknownSymbol);
65506
65525
  return deferredGlobalRecordSymbol === unknownSymbol ? void 0 : deferredGlobalRecordSymbol;
65507
65526
  }
65527
+ function getGlobalPartialInferenceSymbol() {
65528
+ deferredGlobalPartialInferenceSymbol || (deferredGlobalPartialInferenceSymbol = getGlobalTypeAliasSymbol(
65529
+ "PartialInference",
65530
+ /*arity*/
65531
+ 2,
65532
+ /*reportErrors*/
65533
+ false
65534
+ ) || unknownSymbol);
65535
+ return deferredGlobalPartialInferenceSymbol === unknownSymbol ? void 0 : deferredGlobalPartialInferenceSymbol;
65536
+ }
65508
65537
  function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
65509
65538
  return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
65510
65539
  }
@@ -72782,7 +72811,8 @@ function createTypeChecker(host) {
72782
72811
  priority: void 0,
72783
72812
  topLevel: true,
72784
72813
  isFixed: false,
72785
- impliedArity: void 0
72814
+ impliedArity: void 0,
72815
+ indexes: void 0
72786
72816
  };
72787
72817
  }
72788
72818
  function cloneInferenceInfo(inference) {
@@ -72794,7 +72824,8 @@ function createTypeChecker(host) {
72794
72824
  priority: inference.priority,
72795
72825
  topLevel: inference.topLevel,
72796
72826
  isFixed: inference.isFixed,
72797
- impliedArity: inference.impliedArity
72827
+ impliedArity: inference.impliedArity,
72828
+ indexes: inference.indexes && inference.indexes.slice()
72798
72829
  };
72799
72830
  }
72800
72831
  function cloneInferredPartOfContext(context) {
@@ -72860,6 +72891,11 @@ function createTypeChecker(host) {
72860
72891
  );
72861
72892
  }
72862
72893
  function inferTypeForHomomorphicMappedType(source, target, constraint) {
72894
+ if (constraint.type.flags & 8388608 /* IndexedAccess */) {
72895
+ const newTypeParam = constraint.type.objectType;
72896
+ target = replaceIndexedAccess(target, constraint.type, newTypeParam);
72897
+ constraint = getIndexType(newTypeParam);
72898
+ }
72863
72899
  const cacheKey = source.id + "," + target.id + "," + constraint.id;
72864
72900
  if (reverseHomomorphicMappedCache.has(cacheKey)) {
72865
72901
  return reverseHomomorphicMappedCache.get(cacheKey);
@@ -72903,20 +72939,28 @@ function createTypeChecker(host) {
72903
72939
  function getTypeOfReverseMappedSymbol(symbol) {
72904
72940
  const links = getSymbolLinks(symbol);
72905
72941
  if (!links.type) {
72906
- const reverseConstraint = symbol.links.inferenceConstraintType && getIndexedAccessTypeOrUndefined(symbol.links.inferenceConstraintType, getStringLiteralType(unescapeLeadingUnderscores(symbol.escapedName)));
72907
- links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType, reverseConstraint) ?? unknownType;
72942
+ links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
72908
72943
  }
72909
72944
  return links.type;
72910
72945
  }
72911
- function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
72912
- const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
72946
+ function inferReverseMappedTypeWorker(sourceType, target, constraint) {
72947
+ const typeParameter = getTypeParameterFromMappedType(target);
72948
+ const inferenceTarget = getIndexedAccessType(constraint.type, typeParameter);
72913
72949
  const templateType = getTemplateTypeFromMappedType(target);
72914
- const inference = createInferenceInfo(typeParameter);
72950
+ const inference = createInferenceInfo(inferenceTarget);
72915
72951
  inferTypes([inference], sourceType, templateType);
72916
- return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
72952
+ const inferredType = getTypeFromInference(inference);
72953
+ if (inferredType) {
72954
+ return inferredType;
72955
+ }
72956
+ if (inference.indexes) {
72957
+ const eraseSelfMapper = makeArrayTypeMapper([constraint.type, typeParameter], [allKeysAllKeysUnknownType, stringNumberSymbolType]);
72958
+ return instantiateType(getIntersectionType(inference.indexes), eraseSelfMapper);
72959
+ }
72960
+ return unknownType;
72917
72961
  }
72918
- function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
72919
- const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
72962
+ function inferReverseMappedType(source, target, constraint) {
72963
+ const cacheKey = source.id + "," + target.id + "," + constraint.id;
72920
72964
  if (reverseMappedCache.has(cacheKey)) {
72921
72965
  return reverseMappedCache.get(cacheKey) || unknownType;
72922
72966
  }
@@ -72927,7 +72971,7 @@ function createTypeChecker(host) {
72927
72971
  if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
72928
72972
  let type;
72929
72973
  if (reverseExpandingFlags !== 3 /* Both */) {
72930
- type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
72974
+ type = inferReverseMappedTypeWorker(source, target, constraint);
72931
72975
  }
72932
72976
  reverseMappedSourceStack.pop();
72933
72977
  reverseMappedTargetStack.pop();
@@ -73254,6 +73298,29 @@ function createTypeChecker(host) {
73254
73298
  } else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) {
73255
73299
  inferFromTypes(source.objectType, target.objectType);
73256
73300
  inferFromTypes(source.indexType, target.indexType);
73301
+ } else if (!(priority & 1 /* NakedTypeVariable */) && target.flags & 8388608 /* IndexedAccess */) {
73302
+ if (isFromInferenceBlockedSource(source)) {
73303
+ return;
73304
+ }
73305
+ const inference = getInferenceInfoForType(getActualTypeVariable(target.objectType));
73306
+ if (inference) {
73307
+ if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
73308
+ return;
73309
+ }
73310
+ if (!inference.isFixed) {
73311
+ const partialInferenceTypeSymbol = getGlobalPartialInferenceSymbol();
73312
+ if (partialInferenceTypeSymbol) {
73313
+ if (target.indexType.flags & 465829888 /* Instantiable */) {
73314
+ const recordSymbol = getGlobalRecordSymbol();
73315
+ if (recordSymbol) {
73316
+ inference.indexes = append(inference.indexes, getTypeAliasInstantiation(recordSymbol, [target.indexType, source]));
73317
+ }
73318
+ } else {
73319
+ inference.indexes = append(inference.indexes, getTypeAliasInstantiation(partialInferenceTypeSymbol, [source, target.indexType]));
73320
+ }
73321
+ }
73322
+ }
73323
+ }
73257
73324
  } else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) {
73258
73325
  if (source.symbol === target.symbol) {
73259
73326
  inferFromTypes(source.type, target.type);
@@ -73757,6 +73824,52 @@ function createTypeChecker(host) {
73757
73824
  const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType))));
73758
73825
  inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
73759
73826
  fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
73827
+ } else if (inference.indexes) {
73828
+ const eraseSelfMapper = makeUnaryTypeMapper(inference.typeParameter, allKeysUnknownType);
73829
+ let aggregateInference = instantiateType(getIntersectionType(inference.indexes), mergeTypeMappers(eraseSelfMapper, context.nonFixingMapper));
73830
+ const constraint2 = getConstraintOfTypeParameter(inference.typeParameter);
73831
+ if (constraint2) {
73832
+ const instantiatedConstraint = instantiateType(constraint2, context.nonFixingMapper);
73833
+ if (instantiatedConstraint.flags & 1048576 /* Union */ && !context.compareTypes(aggregateInference, getTypeWithThisArgument(instantiatedConstraint, aggregateInference))) {
73834
+ const discriminantProps = findDiscriminantProperties(getPropertiesOfType(aggregateInference), instantiatedConstraint);
73835
+ if (discriminantProps) {
73836
+ let match;
73837
+ findDiscriminant:
73838
+ for (const p of discriminantProps) {
73839
+ const candidatePropType = getTypeOfPropertyOfType(aggregateInference, p.escapedName);
73840
+ for (const type of instantiatedConstraint.types) {
73841
+ const propType = getTypeOfPropertyOfType(type, p.escapedName);
73842
+ if (propType && candidatePropType && checkTypeAssignableTo(
73843
+ candidatePropType,
73844
+ propType,
73845
+ /*errorNode*/
73846
+ void 0
73847
+ )) {
73848
+ if (match && match !== type) {
73849
+ match = void 0;
73850
+ break findDiscriminant;
73851
+ } else {
73852
+ match = type;
73853
+ }
73854
+ }
73855
+ }
73856
+ }
73857
+ if (match) {
73858
+ aggregateInference = getSpreadType(
73859
+ match,
73860
+ aggregateInference,
73861
+ /*symbol*/
73862
+ void 0,
73863
+ /*propegatedFlags*/
73864
+ 0,
73865
+ /*readonly*/
73866
+ false
73867
+ );
73868
+ }
73869
+ }
73870
+ }
73871
+ }
73872
+ inferredType = aggregateInference;
73760
73873
  } else if (context.flags & 1 /* NoDefault */) {
73761
73874
  inferredType = silentNeverType;
73762
73875
  } else {
@@ -73772,39 +73885,13 @@ function createTypeChecker(host) {
73772
73885
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
73773
73886
  if (constraint) {
73774
73887
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
73775
- inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
73776
- if (inferredType) {
73777
- inference.inferredType = inferredType;
73778
- }
73779
73888
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
73780
- fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
73781
73889
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
73782
73890
  }
73783
73891
  }
73784
73892
  clearActiveMapperCaches();
73785
73893
  }
73786
73894
  return inference.inferredType;
73787
- function cloneWithInferenceConstraintIfNeeded(type, inferenceConstraintType) {
73788
- if (!type || !(type.flags & 524288 /* Object */) || !(type.objectFlags & 1024 /* ReverseMapped */)) {
73789
- return type;
73790
- }
73791
- const reversed = type;
73792
- const cacheKey = reversed.source.id + "," + reversed.mappedType.id + "," + reversed.constraintType.id + "," + inferenceConstraintType.id;
73793
- if (reverseHomomorphicMappedCache.has(cacheKey)) {
73794
- return reverseHomomorphicMappedCache.get(cacheKey);
73795
- }
73796
- const clone2 = createObjectType(
73797
- 1024 /* ReverseMapped */ | 16 /* Anonymous */,
73798
- /*symbol*/
73799
- void 0
73800
- );
73801
- clone2.source = reversed.source;
73802
- clone2.mappedType = reversed.mappedType;
73803
- clone2.constraintType = reversed.constraintType;
73804
- clone2.inferenceConstraintType = inferenceConstraintType;
73805
- reverseHomomorphicMappedCache.set(cacheKey, clone2);
73806
- return clone2;
73807
- }
73808
73895
  }
73809
73896
  function getDefaultTypeArgumentType(isInJavaScriptFile) {
73810
73897
  return isInJavaScriptFile ? anyType : unknownType;
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": "6.0.0-pr-56300-12",
5
+ "version": "6.0.0-pr-53017-28",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [