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

Function getJsxPropsTypeForSignatureFromMember

test/fixtures/snapshot/typescript.js:73079–73103  ·  view source on GitHub ↗
(sig, forcedLookupLocation)

Source from the content-addressed store, hash-verified

73077 return propsType;
73078 }
73079 function getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation) {
73080 if (sig.compositeSignatures) {
73081 // JSX Elements using the legacy `props`-field based lookup (eg, react class components) need to treat the `props` member as an input
73082 // instead of an output position when resolving the signature. We need to go back to the input signatures of the composite signature,
73083 // get the type of `props` on each return type individually, and then _intersect them_, rather than union them (as would normally occur
73084 // for a union signature). It's an unfortunate quirk of looking in the output of the signature for the type we want to use for the input.
73085 // The default behavior of `getTypeOfFirstParameterOfSignatureWithFallback` when no `props` member name is defined is much more sane.
73086 var results = [];
73087 for (var _i = 0, _a = sig.compositeSignatures; _i < _a.length; _i++) {
73088 var signature = _a[_i];
73089 var instance = getReturnTypeOfSignature(signature);
73090 if (isTypeAny(instance)) {
73091 return instance;
73092 }
73093 var propType = getTypeOfPropertyOfType(instance, forcedLookupLocation);
73094 if (!propType) {
73095 return;
73096 }
73097 results.push(propType);
73098 }
73099 return getIntersectionType(results); // Same result for both union and intersection signatures
73100 }
73101 var instanceType = getReturnTypeOfSignature(sig);
73102 return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation);
73103 }
73104 function getStaticTypeOfReferencedJsxConstructor(context) {
73105 if (isJsxIntrinsicIdentifier(context.tagName)) {
73106 var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context);

Callers 1

Calls 5

getReturnTypeOfSignatureFunction · 0.85
isTypeAnyFunction · 0.85
getTypeOfPropertyOfTypeFunction · 0.85
getIntersectionTypeFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…