@typescript-deploys/pr-build 5.0.0-pr-52865-6 → 5.0.0-pr-52866-6

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
@@ -63329,7 +63329,7 @@ function createTypeChecker(host) {
63329
63329
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
63330
63330
  if (constraint) {
63331
63331
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
63332
- if (!inferredType || inferredType === silentNeverType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63332
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
63333
63333
  inference.inferredType = inferredType = instantiatedConstraint;
63334
63334
  }
63335
63335
  }
@@ -66706,17 +66706,20 @@ function createTypeChecker(host) {
66706
66706
  contextualType
66707
66707
  );
66708
66708
  }
66709
+ function getDiscriminatedApparentType(node, type) {
66710
+ const apparentType = mapType(
66711
+ type,
66712
+ getApparentType,
66713
+ /*noReductions*/
66714
+ true
66715
+ );
66716
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
66717
+ }
66709
66718
  function getApparentTypeOfContextualType(node, contextFlags) {
66710
66719
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType(node, contextFlags);
66711
66720
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
66712
66721
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
66713
- const apparentType = mapType(
66714
- instantiatedType,
66715
- getApparentType,
66716
- /*noReductions*/
66717
- true
66718
- );
66719
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
66722
+ return getDiscriminatedApparentType(node, instantiatedType);
66720
66723
  }
66721
66724
  }
66722
66725
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -69121,7 +69124,8 @@ function createTypeChecker(host) {
69121
69124
  const isFromBindingPattern = !skipBindingPatterns && getContextualType(node, 8 /* SkipBindingPatterns */) !== contextualType;
69122
69125
  if (!isFromBindingPattern) {
69123
69126
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
69124
- const instantiatedType = instantiateType(contextualType, outerMapper);
69127
+ const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
69128
+ const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
69125
69129
  const contextualSignature = getSingleCallSignature(instantiatedType);
69126
69130
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
69127
69131
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
package/lib/tsserver.js CHANGED
@@ -67936,7 +67936,7 @@ function createTypeChecker(host) {
67936
67936
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
67937
67937
  if (constraint) {
67938
67938
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
67939
- if (!inferredType || inferredType === silentNeverType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
67939
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
67940
67940
  inference.inferredType = inferredType = instantiatedConstraint;
67941
67941
  }
67942
67942
  }
@@ -71313,17 +71313,20 @@ function createTypeChecker(host) {
71313
71313
  contextualType
71314
71314
  );
71315
71315
  }
71316
+ function getDiscriminatedApparentType(node, type) {
71317
+ const apparentType = mapType(
71318
+ type,
71319
+ getApparentType,
71320
+ /*noReductions*/
71321
+ true
71322
+ );
71323
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
71324
+ }
71316
71325
  function getApparentTypeOfContextualType(node, contextFlags) {
71317
71326
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
71318
71327
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
71319
71328
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
71320
- const apparentType = mapType(
71321
- instantiatedType,
71322
- getApparentType,
71323
- /*noReductions*/
71324
- true
71325
- );
71326
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
71329
+ return getDiscriminatedApparentType(node, instantiatedType);
71327
71330
  }
71328
71331
  }
71329
71332
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -73728,7 +73731,8 @@ function createTypeChecker(host) {
73728
73731
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
73729
73732
  if (!isFromBindingPattern) {
73730
73733
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
73731
- const instantiatedType = instantiateType(contextualType, outerMapper);
73734
+ const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
73735
+ const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
73732
73736
  const contextualSignature = getSingleCallSignature(instantiatedType);
73733
73737
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
73734
73738
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
@@ -65744,7 +65744,7 @@ ${lanes.join("\n")}
65744
65744
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
65745
65745
  if (constraint) {
65746
65746
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
65747
- if (!inferredType || inferredType === silentNeverType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
65747
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
65748
65748
  inference.inferredType = inferredType = instantiatedConstraint;
65749
65749
  }
65750
65750
  }
@@ -69121,17 +69121,20 @@ ${lanes.join("\n")}
69121
69121
  contextualType
69122
69122
  );
69123
69123
  }
69124
+ function getDiscriminatedApparentType(node, type) {
69125
+ const apparentType = mapType(
69126
+ type,
69127
+ getApparentType,
69128
+ /*noReductions*/
69129
+ true
69130
+ );
69131
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69132
+ }
69124
69133
  function getApparentTypeOfContextualType(node, contextFlags) {
69125
69134
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
69126
69135
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
69127
69136
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
69128
- const apparentType = mapType(
69129
- instantiatedType,
69130
- getApparentType,
69131
- /*noReductions*/
69132
- true
69133
- );
69134
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69137
+ return getDiscriminatedApparentType(node, instantiatedType);
69135
69138
  }
69136
69139
  }
69137
69140
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -71536,7 +71539,8 @@ ${lanes.join("\n")}
71536
71539
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
71537
71540
  if (!isFromBindingPattern) {
71538
71541
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
71539
- const instantiatedType = instantiateType(contextualType, outerMapper);
71542
+ const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
71543
+ const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
71540
71544
  const contextualSignature = getSingleCallSignature(instantiatedType);
71541
71545
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
71542
71546
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
package/lib/typescript.js CHANGED
@@ -65744,7 +65744,7 @@ ${lanes.join("\n")}
65744
65744
  const constraint = getConstraintOfTypeParameter(inference.typeParameter);
65745
65745
  if (constraint) {
65746
65746
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
65747
- if (!inferredType || inferredType === silentNeverType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
65747
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
65748
65748
  inference.inferredType = inferredType = instantiatedConstraint;
65749
65749
  }
65750
65750
  }
@@ -69121,17 +69121,20 @@ ${lanes.join("\n")}
69121
69121
  contextualType
69122
69122
  );
69123
69123
  }
69124
+ function getDiscriminatedApparentType(node, type) {
69125
+ const apparentType = mapType(
69126
+ type,
69127
+ getApparentType,
69128
+ /*noReductions*/
69129
+ true
69130
+ );
69131
+ return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69132
+ }
69124
69133
  function getApparentTypeOfContextualType(node, contextFlags) {
69125
69134
  const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags);
69126
69135
  const instantiatedType = instantiateContextualType(contextualType, node, contextFlags);
69127
69136
  if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) {
69128
- const apparentType = mapType(
69129
- instantiatedType,
69130
- getApparentType,
69131
- /*noReductions*/
69132
- true
69133
- );
69134
- return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType;
69137
+ return getDiscriminatedApparentType(node, instantiatedType);
69135
69138
  }
69136
69139
  }
69137
69140
  function instantiateContextualType(contextualType, node, contextFlags) {
@@ -71536,7 +71539,8 @@ ${lanes.join("\n")}
71536
71539
  const isFromBindingPattern = !skipBindingPatterns && getContextualType2(node, 8 /* SkipBindingPatterns */) !== contextualType;
71537
71540
  if (!isFromBindingPattern) {
71538
71541
  const outerMapper = getMapperFromContext(cloneInferenceContext(outerContext, 1 /* NoDefault */));
71539
- const instantiatedType = instantiateType(contextualType, outerMapper);
71542
+ const argumentApparentType = outerContext && isCallOrNewExpression(node.parent) && getDiscriminatedApparentType(node, contextualType);
71543
+ const instantiatedType = instantiateType(argumentApparentType && argumentApparentType !== unknownType ? argumentApparentType : contextualType, outerMapper);
71540
71544
  const contextualSignature = getSingleCallSignature(instantiatedType);
71541
71545
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
71542
71546
  inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
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.0.0-pr-52865-6",
5
+ "version": "5.0.0-pr-52866-6",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [