MCPcopy Index your code
hub / github.com/nodejs/node / narrowTypeByAssertion

Function narrowTypeByAssertion

test/fixtures/snapshot/typescript.js:70486–70500  ·  view source on GitHub ↗
(type, expr)

Source from the content-addressed store, hash-verified

70484 return undefined;
70485 }
70486 function narrowTypeByAssertion(type, expr) {
70487 var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true);
70488 if (node.kind === 95 /* SyntaxKind.FalseKeyword */) {
70489 return unreachableNeverType;
70490 }
70491 if (node.kind === 221 /* SyntaxKind.BinaryExpression */) {
70492 if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) {
70493 return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right);
70494 }
70495 if (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */) {
70496 return getUnionType([narrowTypeByAssertion(type, node.left), narrowTypeByAssertion(type, node.right)]);
70497 }
70498 }
70499 return narrowType(type, node, /*assumeTrue*/ true);
70500 }
70501 function getTypeAtFlowCall(flow) {
70502 var signature = getEffectsSignature(flow.node);
70503 if (signature) {

Callers 1

getTypeAtFlowCallFunction · 0.85

Calls 2

getUnionTypeFunction · 0.85
narrowTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…