Fix comparability between type parameters related by a union constraint (#50978)

This commit is contained in:
Andrew Branch
2022-09-28 10:06:13 -07:00
committed by GitHub
parent b09e93d3f6
commit fbfe9340a9
5 changed files with 109 additions and 1 deletions

View File

@@ -19734,7 +19734,7 @@ namespace ts {
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
let constraint = getConstraintOfTypeParameter(source);
if (constraint && hasNonCircularBaseConstraint(source)) {
while (constraint && constraint.flags & TypeFlags.TypeParameter) {
while (constraint && someType(constraint, c => !!(c.flags & TypeFlags.TypeParameter))) {
if (result = isRelatedTo(constraint, target, RecursionFlags.Source, /*reportErrors*/ false)) {
return result;
}