Skip to content

Commit

Permalink
Use reverse assignable check instead of comparable check
Browse files Browse the repository at this point in the history
  • Loading branch information
ahejlsberg committed Oct 6, 2023
1 parent 2f5d9e9 commit c7613d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18323,7 +18323,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// then no instantiations will be and we can just return the false branch type.
if (!(inferredExtendsType.flags & TypeFlags.AnyOrUnknown) && (checkType.flags & TypeFlags.Any || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & TypeFlags.Any || forConstraint && areTypesComparable(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
if (checkType.flags & TypeFlags.Any || forConstraint && isTypeAssignableTo(getPermissiveInstantiation(inferredExtendsType), getPermissiveInstantiation(checkType))) {
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
}
// If falseType is an immediately nested conditional type that isn't distributive or has an
Expand Down

0 comments on commit c7613d6

Please sign in to comment.