From ce6fd5eeaaede51caa79bc9becbc8f5bf58ecc3e Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 8 May 2018 09:42:03 -0700 Subject: [PATCH] Exception for 'any' constraint only applies to type parameters --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a34f073df3e..1c9de743e9b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10740,7 +10740,7 @@ namespace ts { } } const constraint = getConstraintForRelation(source); - if (!constraint || constraint.flags & TypeFlags.Any) { + if (!constraint || (source.flags & TypeFlags.TypeParameter && constraint.flags & TypeFlags.Any)) { // A type variable with no constraint is not related to the non-primitive object type. if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~TypeFlags.NonPrimitive))) { errorInfo = saveErrorInfo;