(type, callExpression, assumeTrue)
| 71301 | getIntersectionType([type, candidate]); |
| 71302 | } |
| 71303 | function narrowTypeByCallExpression(type, callExpression, assumeTrue) { |
| 71304 | if (hasMatchingArgument(callExpression, reference)) { |
| 71305 | var signature = assumeTrue || !ts.isCallChain(callExpression) ? getEffectsSignature(callExpression) : undefined; |
| 71306 | var predicate = signature && getTypePredicateOfSignature(signature); |
| 71307 | if (predicate && (predicate.kind === 0 /* TypePredicateKind.This */ || predicate.kind === 1 /* TypePredicateKind.Identifier */)) { |
| 71308 | return narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue); |
| 71309 | } |
| 71310 | } |
| 71311 | if (containsMissingType(type) && ts.isAccessExpression(reference) && ts.isPropertyAccessExpression(callExpression.expression)) { |
| 71312 | var callAccess = callExpression.expression; |
| 71313 | if (isMatchingReference(reference.expression, getReferenceCandidate(callAccess.expression)) && |
| 71314 | ts.isIdentifier(callAccess.name) && callAccess.name.escapedText === "hasOwnProperty" && callExpression.arguments.length === 1) { |
| 71315 | var argument = callExpression.arguments[0]; |
| 71316 | if (ts.isStringLiteralLike(argument) && getAccessedPropertyName(reference) === ts.escapeLeadingUnderscores(argument.text)) { |
| 71317 | return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); |
| 71318 | } |
| 71319 | } |
| 71320 | } |
| 71321 | return type; |
| 71322 | } |
| 71323 | function narrowTypeByTypePredicate(type, predicate, callExpression, assumeTrue) { |
| 71324 | // Don't narrow from 'any' if the predicate type is exactly 'Object' or 'Function' |
| 71325 | if (predicate.type && !(isTypeAny(type) && (predicate.type === globalObjectType || predicate.type === globalFunctionType))) { |
no test coverage detected
searching dependent graphs…