mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Merge pull request #15320 from Microsoft/fixTypePredicateThisParameter
Fix type predicates with this parameters
This commit is contained in:
commit
a0abadbcbe
5 files changed
+204
-1
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user