File tree 1 file changed +8
-9
lines changed
1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -10716,19 +10716,18 @@ namespace ts {
10716
10716
return result;
10717
10717
}
10718
10718
}
10719
- let constraint = getConstraintForRelation(<TypeParameter>source);
10720
- // A type variable with no constraint is not related to the non-primitive object type.
10721
- if (constraint || !(target.flags & TypeFlags.NonPrimitive)) {
10722
- if (!constraint || constraint.flags & TypeFlags.Any) {
10723
- constraint = emptyObjectType;
10724
- }
10725
- // Report constraint errors only if the constraint is not the empty object type
10726
- const reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
10727
- if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
10719
+ const constraint = getConstraintForRelation(<TypeParameter>source);
10720
+ if (!constraint || constraint.flags & TypeFlags.Any) {
10721
+ // A type variable with no constraint is not related to the non-primitive object type.
10722
+ if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
10728
10723
errorInfo = saveErrorInfo;
10729
10724
return result;
10730
10725
}
10731
10726
}
10727
+ else if (result = isRelatedTo(constraint, target, reportErrors)) {
10728
+ errorInfo = saveErrorInfo;
10729
+ return result;
10730
+ }
10732
10731
}
10733
10732
else if (source.flags & TypeFlags.Index) {
10734
10733
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
You can’t perform that action at this time.
0 commit comments