Merge pull request #15320 from Microsoft/fixTypePredicateThisParameter

Fix type predicates with this parameters
This commit is contained in:
Mohamed Hegazy
2017-04-24 10:44:43 -07:00
committed by GitHub
5 changed files with 204 additions and 1 deletions

View File

@@ -11565,7 +11565,7 @@ namespace ts {
}
if (isIdentifierTypePredicate(predicate)) {
const predicateArgument = callExpression.arguments[predicate.parameterIndex];
const predicateArgument = callExpression.arguments[predicate.parameterIndex - (signature.thisParameter ? 1 : 0)];
if (predicateArgument) {
if (isMatchingReference(reference, predicateArgument)) {
return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);