You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return getConditionalTypeInstantiation(type as ConditionalType, prependTypeMapping((type as ConditionalType).root.checkType, constraint, (type as ConditionalType).mapper));
13682
+
return getConditionalTypeInstantiation(type as ConditionalType, prependTypeMapping((type as ConditionalType).root.checkType, constraint, (type as ConditionalType).mapper), /*forConstraint*/ false);
13683
13683
}
13684
13684
}
13685
13685
return type;
@@ -14128,7 +14128,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
@@ -19665,7 +19669,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
19665
19669
return getIndexedAccessType(instantiateType((type as IndexedAccessType).objectType, mapper), instantiateType((type as IndexedAccessType).indexType, mapper), (type as IndexedAccessType).accessFlags, /*accessNode*/ undefined, newAliasSymbol, newAliasTypeArguments);
19666
19670
}
19667
19671
if (flags & TypeFlags.Conditional) {
19668
-
return getConditionalTypeInstantiation(type as ConditionalType, combineTypeMappers((type as ConditionalType).mapper, mapper), aliasSymbol, aliasTypeArguments);
19672
+
return getConditionalTypeInstantiation(type as ConditionalType, combineTypeMappers((type as ConditionalType).mapper, mapper), /*forConstraint*/ false, aliasSymbol, aliasTypeArguments);
19669
19673
}
19670
19674
if (flags & TypeFlags.Substitution) {
19671
19675
const newBaseType = instantiateType((type as SubstitutionType).baseType, mapper);
@@ -22414,25 +22418,23 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
22414
22418
}
22415
22419
}
22416
22420
}
22417
-
else {
22418
-
// conditionals aren't related to one another via distributive constraint as it is much too inaccurate and allows way
22419
-
// more assignments than are desirable (since it maps the source check type to its constraint, it loses information)
22420
-
const distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source as ConditionalType) : undefined;
22421
-
if (distributiveConstraint) {
22422
-
if (result = isRelatedTo(distributiveConstraint, target, RecursionFlags.Source, reportErrors)) {
22423
-
return result;
22424
-
}
22425
-
}
22426
-
}
22427
-
22428
-
// conditionals _can_ be related to one another via normal constraint, as, eg, `A extends B ? O : never` should be assignable to `O`
22421
+
// conditionals can be related to one another via normal constraint, as, eg, `A extends B ? O : never` should be assignable to `O`
22429
22422
// when `O` is a conditional (`never` is trivially assignable to `O`, as is `O`!).
22430
22423
const defaultConstraint = getDefaultConstraintOfConditionalType(source as ConditionalType);
22431
22424
if (defaultConstraint) {
22432
22425
if (result = isRelatedTo(defaultConstraint, target, RecursionFlags.Source, reportErrors)) {
22433
22426
return result;
22434
22427
}
22435
22428
}
22429
+
// conditionals aren't related to one another via distributive constraint as it is much too inaccurate and allows way
22430
+
// more assignments than are desirable (since it maps the source check type to its constraint, it loses information).
0 commit comments