From bc36f8c5ca3abb9c972053fa92ea089dfdb136d1 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 23 May 2016 16:04:22 -0700 Subject: [PATCH] Apparent members for type params constrained by any --- src/compiler/checker.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) {