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

Function hasContextualTypeWithNoGenericTypes

test/fixtures/snapshot/typescript.js:71503–71514  ·  view source on GitHub ↗
(node, checkMode)

Source from the content-addressed store, hash-verified

71501 return !!(type.flags & 465829888 /* TypeFlags.Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* TypeFlags.Nullable */));
71502 }
71503 function hasContextualTypeWithNoGenericTypes(node, checkMode) {
71504 // Computing the contextual type for a child of a JSX element involves resolving the type of the
71505 // element's tag name, so we exclude that here to avoid circularities.
71506 // If check mode has `CheckMode.RestBindingElement`, we skip binding pattern contextual types,
71507 // as we want the type of a rest element to be generic when possible.
71508 var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
71509 !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
71510 (checkMode && checkMode & 64 /* CheckMode.RestBindingElement */ ?
71511 getContextualType(node, 8 /* ContextFlags.SkipBindingPatterns */)
71512 : getContextualType(node));
71513 return contextualType && !isGenericType(contextualType);
71514 }
71515 function getNarrowableTypeForReference(type, reference, checkMode) {
71516 // When the type of a reference is or contains an instantiable type with a union type constraint, and
71517 // when the reference is in a constraint position (where it is known we'll obtain the apparent type) or

Callers 1

Calls 2

getContextualTypeFunction · 0.85
isGenericTypeFunction · 0.85

Tested by

no test coverage detected