File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -10716,19 +10716,18 @@ namespace ts {
1071610716 return result;
1071710717 }
1071810718 }
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))) {
1072810723 errorInfo = saveErrorInfo;
1072910724 return result;
1073010725 }
1073110726 }
10727+ else if (result = isRelatedTo(constraint, target, reportErrors)) {
10728+ errorInfo = saveErrorInfo;
10729+ return result;
10730+ }
1073210731 }
1073310732 else if (source.flags & TypeFlags.Index) {
1073410733 if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
You can’t perform that action at this time.
0 commit comments