MCPcopy Create free account
hub / github.com/nodejs/node / getUninstantiatedJsxSignaturesOfType

Function getUninstantiatedJsxSignaturesOfType

test/fixtures/snapshot/typescript.js:74081–74108  ·  view source on GitHub ↗
(elementType, caller)

Source from the content-addressed store, hash-verified

74079 return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
74080 }
74081 function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
74082 if (elementType.flags & 4 /* TypeFlags.String */) {
74083 return [anySignature];
74084 }
74085 else if (elementType.flags & 128 /* TypeFlags.StringLiteral */) {
74086 var intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller);
74087 if (!intrinsicType) {
74088 error(caller, ts.Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements);
74089 return ts.emptyArray;
74090 }
74091 else {
74092 var fakeSignature = createSignatureForJSXIntrinsic(caller, intrinsicType);
74093 return [fakeSignature];
74094 }
74095 }
74096 var apparentElemType = getApparentType(elementType);
74097 // Resolve the signatures, preferring constructor
74098 var signatures = getSignaturesOfType(apparentElemType, 1 /* SignatureKind.Construct */);
74099 if (signatures.length === 0) {
74100 // No construct signatures, try call signatures
74101 signatures = getSignaturesOfType(apparentElemType, 0 /* SignatureKind.Call */);
74102 }
74103 if (signatures.length === 0 && apparentElemType.flags & 1048576 /* TypeFlags.Union */) {
74104 // If each member has some combination of new/call signatures; make a union signature list for those
74105 signatures = getUnionSignatures(ts.map(apparentElemType.types, function (t) { return getUninstantiatedJsxSignaturesOfType(t, caller); }));
74106 }
74107 return signatures;
74108 }
74109 function getIntrinsicAttributesTypeFromStringLiteralType(type, location) {
74110 // If the elemType is a stringLiteral type, we can then provide a check to make sure that the string literal type is one of the Jsx intrinsic element type
74111 // For example:

Callers 1

Calls 7

getApparentTypeFunction · 0.85
getSignaturesOfTypeFunction · 0.85
getUnionSignaturesFunction · 0.85
errorFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected