@typescript-deploys/pr-build 6.0.0-pr-62789-2 → 6.0.0-pr-56300-12

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.20251124`;
21
+ var version = `${versionMajorMinor}.0-insiders.20251129`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -58284,7 +58284,7 @@ function createTypeChecker(host) {
58284
58284
  const modifiers = getMappedTypeModifiers(type.mappedType);
58285
58285
  const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
58286
58286
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
58287
- const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
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;
58288
58288
  const members = createSymbolTable();
58289
58289
  const limitedConstraint = getLimitedConstraint(type);
58290
58290
  for (const prop of getPropertiesOfType(type.source)) {
@@ -58308,6 +58308,7 @@ function createTypeChecker(host) {
58308
58308
  inferredProp.links.mappedType = type.mappedType;
58309
58309
  inferredProp.links.constraintType = type.constraintType;
58310
58310
  }
58311
+ inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
58311
58312
  members.set(prop.escapedName, inferredProp);
58312
58313
  }
58313
58314
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
@@ -68274,19 +68275,20 @@ function createTypeChecker(host) {
68274
68275
  function getTypeOfReverseMappedSymbol(symbol) {
68275
68276
  const links = getSymbolLinks(symbol);
68276
68277
  if (!links.type) {
68277
- links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
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;
68278
68280
  }
68279
68281
  return links.type;
68280
68282
  }
68281
- function inferReverseMappedTypeWorker(sourceType, target, constraint) {
68283
+ function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
68282
68284
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
68283
68285
  const templateType = getTemplateTypeFromMappedType(target);
68284
68286
  const inference = createInferenceInfo(typeParameter);
68285
68287
  inferTypes([inference], sourceType, templateType);
68286
- return getTypeFromInference(inference) || unknownType;
68288
+ return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
68287
68289
  }
68288
- function inferReverseMappedType(source, target, constraint) {
68289
- const cacheKey = source.id + "," + target.id + "," + constraint.id;
68290
+ function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
68291
+ const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
68290
68292
  if (reverseMappedCache.has(cacheKey)) {
68291
68293
  return reverseMappedCache.get(cacheKey) || unknownType;
68292
68294
  }
@@ -68297,7 +68299,7 @@ function createTypeChecker(host) {
68297
68299
  if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
68298
68300
  let type;
68299
68301
  if (reverseExpandingFlags !== 3 /* Both */) {
68300
- type = inferReverseMappedTypeWorker(source, target, constraint);
68302
+ type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
68301
68303
  }
68302
68304
  reverseMappedSourceStack.pop();
68303
68305
  reverseMappedTargetStack.pop();
@@ -69142,13 +69144,39 @@ function createTypeChecker(host) {
69142
69144
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
69143
69145
  if (constraint) {
69144
69146
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
69147
+ inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
69148
+ if (inferredType) {
69149
+ inference.inferredType = inferredType;
69150
+ }
69145
69151
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
69152
+ fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
69146
69153
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
69147
69154
  }
69148
69155
  }
69149
69156
  clearActiveMapperCaches();
69150
69157
  }
69151
69158
  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
+ }
69152
69180
  }
69153
69181
  function getDefaultTypeArgumentType(isInJavaScriptFile) {
69154
69182
  return isInJavaScriptFile ? anyType : unknownType;
@@ -79809,8 +79837,7 @@ function createTypeChecker(host) {
79809
79837
  }
79810
79838
  }
79811
79839
  function isNotWithinNullishCoalesceExpression(node) {
79812
- const parent = walkUpOuterExpressions(node);
79813
- return !isBinaryExpression(parent) || parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
79840
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
79814
79841
  }
79815
79842
  function getSyntacticNullishnessSemantics(node) {
79816
79843
  node = skipOuterExpressions(node);
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.20251124`;
2289
+ var version = `${versionMajorMinor}.0-insiders.20251129`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -62912,7 +62912,7 @@ function createTypeChecker(host) {
62912
62912
  const modifiers = getMappedTypeModifiers(type.mappedType);
62913
62913
  const readonlyMask = modifiers & 1 /* IncludeReadonly */ ? false : true;
62914
62914
  const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
62915
- const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType) || unknownType, readonlyMask && indexInfo.isReadonly)] : emptyArray;
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;
62916
62916
  const members = createSymbolTable();
62917
62917
  const limitedConstraint = getLimitedConstraint(type);
62918
62918
  for (const prop of getPropertiesOfType(type.source)) {
@@ -62936,6 +62936,7 @@ function createTypeChecker(host) {
62936
62936
  inferredProp.links.mappedType = type.mappedType;
62937
62937
  inferredProp.links.constraintType = type.constraintType;
62938
62938
  }
62939
+ inferredProp.links.inferenceConstraintType = type.inferenceConstraintType;
62939
62940
  members.set(prop.escapedName, inferredProp);
62940
62941
  }
62941
62942
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos);
@@ -72902,19 +72903,20 @@ function createTypeChecker(host) {
72902
72903
  function getTypeOfReverseMappedSymbol(symbol) {
72903
72904
  const links = getSymbolLinks(symbol);
72904
72905
  if (!links.type) {
72905
- links.type = inferReverseMappedType(symbol.links.propertyType, symbol.links.mappedType, symbol.links.constraintType) || unknownType;
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;
72906
72908
  }
72907
72909
  return links.type;
72908
72910
  }
72909
- function inferReverseMappedTypeWorker(sourceType, target, constraint) {
72911
+ function inferReverseMappedTypeWorker(sourceType, target, constraint, reverseMappedConstraint) {
72910
72912
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
72911
72913
  const templateType = getTemplateTypeFromMappedType(target);
72912
72914
  const inference = createInferenceInfo(typeParameter);
72913
72915
  inferTypes([inference], sourceType, templateType);
72914
- return getTypeFromInference(inference) || unknownType;
72916
+ return getTypeFromInference(inference) ?? reverseMappedConstraint ?? unknownType;
72915
72917
  }
72916
- function inferReverseMappedType(source, target, constraint) {
72917
- const cacheKey = source.id + "," + target.id + "," + constraint.id;
72918
+ function inferReverseMappedType(source, target, constraint, reverseMappedConstraint) {
72919
+ const cacheKey = source.id + "," + target.id + "," + constraint.id + "," + ((reverseMappedConstraint == null ? void 0 : reverseMappedConstraint.id) ?? "0");
72918
72920
  if (reverseMappedCache.has(cacheKey)) {
72919
72921
  return reverseMappedCache.get(cacheKey) || unknownType;
72920
72922
  }
@@ -72925,7 +72927,7 @@ function createTypeChecker(host) {
72925
72927
  if (isDeeplyNestedType(target, reverseMappedTargetStack, reverseMappedTargetStack.length, 2)) reverseExpandingFlags |= 2 /* Target */;
72926
72928
  let type;
72927
72929
  if (reverseExpandingFlags !== 3 /* Both */) {
72928
- type = inferReverseMappedTypeWorker(source, target, constraint);
72930
+ type = inferReverseMappedTypeWorker(source, target, constraint, reverseMappedConstraint);
72929
72931
  }
72930
72932
  reverseMappedSourceStack.pop();
72931
72933
  reverseMappedTargetStack.pop();
@@ -73770,13 +73772,39 @@ function createTypeChecker(host) {
73770
73772
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
73771
73773
  if (constraint) {
73772
73774
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
73775
+ inferredType = cloneWithInferenceConstraintIfNeeded(inferredType, instantiatedConstraint);
73776
+ if (inferredType) {
73777
+ inference.inferredType = inferredType;
73778
+ }
73773
73779
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
73780
+ fallbackType = cloneWithInferenceConstraintIfNeeded(fallbackType, instantiatedConstraint);
73774
73781
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
73775
73782
  }
73776
73783
  }
73777
73784
  clearActiveMapperCaches();
73778
73785
  }
73779
73786
  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
+ }
73780
73808
  }
73781
73809
  function getDefaultTypeArgumentType(isInJavaScriptFile) {
73782
73810
  return isInJavaScriptFile ? anyType : unknownType;
@@ -84437,8 +84465,7 @@ function createTypeChecker(host) {
84437
84465
  }
84438
84466
  }
84439
84467
  function isNotWithinNullishCoalesceExpression(node) {
84440
- const parent2 = walkUpOuterExpressions(node);
84441
- return !isBinaryExpression(parent2) || parent2.operatorToken.kind !== 61 /* QuestionQuestionToken */;
84468
+ return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */;
84442
84469
  }
84443
84470
  function getSyntacticNullishnessSemantics(node) {
84444
84471
  node = skipOuterExpressions(node);
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-62789-2",
5
+ "version": "6.0.0-pr-56300-12",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [