Skip to content

Commit ce6fd5e

Browse files
committed
Exception for 'any' constraint only applies to type parameters
1 parent 5e1330e commit ce6fd5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/checker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10740,7 +10740,7 @@ namespace ts {
1074010740
}
1074110741
}
1074210742
const constraint = getConstraintForRelation(<TypeParameter>source);
10743-
if (!constraint || constraint.flags & TypeFlags.Any) {
10743+
if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) {
1074410744
// A type variable with no constraint is not related to the non-primitive object type.
1074510745
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) {
1074610746
errorInfo = saveErrorInfo;

0 commit comments

Comments
 (0)