diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index e80be0bfe45..722c223a842 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9927,9 +9927,9 @@ namespace ts { } const apparentType = getApparentType(getWidenedType(type)); - if (apparentType === unknownType) { - // handle cases when type is Type parameter with invalid constraint - return unknownType; + if (apparentType === unknownType || (type.flags & TypeFlags.TypeParameter && isTypeAny(apparentType))) { + // handle cases when type is Type parameter with invalid or any constraint + return apparentType; } const prop = getPropertyOfType(apparentType, right.text); if (!prop) { @@ -11120,7 +11120,9 @@ namespace ts { // types are provided for the argument expressions, and the result is always of type Any. // We exclude union types because we may have a union of function types that happen to have // no common signatures. - if (isTypeAny(funcType) || (!callSignatures.length && !constructSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) { + if (isTypeAny(funcType) || + (isTypeAny(apparentType) && funcType.flags & TypeFlags.TypeParameter) || + (!callSignatures.length && !constructSignatures.length && !(funcType.flags & TypeFlags.Union) && isTypeAssignableTo(funcType, globalFunctionType))) { // The unknownType indicates that an error already occurred (and was reported). No // need to report another error in this case. if (funcType !== unknownType && node.typeArguments) {