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

Function getContextualTypeForJsxAttribute

test/fixtures/snapshot/typescript.js:72864–72878  ·  view source on GitHub ↗
(attribute)

Source from the content-addressed store, hash-verified

72862 : undefined;
72863 }
72864 function getContextualTypeForJsxAttribute(attribute) {
72865 // When we trying to resolve JsxOpeningLikeElement as a stateless function element, we will already give its attributes a contextual type
72866 // which is a type of the parameter of the signature we are trying out.
72867 // If there is no contextual type (e.g. we are trying to resolve stateful component), get attributes type from resolving element's tagName
72868 if (ts.isJsxAttribute(attribute)) {
72869 var attributesType = getApparentTypeOfContextualType(attribute.parent);
72870 if (!attributesType || isTypeAny(attributesType)) {
72871 return undefined;
72872 }
72873 return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
72874 }
72875 else {
72876 return getContextualType(attribute.parent);
72877 }
72878 }
72879 // Return true if the given expression is possibly a discriminant value. We limit the kinds of
72880 // expressions we check to those that don't depend on their contextual type in order not to cause
72881 // recursive (and possibly infinite) invocations of getContextualType.

Callers 2

createTypeCheckerFunction · 0.85
getContextualTypeFunction · 0.85

Calls 4

isTypeAnyFunction · 0.85
getContextualTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…